Skip to content
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: init function refactor #515

Merged
merged 4 commits into from
May 28, 2024

Conversation

hexqi
Copy link
Collaborator

@hexqi hexqi commented May 28, 2024

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

  • 优化init方法,删除重复逻辑
  • demo设计器改用vite命令,改用8090端口
  • init方法支持传入应用生命周期函数

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • Introduced Vite for serving and building the application, enhancing performance and development experience.
    • Added Vite configuration file to customize server settings.
  • Improvements

    • Updated copyright notices.
    • Simplified initialization process by consolidating steps into a single init() function.
    • Enhanced dev:demo script to include setup steps before running services.
  • Refactor

    • Moved init function to a separate file for better modularity and maintainability.
    • Updated import paths and function calls for improved code structure.
  • Chores

    • Added "type": "module" to package.json for vite-plugin-generate-comments.
    • Updated package dependencies in setup script.

Copy link
Contributor

coderabbitai bot commented May 28, 2024

Warning

Rate Limit Exceeded

@hexqi has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 47 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

Commits Files that changed from the base of the PR and between b87a2d8 and a5e9329.

Walkthrough

The recent updates primarily involve transitioning from engine-cli to vite for serving and building the project, refining initialization processes, and enhancing modularity. Significant changes include script updates in package.json, new configurations in vite.config.js, and the introduction of an init function in packages/design-core/src/init.js to streamline application setup.

Changes

Files/Paths Change Summary
designer-demo/package.json Updated scripts to use vite instead of engine-cli and modified dev:demo script for setup.
designer-demo/src/canvas.js Added copyright notices and license information.
designer-demo/src/main.js Updated import statements and function calls related to defineEntry and init.
designer-demo/vite.config.js Introduced Vite configuration with server port customization.
packages/build/vite-plugin-generate-comments/... Added "type": "module" to package.json.
packages/design-core/index.js Changed export to source init function from ./src/init.
packages/design-core/src/init.js Introduced init function for Vue.js app initialization with various configurations.
packages/design-core/src/main.js Refactored to use init function for initialization.
scripts/setup.js Updated package dependencies to include @opentiny/vite-plugin-generate-comments.

Poem

In the garden of code, where changes bloom,
Vite now serves, dispelling gloom.
Scripts refined, and functions neat,
Initialization's a streamlined feat.
A rabbit cheers with joyous might,
For progress made in coding's light.
🌸🐇✨


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to full the review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@hexqi hexqi marked this pull request as draft May 28, 2024 09:51
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 81fae7e and 0ab92b5.
Files selected for processing (9)
  • designer-demo/package.json (1 hunks)
  • designer-demo/src/canvas.js (1 hunks)
  • designer-demo/src/main.js (2 hunks)
  • designer-demo/vite.config.js (1 hunks)
  • package.json (1 hunks)
  • packages/design-core/index.js (1 hunks)
  • packages/design-core/src/init.js (1 hunks)
  • packages/design-core/src/main.js (1 hunks)
  • scripts/setup.js (1 hunks)
Files skipped from review due to trivial changes (4)
  • designer-demo/package.json
  • designer-demo/src/canvas.js
  • package.json
  • packages/design-core/index.js
Additional Context Used
Biome (2)
packages/design-core/src/init.js (1)

35-50: Prefer for...of instead of forEach.

scripts/setup.js (1)

1-1: A Node.js builtin module should be imported with the node: protocol.

Additional comments not posted (8)
scripts/setup.js (1)

3-3: The command execution line looks good.

designer-demo/vite.config.js (2)

1-2: The import statements are correctly set up to bring in necessary configurations and functions.


4-14: The Vite configuration is well-structured and correctly merges the default configuration with custom settings, including setting a custom server port.

packages/design-core/src/main.js (2)

13-13: The import of the init function is correctly done from the local module.


15-15: The execution of the init function is appropriate for initializing the application.

designer-demo/src/main.js (2)

13-15: The imports for setting up the application entry point are correctly implemented.


17-18: The application initialization logic using defineEntry and init functions is correctly structured.

packages/design-core/src/init.js (1)

13-93: The initialization logic is comprehensive and well-structured, covering various aspects of application setup.

scripts/setup.js Outdated Show resolved Hide resolved
packages/design-core/src/init.js Outdated Show resolved Hide resolved
@hexqi hexqi force-pushed the feat/init-refactor branch 2 times, most recently from da8b539 to 6a6c0ca Compare May 28, 2024 10:14
@hexqi hexqi changed the title Feat/init refactor feat: init function refactor May 28, 2024
@hexqi hexqi force-pushed the feat/init-refactor branch 3 times, most recently from ad4e2f3 to 8769a02 Compare May 28, 2024 10:32
@hexqi hexqi marked this pull request as ready for review May 28, 2024 10:33
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 0ab92b5 and 8769a02.
Files selected for processing (6)
  • designer-demo/src/canvas.js (1 hunks)
  • designer-demo/src/main.js (2 hunks)
  • package.json (1 hunks)
  • packages/build/vite-plugin-generate-comments/package.json (1 hunks)
  • packages/design-core/src/init.js (1 hunks)
  • scripts/setup.js (1 hunks)
Files skipped from review due to trivial changes (1)
  • packages/build/vite-plugin-generate-comments/package.json
Files skipped from review as they are similar to previous changes (5)
  • designer-demo/src/canvas.js
  • designer-demo/src/main.js
  • package.json
  • packages/design-core/src/init.js
  • scripts/setup.js

@hexqi hexqi force-pushed the feat/init-refactor branch from 8769a02 to 88e4aae Compare May 28, 2024 10:40
@hexqi hexqi force-pushed the feat/init-refactor branch from 88e4aae to 85545da Compare May 28, 2024 10:42
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 8769a02 and b87a2d8.
Files selected for processing (6)
  • designer-demo/src/canvas.js (1 hunks)
  • designer-demo/src/main.js (2 hunks)
  • package.json (1 hunks)
  • packages/build/vite-plugin-generate-comments/package.json (1 hunks)
  • packages/design-core/src/init.js (1 hunks)
  • scripts/setup.js (1 hunks)
Files skipped from review as they are similar to previous changes (5)
  • designer-demo/src/canvas.js
  • designer-demo/src/main.js
  • package.json
  • packages/build/vite-plugin-generate-comments/package.json
  • scripts/setup.js
Additional comments not posted (3)
packages/design-core/src/init.js (3)

33-52: The logic for merging registries appears robust and well-structured.


54-78: Lifecycle methods are well-implemented and cover essential initialization steps.


81-92: The init function is well-structured and effectively orchestrates the application initialization.

packages/design-core/src/init.js Outdated Show resolved Hide resolved
packages/design-core/src/init.js Show resolved Hide resolved
@hexqi hexqi force-pushed the feat/init-refactor branch from b87a2d8 to a5e9329 Compare May 28, 2024 11:43
@chilingling chilingling added the ready_for_review This PR requires more reviews label May 28, 2024
@kevinmoch kevinmoch merged commit 5134ab3 into opentiny:refactor/develop May 28, 2024
yy-wow pushed a commit to yy-wow/tiny-engine that referenced this pull request Oct 10, 2024
* feat: extract init logic to init.js

* feat: use vite command

* feat: add app lifecycle

* fix: reviews
@coderabbitai coderabbitai bot mentioned this pull request Jan 25, 2025
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready_for_review This PR requires more reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants