feat(cli): add build script & update template#582
feat(cli): add build script & update template#582chilingling merged 2 commits intoopentiny:refactor/developfrom
Conversation
|
Warning Rate limit exceeded@hexqi has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 37 minutes and 33 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThis update streamlines dependencies across various packages, emphasizing the Changes
Poem
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
08e0ff7 to
c5358be
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (16)
- designer-demo/package.json (1 hunks)
- packages/design-core/package.json (1 hunks)
- packages/engine-cli/README.md (1 hunks)
- packages/engine-cli/bin/cli.js (1 hunks)
- packages/engine-cli/package.json (2 hunks)
- packages/engine-cli/src/commands/create.js (1 hunks)
- packages/engine-cli/src/index.js (1 hunks)
- packages/engine-cli/template/designer/env/.env.development (1 hunks)
- packages/engine-cli/template/designer/package.json (2 hunks)
- packages/engine-cli/template/designer/preview.html (1 hunks)
- packages/engine-cli/template/designer/registry.js (3 hunks)
- packages/engine-cli/template/designer/src/configurators/index.js (1 hunks)
- packages/engine-cli/template/designer/src/defineEntry.js (1 hunks)
- packages/engine-cli/template/designer/src/main.js (1 hunks)
- packages/engine-cli/template/designer/src/preview.js (1 hunks)
- packages/engine-cli/template/designer/vite.config.js (1 hunks)
Files skipped from review due to trivial changes (8)
- designer-demo/package.json
- packages/design-core/package.json
- packages/engine-cli/bin/cli.js
- packages/engine-cli/package.json
- packages/engine-cli/src/index.js
- packages/engine-cli/template/designer/env/.env.development
- packages/engine-cli/template/designer/preview.html
- packages/engine-cli/template/designer/src/defineEntry.js
Additional context used
LanguageTool
packages/engine-cli/README.md
[uncategorized] ~3-~3: This verb may not be in the correct form. Consider using a different form for this context. (AI_EN_LECTOR_REPLACEMENT_VERB_FORM)
Context: # engine-cli tiny-engine cli for create new designer/plugin/... ## dev ```sh n...
Markdownlint
packages/engine-cli/README.md
26-26: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines
5-5: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
14-14: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
19-19: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
6-6: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
15-15: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
20-20: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
Additional comments not posted (10)
packages/engine-cli/template/designer/src/configurators/index.js (1)
3-5: The restructuring ofconfiguratorsfrom an array to an object simplifies access patterns. Please ensure all references toconfiguratorsin the application are updated to accommodate this change.packages/engine-cli/template/designer/package.json (1)
16-16: The additions todependenciesanddevDependenciesalign with the project's evolving architecture. Please ensure compatibility tests are conducted to confirm that these new dependencies integrate smoothly with the existing systems.Also applies to: 25-25
packages/engine-cli/template/designer/src/preview.js (3)
13-16: Ensure that the newly added imports are used appropriately and check for potential conflicts or redundancies.
18-20: ThebeforeAppCreatefunction correctly initializes environment-specific hooks. This is a good practice for managing environment configurations dynamically.
22-29: TheinitPreviewfunction setup appears to be correctly structured to include lifecycle hooks. However, ensure that thebeforeAppCreatehook integrates smoothly with other parts of the application lifecycle.Verification successful
The integration of the
beforeAppCreatehook with the application lifecycle appears to be smooth, as evidenced by the multiple instances of its usage and proper invocation in the lifecycle management files.
packages/design-core/src/init.jspackages/design-core/src/preview/src/main.jsNo conflicts or errors were found in the search results.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify integration of `beforeAppCreate` with application lifecycle. # Test: Search for usage of `beforeAppCreate` in other lifecycle integrations. Expect: No conflicts or errors reported. rg --type js "beforeAppCreate"Length of output: 1121
packages/engine-cli/template/designer/src/main.js (1)
16-16: Initialization of the application appears correct. It's important to ensure that thebeforeAppCreatelifecycle hook andconfiguratorsare properly integrated and tested.packages/engine-cli/template/designer/vite.config.js (2)
27-32: The merging of configurations is a crucial step to ensure that all settings are correctly applied. Verify thatmergeConfigcorrectly combinesdefaultConfigandconfigwithout losing any settings.Verification successful
I will now look up the 'vite' documentation for version 4.3.7 to verify the
mergeConfigfunction.
The
mergeConfigfunction from 'vite' is designed to deeply merge two configuration objects. It ensures that all settings from bothdefaultConfigandconfigare combined without losing any settings. Based on the documentation and the usage in your codebase, it appears to be used correctly.
designer-demo/vite.config.jspackages/engine-cli/template/designer/vite.config.jsScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that `mergeConfig` combines configurations correctly. # Test: Log the final configuration to ensure all settings are present. Expect: All settings from both configs appear in the log. node -e "console.log(require('./packages/engine-cli/template/designer/vite.config.js')())"Length of output: 170
Script:
#!/bin/bash # Locate the implementation of the `mergeConfig` function ast-grep --lang javascript --pattern 'function mergeConfig($_, $_) { $$$ }' # Search for test cases or usage examples of `mergeConfig` rg 'mergeConfig' --type jsLength of output: 563
Script:
#!/bin/bash # Search for all usages of `mergeConfig` in the codebase rg 'mergeConfig' --type js # Fetch the 'vite' library version to look up the correct documentation jq -r '.dependencies.vite' < package.json || jq -r '.devDependencies.vite' < package.jsonLength of output: 426
Script:
#!/bin/bash # Fetch the 'vite' library version from dependencies jq -r '.dependencies.vite' < package.json # Fetch the 'vite' library version from devDependencies jq -r '.devDependencies.vite' < package.jsonLength of output: 68
13-20: The dynamic alias configuration is a flexible approach to handle theming based on environment variables. Ensure that the paths resolved are correct and accessible.packages/engine-cli/template/designer/registry.js (2)
43-44: The updated imports forLayoutandCanvasfrom@opentiny/tiny-engineare used correctly in the registry configuration. This ensures that the components are properly integrated.
Line range hint
55-83: The configuration of the registry appears to be comprehensive and correctly structured. Ensure that all components and plugins listed are properly initialized and available in the project.Verification successful
The output from the shell script shows initialization logs for various components and plugins such as Layout, Canvas, and Page. This indicates that these components are being initialized and are available in the project.
- Layout: Found in
packages/layout/src/hooks/useLayout.js- Canvas: Found in multiple files such as
packages/controller/src/hooks/useResource.js,packages/canvas/container/src/CanvasContainer.vue, andpackages/canvas/container/src/api/useCanvas.js- Page: Found in
packages/controller/src/hooks/useResource.js,packages/controller/src/hooks/usePage.js, andpackages/plugins/page/src/PageTree.vueSince the initialization logs for these components are present, it confirms that they are properly initialized and available in the project.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the initialization and availability of components and plugins in the registry configuration. # Test: Search for initialization logs or errors related to the listed components and plugins. Expect: No errors and proper initialization logs. rg --type js "init" | grep -E "Layout|Canvas|Materials|Tree|Page"Length of output: 4536
58a6e52 to
479f0ec
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
packages/engine-cli/README.md (1)
Line range hint
26-26: Please address the following Markdown formatting issues:
- Remove multiple consecutive blank lines.
- Add blank lines around headings and fenced code blocks as required by Markdownlint.
Also applies to: 5-5, 14-14, 19-19, 6-6, 15-15, 20-20
Tools
Markdownlint
5-5: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
14-14: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
19-19: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
6-6: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
15-15: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
20-20: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (17)
- designer-demo/package.json (1 hunks)
- packages/design-core/package.json (1 hunks)
- packages/engine-cli/.npmrc (1 hunks)
- packages/engine-cli/README.md (1 hunks)
- packages/engine-cli/bin/cli.js (1 hunks)
- packages/engine-cli/package.json (2 hunks)
- packages/engine-cli/src/commands/create.js (1 hunks)
- packages/engine-cli/src/index.js (1 hunks)
- packages/engine-cli/template/designer/env/.env.development (1 hunks)
- packages/engine-cli/template/designer/package.json (2 hunks)
- packages/engine-cli/template/designer/preview.html (1 hunks)
- packages/engine-cli/template/designer/registry.js (3 hunks)
- packages/engine-cli/template/designer/src/configurators/index.js (1 hunks)
- packages/engine-cli/template/designer/src/defineEntry.js (1 hunks)
- packages/engine-cli/template/designer/src/main.js (1 hunks)
- packages/engine-cli/template/designer/src/preview.js (1 hunks)
- packages/engine-cli/template/designer/vite.config.js (1 hunks)
Files skipped from review due to trivial changes (9)
- designer-demo/package.json
- packages/design-core/package.json
- packages/engine-cli/.npmrc
- packages/engine-cli/bin/cli.js
- packages/engine-cli/template/designer/env/.env.development
- packages/engine-cli/template/designer/package.json
- packages/engine-cli/template/designer/preview.html
- packages/engine-cli/template/designer/src/configurators/index.js
- packages/engine-cli/template/designer/src/defineEntry.js
Additional context used
Markdownlint
packages/engine-cli/README.md
26-26: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines
5-5: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
14-14: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
19-19: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
6-6: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
15-15: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
20-20: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
Additional comments not posted (14)
packages/engine-cli/package.json (3)
7-8: The build and development scripts have been updated to useesbuild. Confirm that all necessary options are correctly configured for your project requirements.
20-20: Addition ofesbuildas a devDependency supports the new build scripts. Ensureesbuildis compatible with all other dependencies and the Node.js version you are targeting.
5-5: Ensure that the build process correctly outputs the main file todist/index.jsas specified.packages/engine-cli/README.md (2)
5-10: The documentation for development commands is clear and provides necessary instructions for using the CLI tool in a development environment.Tools
Markdownlint
5-5: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
6-6: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
12-24: The usage instructions are well-documented, ensuring that users can easily understand how to create and develop projects using the CLI tool.Tools
Markdownlint
14-14: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
19-19: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
15-15: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
20-20: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank linespackages/engine-cli/src/index.js (1)
Line range hint
1-15: The setup of the CLI commands usingcommanderis appropriate and follows standard practices for Node.js CLI applications.packages/engine-cli/src/commands/create.js (1)
19-19: The update tosourcePathcalculation reflects a change in the directory structure. Ensure that the new path correctly points to the designer template directory.Verification successful
The
designerdirectory exists withinpackages/engine-cli/template/designer/and contains the expected files. The updatedsourcePathincreate.jscorrectly points to this directory.
packages/engine-cli/template/designer/contains:
canvas.htmlenvindex.htmlpackage.jsonpreview.htmlpublicregistry.jssrcvite.config.jsScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the new sourcePath correctly points to the designer template directory. ls ../template/designer/Length of output: 95
Script:
#!/bin/bash # Locate the `designer` directory within the repository fd designer --type d # Verify the contents of the located `designer` directory fd designer --type d --exec ls {}Length of output: 296
packages/engine-cli/template/designer/src/preview.js (3)
13-16: The imports from@opentiny/tiny-engineand the virtual imports are correctly placed at the top. Ensure that the virtual module'virtual:svg-icons-register'and'@opentiny/tiny-engine-theme'are configured properly in the Vite or Webpack configuration to avoid module resolution errors.
18-20: The functionbeforeAppCreateuses theinitHookto set up the environment. This is a good use of lifecycle methods to ensure that environment variables are configured before the application initializes.
22-29: TheinitPreviewfunction setup appears correct. It's important to ensure that theregistryandlifeCyclesare properly configured and tested since they play a crucial role in the application's initialization phase.packages/engine-cli/template/designer/src/main.js (1)
16-16: The imports and initializations here are crucial for setting up the application's environment and lifecycle. Ensure that theinitHookandHOOK_NAMEare correctly used and that theimport.meta.envis available in the environment where this script runs.packages/engine-cli/template/designer/vite.config.js (1)
13-20: ThedevAliasconfiguration is a smart way to dynamically set aliases based on environment variables. This allows for more flexible and environment-specific configurations. Make sure that theVITE_THEMEenvironment variable is properly documented and validated to prevent runtime errors.packages/engine-cli/template/designer/registry.js (2)
43-44: The imports forLayoutandCanvasfrom@opentiny/tiny-engineare correctly placed. Ensure that these components are properly exported from the@opentiny/tiny-enginepackage and that they are compatible with the rest of the application's architecture.
Line range hint
55-83: The configuration setup in theexport defaultobject is comprehensive and well-structured. However, ensure that all components such asLayout,Canvas, and the plugins listed are thoroughly tested, especially since this configuration directly affects the UI and functionality of the designer.
There was a problem hiding this comment.
Actionable comments posted: 4
Outside diff range and nitpick comments (1)
packages/engine-cli/README.md (1)
Line range hint
26-26: Remove one of the consecutive blank lines to comply with markdown linting rules.26d25 <Tools
Markdownlint
5-5: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
14-14: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
19-19: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
6-6: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
15-15: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
20-20: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (13)
- designer-demo/package.json (1 hunks)
- packages/design-core/package.json (1 hunks)
- packages/engine-cli/.npmrc (1 hunks)
- packages/engine-cli/README.md (1 hunks)
- packages/engine-cli/template/designer/env/.env.development (1 hunks)
- packages/engine-cli/template/designer/package.json (2 hunks)
- packages/engine-cli/template/designer/preview.html (1 hunks)
- packages/engine-cli/template/designer/registry.js (2 hunks)
- packages/engine-cli/template/designer/src/configurators/index.js (1 hunks)
- packages/engine-cli/template/designer/src/defineEntry.js (1 hunks)
- packages/engine-cli/template/designer/src/main.js (1 hunks)
- packages/engine-cli/template/designer/src/preview.js (1 hunks)
- packages/engine-cli/template/designer/vite.config.js (1 hunks)
Files skipped from review due to trivial changes (1)
- packages/engine-cli/template/designer/package.json
Files skipped from review as they are similar to previous changes (11)
- designer-demo/package.json
- packages/design-core/package.json
- packages/engine-cli/.npmrc
- packages/engine-cli/template/designer/env/.env.development
- packages/engine-cli/template/designer/preview.html
- packages/engine-cli/template/designer/registry.js
- packages/engine-cli/template/designer/src/configurators/index.js
- packages/engine-cli/template/designer/src/defineEntry.js
- packages/engine-cli/template/designer/src/main.js
- packages/engine-cli/template/designer/src/preview.js
- packages/engine-cli/template/designer/vite.config.js
Additional context used
Markdownlint
packages/engine-cli/README.md
26-26: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines
5-5: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
14-14: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
19-19: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
6-6: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
15-15: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
20-20: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
* feat: cli add build script
English | 简体中文
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
New Features
engine-cli, a CLI tool for creating new designers/plugins.engine-cli.Bug Fixes
preview.htmlfrom relative to absolute.Refactor
engine-cliusingesbuild.vite.config.jsto include dynamic alias resolution based on theme.Documentation
README.mdforengine-cliwith comprehensive usage guide.Chores
package.jsonfiles.