Skip to content

v2.2.0-rc.1#1077

Merged
wenmine merged 3 commits intoopentiny:release/v2.2.0from
hexqi:chore/update-rc-version
Jan 26, 2025
Merged

v2.2.0-rc.1#1077
wenmine merged 3 commits intoopentiny:release/v2.2.0from
hexqi:chore/update-rc-version

Conversation

@hexqi
Copy link
Collaborator

@hexqi hexqi commented Jan 26, 2025

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

  • 更新cli模板并升级到v2.2.0-rc.1解决rc.0版本启动白屏问题
  • 添加cli模板更新脚本,避免后续cli模板未及时更新问题

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

  • Version Update

    • Updated version number from 2.2.0-rc.0 to 2.2.0-rc.1 across multiple packages
    • Added a new script updateTemplate for template management
  • Template Changes

    • Modified designer template configuration
    • Updated project dependencies to specific release candidate versions
    • Adjusted Vite configuration settings
  • New Script

    • Introduced updateTemplate.mjs script for template directory updates
    • Includes functions for copying, updating package JSON, and modifying Vite configuration

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 26, 2025

Walkthrough

This pull request involves a comprehensive version update across multiple packages from 2.2.0-rc.0 to 2.2.0-rc.1. The changes primarily focus on version incrementation in numerous package.json files across the project, including core packages, plugins, toolbars, and settings. Additionally, a new script updateTemplate.mjs has been introduced to facilitate template updates, and minor configuration modifications were made in the designer template's registry and Vite configuration.

Changes

File/Directory Change Summary
package.json Added new script "updateTemplate"
designer-demo/package.json Version updated to 2.2.0-rc.1
mockServer/package.json Version updated to 2.2.0-rc.1
packages/block-compiler/package.json Version updated to 2.2.0-rc.1
Multiple package.json files Version updated to 2.2.0-rc.1 (across plugins, toolbars, settings)
packages/engine-cli/template/designer/registry.js Modified Block plugin configuration
packages/engine-cli/template/designer/vite.config.js Added useSourceAlias: false
scripts/updateTemplate.mjs New script for template updating

Sequence Diagram

sequenceDiagram
    participant Script as updateTemplate.mjs
    participant FS as File System
    participant Template as Project Template
    
    Script->>FS: Backup existing template
    Script->>FS: Copy new template
    Script->>Template: Update package.json version
    Script->>Template: Modify Vite configuration
    Script->>FS: Clean up backup
Loading

Possibly related PRs

Suggested labels

bug, enhancement, ready_for_review

Suggested reviewers

  • chilingling

Poem

🐰 Hop, hop, version bump we go!
Packages dancing, all in a row
From rc.0 to rc.1 we leap
Tiny updates, smooth and neat
CodeRabbit's magic, version's delight! 🚀


📜 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 6f37484 and aafe2c3.

📒 Files selected for processing (1)
  • scripts/updateTemplate.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/updateTemplate.mjs

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>, please review it.
    • 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 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 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 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. (Beta)
  • @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.

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: 1

🧹 Nitpick comments (2)
scripts/updateTemplate.mjs (2)

24-52: Add success logging and consolidate path checks.

The copyTemplate function should log successful operations for better visibility. Also, consider consolidating multiple path existence checks.

 async function copyTemplate() {
   const templateBackupPath = path.resolve(templateDistPath, '../designer_backup')
-  if (await fs.pathExists(templateBackupPath)) {
-    await fs.remove(templateBackupPath)
-  }
+  await fs.remove(templateBackupPath).catch(() => {})
   // 先备份原目录
   if (await fs.pathExists(templateDistPath)) {
     await fs.move(templateDistPath, templateBackupPath)
   }
   try {
     // 删除cli template内容
-    if (await fs.pathExists(templateDistPath)) {
-      await fs.remove(templateDistPath)
-    }
+    await fs.remove(templateDistPath).catch(() => {})
     // 复制designer-demo
     await fs.copy(templateSrcPath, templateDistPath, { filter })
     await fs.remove(templateBackupPath)
+    logger.info('Template updated successfully')
   } catch (error) {
     logger.error(error)
     // 复制错误时恢复
     if (await fs.pathExists(templateBackupPath)) {
       await fs.move(templateBackupPath, templateDistPath)
     }
+    throw error  // Re-throw to indicate failure
   } finally {
     if (await fs.pathExists(templateBackupPath)) {
       await fs.remove(templateBackupPath)
     }
   }
 }

87-97: Add error handling to modifyViteConfig.

The modifyViteConfig function should handle potential file read/write errors.

 async function modifyViteConfig() {
   const viteConfigPath = path.resolve(templateDistPath, 'vite.config.js')
   if (await fs.exists(viteConfigPath)) {
+    try {
       const fileContent = await fs.readFile(viteConfigPath, { encoding: 'utf-8' })
       const aliasRegexp = /useSourceAlias: *true/
       if (aliasRegexp.test(fileContent)) {
         const newFileContent = fileContent.replace(aliasRegexp, 'useSourceAlias: false')
         await fs.writeFile(viteConfigPath, newFileContent)
+        logger.info('Updated vite.config.js')
       }
+    } catch (error) {
+      logger.error('Failed to modify vite.config.js:', error)
+      throw error
+    }
   }
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2d47b79 and 6f37484.

📒 Files selected for processing (62)
  • designer-demo/package.json (1 hunks)
  • mockServer/package.json (1 hunks)
  • package.json (1 hunks)
  • packages/block-compiler/package.json (1 hunks)
  • packages/blockToWebComponentTemplate/package.json (1 hunks)
  • packages/build/vite-config/package.json (1 hunks)
  • packages/build/vite-plugin-meta-comments/package.json (1 hunks)
  • packages/builtinComponent/package.json (1 hunks)
  • packages/canvas/package.json (1 hunks)
  • packages/common/package.json (1 hunks)
  • packages/configurator/package.json (1 hunks)
  • packages/design-core/package.json (1 hunks)
  • packages/engine-cli/package.json (1 hunks)
  • packages/engine-cli/template/designer/package.json (2 hunks)
  • packages/engine-cli/template/designer/registry.js (1 hunks)
  • packages/engine-cli/template/designer/vite.config.js (1 hunks)
  • packages/i18n/package.json (1 hunks)
  • packages/layout/package.json (1 hunks)
  • packages/plugins/block/package.json (1 hunks)
  • packages/plugins/bridge/package.json (1 hunks)
  • packages/plugins/datasource/package.json (1 hunks)
  • packages/plugins/help/package.json (1 hunks)
  • packages/plugins/i18n/package.json (1 hunks)
  • packages/plugins/materials/package.json (1 hunks)
  • packages/plugins/page/package.json (1 hunks)
  • packages/plugins/robot/package.json (1 hunks)
  • packages/plugins/schema/package.json (1 hunks)
  • packages/plugins/script/package.json (1 hunks)
  • packages/plugins/state/package.json (1 hunks)
  • packages/plugins/tree/package.json (1 hunks)
  • packages/plugins/tutorial/package.json (1 hunks)
  • packages/register/package.json (1 hunks)
  • packages/settings/design/package.json (1 hunks)
  • packages/settings/events/package.json (1 hunks)
  • packages/settings/panel/package.json (1 hunks)
  • packages/settings/props/package.json (1 hunks)
  • packages/settings/styles/package.json (1 hunks)
  • packages/svgs/package.json (1 hunks)
  • packages/theme/base/package.json (1 hunks)
  • packages/theme/dark/package.json (1 hunks)
  • packages/theme/light/package.json (1 hunks)
  • packages/toolbars/breadcrumb/package.json (1 hunks)
  • packages/toolbars/clean/package.json (1 hunks)
  • packages/toolbars/collaboration/package.json (1 hunks)
  • packages/toolbars/fullscreen/package.json (1 hunks)
  • packages/toolbars/generate-code/package.json (1 hunks)
  • packages/toolbars/lang/package.json (1 hunks)
  • packages/toolbars/layout/package.json (1 hunks)
  • packages/toolbars/lock/package.json (1 hunks)
  • packages/toolbars/logo/package.json (1 hunks)
  • packages/toolbars/logout/package.json (1 hunks)
  • packages/toolbars/media/package.json (1 hunks)
  • packages/toolbars/preview/package.json (1 hunks)
  • packages/toolbars/redoundo/package.json (1 hunks)
  • packages/toolbars/refresh/package.json (1 hunks)
  • packages/toolbars/save/package.json (1 hunks)
  • packages/toolbars/setting/package.json (1 hunks)
  • packages/toolbars/view-setting/package.json (1 hunks)
  • packages/utils/package.json (1 hunks)
  • packages/vue-generator/package.json (1 hunks)
  • packages/webcomponent/package.json (1 hunks)
  • scripts/updateTemplate.mjs (1 hunks)
✅ Files skipped from review due to trivial changes (57)
  • mockServer/package.json
  • designer-demo/package.json
  • packages/plugins/schema/package.json
  • packages/toolbars/lang/package.json
  • packages/plugins/help/package.json
  • packages/utils/package.json
  • packages/settings/panel/package.json
  • packages/block-compiler/package.json
  • packages/layout/package.json
  • packages/plugins/state/package.json
  • packages/plugins/script/package.json
  • packages/builtinComponent/package.json
  • packages/svgs/package.json
  • packages/plugins/i18n/package.json
  • packages/toolbars/logo/package.json
  • packages/i18n/package.json
  • packages/plugins/block/package.json
  • packages/build/vite-plugin-meta-comments/package.json
  • packages/settings/design/package.json
  • packages/settings/styles/package.json
  • packages/plugins/page/package.json
  • packages/build/vite-config/package.json
  • packages/plugins/datasource/package.json
  • packages/plugins/tutorial/package.json
  • packages/configurator/package.json
  • packages/settings/events/package.json
  • packages/toolbars/fullscreen/package.json
  • packages/register/package.json
  • packages/plugins/materials/package.json
  • packages/webcomponent/package.json
  • packages/vue-generator/package.json
  • packages/common/package.json
  • packages/settings/props/package.json
  • packages/plugins/tree/package.json
  • packages/blockToWebComponentTemplate/package.json
  • packages/toolbars/logout/package.json
  • packages/plugins/bridge/package.json
  • packages/theme/light/package.json
  • packages/toolbars/clean/package.json
  • packages/theme/base/package.json
  • packages/toolbars/setting/package.json
  • packages/toolbars/breadcrumb/package.json
  • packages/toolbars/view-setting/package.json
  • packages/toolbars/preview/package.json
  • packages/toolbars/redoundo/package.json
  • packages/theme/dark/package.json
  • packages/toolbars/media/package.json
  • packages/toolbars/layout/package.json
  • packages/engine-cli/package.json
  • packages/toolbars/collaboration/package.json
  • packages/toolbars/generate-code/package.json
  • packages/plugins/robot/package.json
  • packages/toolbars/save/package.json
  • packages/design-core/package.json
  • packages/canvas/package.json
  • packages/toolbars/refresh/package.json
  • packages/toolbars/lock/package.json
🧰 Additional context used
🪛 Biome (1.9.4)
scripts/updateTemplate.mjs

[error] 79-80: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 82-84: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
🔇 Additional comments (5)
packages/engine-cli/template/designer/vite.config.js (1)

10-10: LGTM! Verify the impact of disabling source aliases.

The addition of useSourceAlias: false is consistent with the template update script. However, we should verify that this doesn't affect source map generation or debugging capabilities in development.

✅ Verification successful

Verified: Source alias disabled for production optimization

The change to useSourceAlias: false is a deliberate production optimization that:

  • Uses built packages instead of source files
  • Reduces build complexity
  • Does not affect source map generation or debugging in production
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if source maps are still generated and verify no regressions in build output

# Check if source maps are generated in the build output
vite build --mode development
find dist -name "*.map" | wc -l

Length of output: 202


Script:

#!/bin/bash
# Search for useSourceAlias usage across the codebase
rg "useSourceAlias" -B 2 -A 2

# Look for alias configurations in vite config files
fd "vite.config" --exec cat {}

Length of output: 67119

packages/engine-cli/template/designer/registry.js (1)

104-117: LGTM! Block plugin configuration enhances content organization.

The addition of mergeCategoriesAndGroups: true to the Block plugin configuration will improve the organization of content by consolidating categories and groups.

packages/engine-cli/template/designer/package.json (1)

2-2: LGTM! Version updates are consistent.

The dependency updates to version 2.2.0-rc.1 are consistent across all @opentiny packages, and the project name change aligns with the template updates.

Also applies to: 14-17, 28-29

package.json (2)

22-23: Document the new updateTemplate script.

The addition of the updateTemplate script looks good. However, please add documentation explaining:

  • The purpose of this script
  • When and how to use it
  • Any prerequisites or dependencies
  • Expected outcomes

22-23: Verify the updateTemplate script functionality.

Let's verify the new script's functionality and permissions:

✅ Verification successful

✓ The updateTemplate script is properly configured and functional

The script has all required files, correct permissions, and proper error handling with backup mechanisms. It correctly manages the template update process from designer-demo to engine-cli/template/designer.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the updateTemplate script exists and has proper permissions

# Check if the script exists
if [ -f "./scripts/updateTemplate.mjs" ]; then
  echo "✓ Script exists"
  
  # Check file permissions
  ls -l "./scripts/updateTemplate.mjs"
  
  # Check script contents for potential issues
  echo "Script contents:"
  cat "./scripts/updateTemplate.mjs"
else
  echo "✗ Script not found: ./scripts/updateTemplate.mjs"
  exit 1
fi

Length of output: 3704


Script:

#!/bin/bash
# Verify all required files and dependencies exist

echo "Checking required files and directories..."

# Check source directory
echo "\nChecking designer-demo directory:"
ls -la designer-demo 2>/dev/null || echo "designer-demo directory not found"

# Check destination directory structure
echo "\nChecking engine-cli template directory:"
ls -la packages/engine-cli/template 2>/dev/null || echo "engine-cli template directory not found"

# Check logger script
echo "\nChecking logger.mjs:"
ls -la scripts/logger.mjs 2>/dev/null || echo "logger.mjs not found"

# Check design-core package.json
echo "\nChecking design-core package.json:"
ls -la packages/design-core/package.json 2>/dev/null || echo "design-core/package.json not found"

# Check dependencies in root package.json
echo "\nChecking required dependencies:"
grep "fs-extra" package.json || echo "fs-extra not found in dependencies"

Length of output: 1701

@wenmine wenmine merged commit b5789c5 into opentiny:release/v2.2.0 Jan 26, 2025
2 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Feb 19, 2025
14 tasks
@coderabbitai coderabbitai bot mentioned this pull request Mar 31, 2025
14 tasks
@coderabbitai coderabbitai bot mentioned this pull request Dec 9, 2025
14 tasks
@coderabbitai coderabbitai bot mentioned this pull request Feb 13, 2026
14 tasks
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