Skip to content

build: fix component version error #3528

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

Merged
merged 1 commit into from
Jun 23, 2025
Merged

build: fix component version error #3528

merged 1 commit into from
Jun 23, 2025

Conversation

gimmyhehe
Copy link
Member

@gimmyhehe gimmyhehe commented Jun 23, 2025

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)

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:

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

  • Chores
    • Updated internal build process to improve how version information is managed during bundle generation. No visible changes to end-user functionality.

Copy link

coderabbitai bot commented Jun 23, 2025

Walkthrough

The changes update the way a version string is provided to a build plugin. Instead of passing the version directly as a string, a function returning the version string is now passed. This adjustment affects both the plugin's implementation and its invocation within the build configuration.

Changes

File(s) Change Summary
internals/cli/src/commands/build/rollup/replace-module-name.ts Plugin signature changed to accept a function returning the version string instead of the string itself.
internals/cli/src/commands/build/build-ui.ts Plugin invocation updated to pass a function returning the version string instead of the string directly.

Poem

A string once passed, now wrapped with care,
In a function’s arms, floating through air.
The build grows wiser, a subtle new tune,
Version revealed not too late, not too soon.
Rabbits approve, with a hop and a cheer—
Modular magic is happening here! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

internals/cli/src/commands/build/build-ui.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

internals/cli/src/commands/build/rollup/replace-module-name.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 40e69c4 and 9635e4c.

📒 Files selected for processing (2)
  • internals/cli/src/commands/build/build-ui.ts (1 hunks)
  • internals/cli/src/commands/build/rollup/replace-module-name.ts (1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
internals/cli/src/commands/build/build-ui.ts

[error] 261-262: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 262-262: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)

🔇 Additional comments (2)
internals/cli/src/commands/build/rollup/replace-module-name.ts (1)

3-4: Verify timing of version capture for dynamic updates.

The function signature change is correct and aligns with the usage in build-ui.ts. However, calling getVersion() immediately at plugin initialization may not capture version updates that occur later in the build process.

If versionTarget is modified after plugin initialization (e.g., in the beforeWriteFile callback in build-ui.ts line 193), this plugin won't see the updated value.

Consider calling getVersion() at the time of actual usage (line 30) instead of at initialization:

-export default function (getVersion: () => string): Plugin {
-  const version = getVersion()
+export default function (getVersion: () => string): Plugin {
   return {
     name: 'opentiny-vue:replace-module-name',
     generateBundle: (output: NormalizedOutputOptions, bundle: OutputBundle) => {
+      const version = getVersion()
       // ... rest of the logic
internals/cli/src/commands/build/build-ui.ts (1)

262-262: Plugin usage correctly updated to match new signature.

The change from passing versionTarget directly to passing () => versionTarget is consistent with the updated plugin signature in replace-module-name.ts.

This ensures the current value of versionTarget is captured when the plugin function is called, which likely fixes the component version error mentioned in the PR title.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @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 do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

@zzcr zzcr merged commit 3aed708 into dev Jun 23, 2025
11 checks passed
@zzcr zzcr deleted the cgm/fix-version-bug branch June 23, 2025 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants