Skip to content

feat: support npmmirror cdn#1272

Merged
hexqi merged 4 commits intoopentiny:release/v2.2.1from
chilingling:fix/supportNpmMirrorv2.2
Mar 31, 2025
Merged

feat: support npmmirror cdn#1272
hexqi merged 4 commits intoopentiny:release/v2.2.1from
chilingling:fix/supportNpmMirrorv2.2

Conversation

@chilingling
Copy link
Member

@chilingling chilingling commented Mar 31, 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

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

    • Enhanced content delivery by updating external resource endpoints to a new CDN provider.
    • Introduced dynamic configuration for resource URLs based on the selected CDN type.
  • Chores

    • Upgraded external library versions to ensure optimal performance.
    • Streamlined environment and dependency settings for improved resource management.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 31, 2025

Walkthrough

This pull request updates multiple files to change the CDN configuration from using unpkg.com to registry.npmmirror.com. It updates environment files by commenting out the old VITE_CDN_DOMAIN values and adding a new VITE_CDN_TYPE variable. Similar changes occur in JSON files and HTML/JS files where dependency script and CSS URLs are updated. In addition, dynamic placeholder replacements in import maps are enhanced by introducing configurable version and file delimiters. Minor dependency and Vite configuration changes are also included.

Changes

File(s) Change Summary
designer-demo/env/.env.alpha, designer-demo/env/.env.development, designer-demo/env/.env.production Updated VITE_CDN_DOMAIN to use https://registry.npmmirror.com and added new variable VITE_CDN_TYPE=npmmirror with accompanying Chinese comments.
designer-demo/public/mock/bundle.json, packages/engine-cli/template/designer/public/mock/bundle.json Updated URLs for @opentiny/vue and element-plus packages (script and CSS) to point to registry.npmmirror.com.
mockServer/src/assets/json/appinfo.json, mockServer/src/mock/get/app-center/v1/apps/schema/918.json Replaced CDN URLs for element-plus and axios from unpkg.com to registry.npmmirror.com in JSON assets.
packages/block-compiler/index.html, packages/block-compiler/src/dev.ts Modified external resource URLs and the Vue import statement to use registry.npmmirror.com, with dev.ts import reformatted into multiple lines.
packages/canvas/DesignCanvas/src/importMap.js, packages/design-core/src/preview/src/preview/importMap.js, packages/design-core/src/preview/src/preview/importMap.json, packages/design-core/src/preview/src/preview/srcFiles.js, packages/design-core/src/preview/src/preview/srcFiles/app.js Introduced dynamic URL construction using new delimiters (versionDelimiter and fileDelimiter) driven by VITE_CDN_TYPE and updated placeholder replacements accordingly.
packages/common/js/environments.js, packages/common/vite.config.js, packages/design-core/vite.config.js, packages/common/package.json Exported VITE_CDN_TYPE from environments, added corresponding Vite config definitions, and introduced a new dependency "@eslint/js": "^8.57.1".

Sequence Diagram(s)

sequenceDiagram
    participant App as Application Code
    participant Env as Environment Variables
    participant ImportMap as Import Map Generator
    App->>Env: Read VITE_CDN_TYPE
    Env-->>ImportMap: Return VITE_CDN_TYPE value
    ImportMap->>ImportMap: Determine versionDelimiter & fileDelimiter based on VITE_CDN_TYPE
    ImportMap->>ImportMap: Replace placeholders in URLs (e.g., VITE_CDN_DOMAIN, versionDelimiter, fileDelimiter)
    ImportMap-->>App: Return updated import map with dynamic CDN URLs
Loading

Possibly related PRs

Suggested labels

refactor-main

Suggested reviewers

  • hexqi
  • rhlin

Poem

In a garden of code under the moonlight glow,
I hop and nibble on changes that grow.
CDN paths now dance to a new beat,
With npmmirror leading, ever so neat.
My bunny heart leaps with every update in sight,
Celebrating smooth transitions late into the night! 🐰🎉


📜 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 54cd7e1 and 451aca1.

📒 Files selected for processing (2)
  • designer-demo/public/mock/bundle.json (2 hunks)
  • packages/engine-cli/template/designer/public/mock/bundle.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • designer-demo/public/mock/bundle.json
  • packages/engine-cli/template/designer/public/mock/bundle.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check

🪧 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

@github-actions github-actions bot added the bug Something isn't working label Mar 31, 2025
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

🔭 Outside diff range comments (1)
packages/design-core/src/preview/src/preview/srcFiles.js (1)

65-65: ⚠️ Potential issue

Inconsistency between template generation and direct usage

There's an inconsistency between how app.js is processed in the srcFiles object (lines 35-38) versus in the genPreviewTemplate() function. The template generation still uses the old approach without the delimiter replacements.

-      fileContent: appJS.replace(/VITE_CDN_DOMAIN/g, import.meta.env.VITE_CDN_DOMAIN)
+      fileContent: appJS
+        .replaceAll('${VITE_CDN_DOMAIN}', import.meta.env.VITE_CDN_DOMAIN)
+        .replaceAll('${versionDelimiter}', versionDelimiter)
+        .replaceAll('${fileDelimiter}', fileDelimiter)
🧹 Nitpick comments (2)
packages/canvas/DesignCanvas/src/importMap.js (1)

19-22: Consider adding a fallback for undefined VITE_CDN_TYPE

While the implementation looks good, there's no explicit handling for cases where VITE_CDN_TYPE might be undefined during build time. Consider adding a default value to ensure reliability.

- const versionDelimiter = VITE_CDN_TYPE === 'npmmirror' ? '/' : '@'
- const fileDelimiter = VITE_CDN_TYPE === 'npmmirror' ? '/files' : ''
+ const versionDelimiter = (VITE_CDN_TYPE || '') === 'npmmirror' ? '/' : '@'
+ const fileDelimiter = (VITE_CDN_TYPE || '') === 'npmmirror' ? '/files' : ''
designer-demo/public/mock/bundle.json (1)

14043-14044: Consider using versioned URLs for better stability.

The current URL pattern uses a tilde with version range (~3.14) which may pull different versions of the same major release. Consider using exact versions (like done for element-plus) for better predictability and stability.

-          "script": "https://registry.npmmirror.com/@opentiny/vue/~3.14/files/runtime/tiny-vue.mjs",
-          "css": "https://registry.npmmirror.com/@opentiny/vue-theme/~3.14/files/index.css"
+          "script": "https://registry.npmmirror.com/@opentiny/vue/3.20.0/files/runtime/tiny-vue.mjs",
+          "css": "https://registry.npmmirror.com/@opentiny/vue-theme/3.20.0/files/index.css"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3452517 and 54cd7e1.

📒 Files selected for processing (18)
  • designer-demo/env/.env.alpha (1 hunks)
  • designer-demo/env/.env.development (1 hunks)
  • designer-demo/env/.env.production (1 hunks)
  • designer-demo/public/mock/bundle.json (2 hunks)
  • mockServer/src/assets/json/appinfo.json (6 hunks)
  • mockServer/src/mock/get/app-center/v1/apps/schema/918.json (1 hunks)
  • packages/block-compiler/index.html (1 hunks)
  • packages/block-compiler/src/dev.ts (1 hunks)
  • packages/canvas/DesignCanvas/src/importMap.js (3 hunks)
  • packages/common/js/environments.js (1 hunks)
  • packages/common/package.json (1 hunks)
  • packages/common/vite.config.js (1 hunks)
  • packages/design-core/src/preview/src/preview/importMap.js (1 hunks)
  • packages/design-core/src/preview/src/preview/importMap.json (1 hunks)
  • packages/design-core/src/preview/src/preview/srcFiles.js (1 hunks)
  • packages/design-core/src/preview/src/preview/srcFiles/app.js (1 hunks)
  • packages/design-core/vite.config.js (1 hunks)
  • packages/engine-cli/template/designer/public/mock/bundle.json (2 hunks)
🧰 Additional context used
🧬 Code Definitions (3)
packages/design-core/src/preview/src/preview/srcFiles.js (2)
packages/design-core/src/preview/src/preview/importMap.js (2)
  • versionDelimiter (22-22)
  • fileDelimiter (23-23)
packages/canvas/DesignCanvas/src/importMap.js (2)
  • versionDelimiter (13-13)
  • fileDelimiter (14-14)
packages/design-core/src/preview/src/preview/importMap.js (2)
packages/canvas/DesignCanvas/src/importMap.js (2)
  • versionDelimiter (13-13)
  • fileDelimiter (14-14)
packages/design-core/src/preview/src/preview/srcFiles.js (2)
  • versionDelimiter (29-29)
  • fileDelimiter (30-30)
packages/canvas/DesignCanvas/src/importMap.js (3)
packages/design-core/src/preview/src/preview/importMap.js (2)
  • versionDelimiter (22-22)
  • fileDelimiter (23-23)
packages/design-core/src/preview/src/preview/srcFiles.js (2)
  • versionDelimiter (29-29)
  • fileDelimiter (30-30)
packages/common/js/environments.js (4)
  • VITE_CDN_TYPE (19-19)
  • VITE_CDN_TYPE (19-19)
  • VITE_CDN_DOMAIN (18-18)
  • VITE_CDN_DOMAIN (18-18)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
🔇 Additional comments (37)
packages/common/js/environments.js (1)

19-19: Appropriate addition of CDN type environment variable.

This change adds a new environment variable export for VITE_CDN_TYPE, following the established pattern of other environment variables in the file. This addition supports the PR's objective to fix CDN configuration during sub-package builds.

packages/common/package.json (1)

36-36:

Details

❓ Verification inconclusive

Verify relevance of this new ESLint dependency.

Adding the @eslint/js dependency doesn't appear to be directly related to the PR's stated objective of fixing VITE_CDN_TYPE for sub-package builds. Please clarify why this dependency is needed for the CDN configuration changes.


🏁 Script executed:

#!/bin/bash
# Check where this package might be used in the codebase
echo "Searching for @eslint/js usage in the codebase..."
rg "@eslint/js" --type js --type json

Length of output: 328


Clarify the Inclusion of @eslint/js Dependency

I verified that the @eslint/js package is referenced in the codebase—in particular, it’s imported in packages/common/js/config-files/eslint-rule.js (using @eslint/js/src/configs/eslint-recommended.js). Since the main objective of this PR is to fix the VITE_CDN_TYPE for sub-package builds, please clarify how adding this ESLint dependency supports those changes. If its inclusion is intentional and related to linting configurations tied to the PR, it would help to update the PR description accordingly; otherwise, consider removing it.

mockServer/src/assets/json/appinfo.json (6)

16700-16707: CDN URL Update for Element-Plus (ElInput)
The script and css URLs for the ElInput component have been successfully updated to use the new CDN domain at registry.npmmirror.com. This change is consistent with the update strategy for element-plus assets at version 2.4.2. Please verify that the new URLs deliver the expected assets without any side effects.


16980-16987: CDN URL Update for Element-Plus (ElButton)
The URLs for both the script and css properties for the ElButton component have been updated to the new registry. This ensures consistency with the asset location change. Confirm that these new endpoints are reliable in your testing environments.


17301-17308: CDN URL Update for Element-Plus (ElForm)
The changes correctly update the script and css URLs for the ElForm component to point to registry.npmmirror.com. This aligns with the element-plus version 2.4.2 asset distribution.


17758-17765: CDN URL Update for Element-Plus (ElFormItem)
The updated URLs for the ElFormItem component are now pointing to the new CDN, maintaining consistency with other element-plus assets. It would be good to double-check the asset paths to ensure no breakage in component loading in staging.


18108-18115: CDN URL Update for Element-Plus (ElTable)
The ElTable component now references the updated script and css URLs from registry.npmmirror.com. This diff is straightforward and maintains consistency with the element-plus package version used.


19344-19351: CDN URL Update for Element-Plus (ElTableColumn)
The URLs in the ElTableColumn block have been updated to use the new CDN domain. This change is uniform with the previous updates and ensures that the correct asset endpoints are being referenced.

packages/common/vite.config.js (1)

38-39: Added VITE_CDN_TYPE environment variable to the define object

This change makes the VITE_CDN_TYPE environment variable available during build time, allowing sub-packages to access this value. This is consistent with the PR objective to fix how CDN type is handled during sub-package builds.

packages/block-compiler/src/dev.ts (1)

2-6: Updated Vue import to use registry.npmmirror.com CDN

The import statement for Vue has been refactored to:

  1. Use the registry.npmmirror.com CDN instead of unpkg.com
  2. Format the import statement across multiple lines for better readability

This change aligns with the PR's objective to update CDN configuration.

mockServer/src/mock/get/app-center/v1/apps/schema/918.json (1)

2096-2096: Updated axios CDN link to use registry.npmmirror.com

The CDN link for axios has been changed from unpkg.com to registry.npmmirror.com, maintaining consistency with the other CDN-related changes in this PR.

packages/design-core/vite.config.js (1)

38-39: Added VITE_CDN_TYPE environment variable to the define object

This change makes the VITE_CDN_TYPE environment variable available during build time in the design-core package, keeping consistency with the same change in the common package. This ensures that all sub-packages can properly access the CDN type configuration.

designer-demo/env/.env.alpha (1)

4-7: Updated CDN configuration for alpha environment

The changes transition from using unpkg.com to registry.npmmirror.com as the CDN provider, with the addition of the required VITE_CDN_TYPE variable to support the specific URL format needed for npmmirror's CDN.

packages/design-core/src/preview/src/preview/importMap.json (1)

3-20: Improved URL construction with dynamic delimiters

The import paths have been updated to use placeholders for version and file delimiters, making the configuration more flexible to support different CDN formats. This aligns with the CDN change to registry.npmmirror.com which uses a different URL pattern than unpkg.com.

packages/design-core/src/preview/src/preview/srcFiles/app.js (1)

19-20: CSS imports updated to use dynamic URL construction

The CSS resource URLs now use the same placeholder variables as the JS imports, ensuring consistency in how resources are loaded based on the CDN configuration.

packages/design-core/src/preview/src/preview/importMap.js (2)

22-24: Added CDN-specific URL delimiter configuration

The implementation correctly sets the URL delimiters based on the CDN type, with npmmirror requiring different formatting (/ for version delimiter and /files before the file path) compared to other CDNs.


25-29: Enhanced placeholder replacement with additional delimiters

The replacePlaceholder function now handles the new version and file delimiter variables, ensuring that imports are properly formatted according to the chosen CDN's requirements.

designer-demo/env/.env.production (1)

4-7: Updated CDN configuration for production environment

The changes switch the CDN from unpkg.com to registry.npmmirror.com and add a new VITE_CDN_TYPE variable. This aligns with the PR objective of fixing CDN type configuration for sub-package builds.

packages/design-core/src/preview/src/preview/srcFiles.js (2)

29-30: Flexible delimiter configuration based on CDN type

Adding conditional delimiters based on CDN type allows for proper URL formation for different CDN providers. This is a good practice for supporting multiple CDNs.


35-38: Enhanced string replacement for app.js

The implementation now correctly handles multiple replacements using replaceAll for CDN domain and delimiters.

packages/block-compiler/index.html (2)

7-7: Updated Vue theme stylesheet source

The stylesheet link has been updated to use registry.npmmirror.com instead of unpkg.com, which is consistent with the environment configuration changes.


11-26: Updated all import map sources to use registry.npmmirror.com

All import map entries have been updated to use the registry.npmmirror.com CDN, which is consistent with the environment configuration changes. The URL pattern also incorporates the '/files' path segment, which aligns with the fileDelimiter logic added in the JavaScript files.

designer-demo/env/.env.development (1)

4-7: Updated CDN configuration for development environment

The changes switch the CDN from unpkg.com to registry.npmmirror.com and add a new VITE_CDN_TYPE variable. This ensures consistent CDN configuration across all environments (development, production).

packages/canvas/DesignCanvas/src/importMap.js (5)

1-1: Addition of VITE_CDN_TYPE import looks good

The import of VITE_CDN_TYPE is necessary for the dynamic configuration of CDN URLs based on the environment.


13-15: Good approach using dynamic delimiters based on CDN type

This change correctly implements configurable delimiters based on the CDN type. The constants are properly defined before being used in URL construction, making the code more maintainable and consistent with similar implementations in other files.


25-26: URL formatting for style imports updated correctly

The style imports have been properly updated to use the new dynamic delimiters.


33-34: TinyVue dependencies correctly updated

The URLs for @opentiny/vue-common and @opentiny/vue-locale correctly implement the new delimiter pattern.


48-49: Core Vue imports properly updated

The URLs for vue and vue-i18n packages are correctly updated to use the dynamic delimiters.

designer-demo/public/mock/bundle.json (4)

14043-14044: CDN URL updated for @opentiny/vue package.

The script and CSS URLs for the @opentiny/vue package have been updated to use registry.npmmirror.com instead of the previous unpkg.com domain. This change aligns with the PR objective of updating CDN configuration.


14050-14051: CDN URL updated for element-plus package.

The script and CSS URLs for the element-plus package have been updated to use registry.npmmirror.com instead of the previous unpkg.com domain. This maintains consistency with the CDN domain change made for the @opentiny/vue package.


4806-4807: Version updated and destructuring enabled for TinyLayout component.

The TinyLayout component now specifies version "3.20.0" and enables destructuring with destructuring: true. This ensures the component properly integrates with the new CDN configuration and version update.


14043-14051:

Details

✅ Verification successful

Verify CDN URLs are accessible and working properly.

The change from unpkg.com to registry.npmmirror.com is significant. It's important to ensure these new CDN URLs are accessible, stable, and return the correct resources to prevent any runtime issues.


🏁 Script executed:

#!/bin/bash
# Test the accessibility of the new CDN URLs

# Test the @opentiny/vue script URL
echo "Testing @opentiny/vue script URL..."
curl -I "https://registry.npmmirror.com/@opentiny/vue/~3.14/files/runtime/tiny-vue.mjs"

# Test the @opentiny/vue-theme CSS URL
echo "Testing @opentiny/vue-theme CSS URL..."
curl -I "https://registry.npmmirror.com/@opentiny/vue-theme/~3.14/files/index.css"

# Test the element-plus script URL
echo "Testing element-plus script URL..."
curl -I "https://registry.npmmirror.com/element-plus/2.4.2/files/dist/index.full.mjs"

# Test the element-plus CSS URL
echo "Testing element-plus CSS URL..."
curl -I "https://registry.npmmirror.com/element-plus/2.4.2/files/dist/index.css"

Length of output: 5618


CDN URLs Verified and Accessible

  • The @opentiny/vue and @opentiny/vue-theme URLs return HTTP/2 302 responses that redirect to version-specific paths (3.14.0 and 3.14.1), confirming that the CDN is handling version resolution as expected.
  • Both element-plus URLs (script and CSS) return HTTP/2 200 responses, indicating that the correct resources are served.

Based on the tests, these new registry.npmmirror.com URLs are accessible and working properly.

packages/engine-cli/template/designer/public/mock/bundle.json (5)

14043-14044: CDN URLs updated from unpkg.com to registry.npmmirror.com for OpenTiny Vue.

The script and CSS URLs for @opentiny/vue have been updated to use registry.npmmirror.com instead of unpkg.com, with adjusted path structures.


14050-14051: CDN URLs updated from unpkg.com to registry.npmmirror.com for Element Plus.

The script and CSS URLs for element-plus have been updated to use registry.npmmirror.com instead of unpkg.com, with adjusted path structures.


4806-4807: Version and destructuring properties added to TinyLayout.

These additions provide specific version information (3.20.0) and enable destructuring for the TinyLayout component import.


4806-4807:

Details

❓ Verification inconclusive

Verify URL formatting for registry.npmmirror.com paths.

The changes to switch from unpkg.com to registry.npmmirror.com include differences in path structure (addition of /files/ path segment). It's important to verify that these URLs correctly resolve to the expected resources.

Also applies to: 14043-14044, 14050-14051


🏁 Script executed:

#!/bin/bash
# Check if the new CDN URLs are accessible and return valid content

echo "Checking OpenTiny Vue script URL..."
curl -Is "https://registry.npmmirror.com/@opentiny/vue/~3.14/files/runtime/tiny-vue.mjs" | head -n 1

echo "Checking OpenTiny Vue theme CSS URL..."
curl -Is "https://registry.npmmirror.com/@opentiny/vue-theme/~3.14/files/index.css" | head -n 1

echo "Checking Element Plus script URL..."
curl -Is "https://registry.npmmirror.com/element-plus/2.4.2/files/dist/index.full.mjs" | head -n 1

echo "Checking Element Plus CSS URL..."
curl -Is "https://registry.npmmirror.com/element-plus/2.4.2/files/dist/index.css" | head -n 1

Length of output: 764


Action: Confirm CDN URL behavior for registry.npmmirror.com paths

The verification script shows that while the Element Plus script and CSS URLs return a direct HTTP 200 response, the OpenTiny Vue endpoints are issuing HTTP 302 redirects. Please verify that these redirects are expected (i.e., they eventually resolve to the correct resources) and that the inclusion of the /files/ segment is consistently correct across all usage (see files at lines 4806-4807 and at 14043-14044, 14050-14051).


4806-4807:

Details

❓ Verification inconclusive

Ensure consistency with VITE_CDN_TYPE configuration.

The PR objective mentions that "VITE_CDN_TYPE should not be build on sub package build". Verify that these CDN URL changes are consistent with the VITE_CDN_TYPE environment variable changes in other files (like .env.* files) to ensure proper configuration across the project.

Also applies to: 14043-14044, 14050-14051


🏁 Script executed:

#!/bin/bash
# Examine environment files and other configuration to check for VITE_CDN_TYPE settings

echo "Looking for VITE_CDN_TYPE and CDN domain configurations in environment files:"
fd -t f ".env" | xargs grep -l "VITE_CDN" | xargs cat

Length of output: 216


Action: Verify Consistency of CDN Environment Configuration

In the file packages/engine-cli/template/designer/public/mock/bundle.json (lines 4806–4807), the CDN configuration is set as follows:

            "version": "3.20.0",
            "destructuring": true

However, our check for VITE_CDN_TYPE and related settings in the environment files (e.g. .env.*) did not return any results. Please review the following:

  • Confirm whether the absence of VITE_CDN_TYPE in the environment configuration is expected.
  • If CDN URL changes are meant to align with a VITE_CDN_TYPE setting, ensure that the corresponding configurations are added or updated in the appropriate environment files.
  • Verify that similar changes on lines 14043–14044 and 14050–14051 adhere to the intended CDN configuration strategy, as mentioned in the PR objective.

@chilingling chilingling changed the title fix: VITE_CDN_TYPE should not be build on sub package build (#1232) feat: support npmmirror cdn Mar 31, 2025
@github-actions github-actions bot added enhancement New feature or request and removed bug Something isn't working labels Mar 31, 2025
@hexqi hexqi merged commit 6d96225 into opentiny:release/v2.2.1 Mar 31, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants