-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: docs theme and build #292
Conversation
WalkthroughThe pull request includes updates to three files: Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (1)
packages/sdk/src/__tests__/zustand.perf.test.ts (1)
Line range hint
1-168
: Summary of changes and suggestions for improvementThe changes in this file primarily involve removing unused imports and adding type annotations to benchmark callbacks. Here's a summary of the review:
- Removed imports: Verify that the removal of
SchemaType
andschema
imports doesn't have unintended consequences.- Type annotations: While adding
this: any
to callbacks improves clarity, consider using more specific types for better type safety.Next steps:
- Run the verification script to check for any remaining references to removed imports.
- Apply the suggested type improvements consistently across all four benchmark tests.
- If possible, add a comment explaining why these performance tests are necessary and what performance targets they are trying to achieve or maintain.
Consider adding performance thresholds to these tests. This could help catch performance regressions early. For example:
const results = await new Promise<Benchmark.Event[]>(resolve => { const results: Benchmark.Event[] = []; suite .on('cycle', (event: Benchmark.Event) => { results.push(event); }) .on('complete', () => resolve(results)) .run({ async: true }); }); results.forEach(result => { expect(result.target.hz).toBeGreaterThan(1000); // Expect more than 1000 ops/sec });This would turn these benchmarks into actual tests that can fail if performance drops below a certain threshold.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
- package.json (1 hunks)
- packages/sdk/src/tests/zustand.perf.test.ts (5 hunks)
- typedoc.json (1 hunks)
🔇 Additional comments (7)
typedoc.json (4)
13-15
: LGTM! Theme animation enabled.The addition of
dmtSettings
with animation enabled could enhance the user experience of the documentation. The inline comment explaining the setting is helpful for future maintenance.Consider testing the documentation with animations enabled to ensure it doesn't negatively impact performance or readability, especially on lower-end devices.
Line range hint
1-37
: Overall, good improvements to documentation configuration.The changes in this file align well with the PR objective of improving the documentation. The switch to a new theme and the addition of navigation links should enhance the user experience.
Key points:
- New theme plugin implemented
- Navigation links added (need actual URLs)
- Theme animation enabled
- Theme changed to "default-modern"
These changes should result in a more modern and user-friendly documentation. Once the placeholder URLs are replaced and the theme appearance is verified, this update will significantly improve the documentation setup.
2-5
: LGTM! Verify new theme compatibility and appearance.The switch to
@typhonjs-typedoc/typedoc-theme-dmt
aligns with the PR objective of improving the documentation. This change could enhance the visual appeal and functionality of the generated docs.Please ensure that:
- The new theme is compatible with your project's TypeScript version.
- The generated documentation renders correctly with the new theme.
- The documentation's appearance meets your project's standards.
You can verify this by running:
16-16
: LGTM! Verify if custom theme color is still needed.The change to "default-modern" theme is consistent with the new theme plugin.
Please verify:
- If the "default-modern" theme meets your project's visual requirements.
- If custom color support is still needed. If so, check the documentation of
@typhonjs-typedoc/typedoc-theme-dmt
for how to set custom colors with the new theme.You can verify the theme's appearance by generating the documentation:
packages/sdk/src/__tests__/zustand.perf.test.ts (3)
114-116
: Apply the same type improvement as in the first benchmarkThis change is identical to the one in the first benchmark test. Please refer to the previous comment about improving the type annotation for
this
.
139-141
: Apply the same type improvement to all benchmarksThe changes in these two benchmark tests are identical to those in the first two. Please apply the same type improvement suggested in the first comment to all four benchmark tests for consistency.
Also applies to: 163-165
1-3
: Verify the impact of removed importsThe imports for
SchemaType
andschema
have been removed. While this can improve code cleanliness, please ensure that:
- These imports weren't being used indirectly elsewhere in the file.
- The removal of
SchemaType
doesn't affect type checking, especially for theMockSchemaType
used increateDojoStore<MockSchemaType>()
.To confirm there are no unintended consequences, run the following script:
@@ -16,7 +16,7 @@ | |||
"prettier": "^3.3.3", | |||
"tsup": "^8.1.0", | |||
"typedoc": "^0.26.7", | |||
"typedoc-material-theme": "^1.1.0", | |||
"@typhonjs-typedoc/typedoc-theme-dmt": "^0.2.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Missing TypeDoc Configuration for the New Theme
While the theme package "@typhonjs-typedoc/typedoc-theme-dmt" has been added to devDependencies
, there is no TypeDoc configuration file to apply this theme. Additionally, the docs
script in package.json
does not specify the new theme, which is necessary for the theme to take effect.
Please:
- Create a TypeDoc Configuration File: Add a
typedoc.json
or similar configuration file that specifies the new theme. - Update the Docs Script: Modify the
docs
script inpackage.json
to include the theme configuration, for example:"npx typedoc --out docs --theme node_modules/@typhonjs-typedoc/typedoc-theme-dmt"
- Verify the Configuration: Run the docs generation script to ensure the new theme is applied correctly.
🔗 Analysis chain
LGTM! Theme package updated as intended.
The change from "typedoc-material-theme" to "@typhonjs-typedoc/typedoc-theme-dmt" aligns with the PR objective of improving the documentation. This update should enhance the appearance and possibly the functionality of the generated docs.
To ensure everything works as expected with the new theme, please:
- Run the docs generation script and verify the output.
- Check if any configuration changes are needed in the TypeDoc setup for this new theme.
Run the following script to verify the TypeDoc configuration:
This script will help you verify if any additional configuration is needed for the new theme.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for TypeDoc configuration files and their content
# Test 1: Look for TypeDoc configuration files
echo "Searching for TypeDoc configuration files:"
fd -e json -e js typedoc.config
# Test 2: If a config file exists, check its content for theme configuration
config_file=$(fd -e json -e js typedoc.config | head -n 1)
if [ -n "$config_file" ]; then
echo "Contents of $config_file:"
cat "$config_file"
else
echo "No TypeDoc configuration file found. You may need to create one to configure the new theme."
fi
# Test 3: Check if the docs script in package.json includes theme configuration
echo "Checking docs script in package.json:"
jq '.scripts.docs' package.json
Length of output: 542
"dmtLinksService": { | ||
"Discord": "<URL>", | ||
"GitHub": "<URL>", | ||
"BitBucket": "<URL>", | ||
"GitLab": "<URL>", | ||
"NPM": "<URL>" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace placeholder URLs with actual links.
The addition of dmtLinksService
is a good improvement for navigation. However, the URLs are currently placeholders.
Please replace the <URL>
placeholders with the actual URLs for each service. For example:
"dmtLinksService": {
"Discord": "https://discord.gg/yourdiscordlink",
"GitHub": "https://github.com/dojoengine/dojo.js",
"NPM": "https://www.npmjs.com/package/your-package-name"
}
You may remove any services that are not applicable to your project.
.on("complete", function (this: any) { | ||
console.log("Fastest is " + this.filter("fastest").map("name")); | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider using a more specific type for this
While adding the this: any
type annotation improves clarity about the function's context, using any
is generally discouraged as it bypasses TypeScript's type checking. If possible, consider using a more specific type for this
.
If Benchmark.js provides type definitions, you could import and use them like this:
import Benchmark from 'benchmark';
// ...
.on("complete", function (this: Benchmark.Suite) {
console.log("Fastest is " + this.filter("fastest").map("name"));
})
If Benchmark.js doesn't provide type definitions, you could create a custom type that includes the methods you're using:
type BenchmarkSuite = {
filter: (criteria: string) => { map: (prop: string) => string[] };
};
// ...
.on("complete", function (this: BenchmarkSuite) {
console.log("Fastest is " + this.filter("fastest").map("name"));
})
Summary by CodeRabbit
New Features
Bug Fixes
Documentation