-
Notifications
You must be signed in to change notification settings - Fork 329
docs: fix plus doc load error #3016
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
Conversation
WalkthroughThis pull request adjusts component and demo file resolution logic. It modifies the Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant getWebdocPath
Caller->>getWebdocPath: Call getWebdocPath(path)
alt path starts with "grid-"
alt path equals "grid-select" or "grid-kit"
getWebdocPath-->>Caller: Continue (do not return "grid")
else
getWebdocPath-->>Caller: Return "grid"
end
else
getWebdocPath-->>Caller: Process other path types (e.g., "chart-", "directives-")
end
sequenceDiagram
participant loadData
participant fetchDemosFile
participant promiseArr
loadData->>fetchDemosFile: fetch file using `@demos/app/${cmpId}/webdoc/${cmpId}.${lang}.md`
alt cmpId not in ['interfaces', 'types', 'classes']
loadData->>promiseArr: Push JS demo config import promise
else
loadData-->>promiseArr: (No import added)
end
Suggested labels
Poem
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
examples/sites/src/views/components-doc/cmp-config.jsOops! 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: 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. examples/sites/src/views/components-doc/index.vueOops! 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: 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. examples/sites/vite.extend.tsOops! 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: 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.
✨ Finishing Touches
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
[e2e-test-warn] The title of the Pull request should look like "fix(vue-renderless): [action-menu, alert] fix xxx bug". Please make sure you've read our contributing guide |
There was a problem hiding this 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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
examples/sites/src/views/components-doc/cmp-config.js(1 hunks)examples/sites/src/views/components-doc/index.vue(1 hunks)examples/sites/src/views/components-doc/plus.vue(1 hunks)examples/sites/vite.extend.ts(1 hunks)
🔇 Additional comments (5)
examples/sites/src/views/components-doc/cmp-config.js (1)
27-27: Added 'grid-kit' to the exclusion listThe
getWebdocPathfunction has been updated to exclude 'grid-kit' from being mapped to 'grid', following the same pattern as the existing exclusion for 'grid-select'. This ensures that 'grid-kit' components have their own documentation path rather than being redirected to the generic 'grid' path.examples/sites/src/views/components-doc/index.vue (1)
9-9: Fixed the Plus component import pathThe import statement has been corrected to import the Plus component from './plus.vue' instead of './pc.vue', ensuring that the correct component is used when the application is in 'plus' mode.
examples/sites/vite.extend.ts (1)
82-82: Updated demos path to use the root plusdocs directoryThe
demosPathvariable has been modified to point to '../plusdocs' instead of '../plusdocs/pc', reflecting a change in the directory structure for plus mode documentation files.examples/sites/src/views/components-doc/plus.vue (2)
19-27: Improved conditional loading of demo configuration filesThe conditional logic for loading demo configuration files has been refactored to be more explicit. Now, the code clearly pushes the import for demo configuration only when the component ID is not in the excluded list ('interfaces', 'types', 'classes'). This change makes the code more readable and maintainable.
12-12:❓ Verification inconclusive
Simplified markdown file path construction
The path construction for loading markdown documentation has been streamlined by directly using the component ID in the path instead of passing it through the
getWebdocPathfunction. This simplification should make path resolution more intuitive.
🏁 Script executed:
#!/bin/bash # Check if any components might still require the getWebdocPath function for special path handling cd examples/sites # First, get a list of components that use special path handling in getWebdocPath components=$(grep -A 7 "getWebdocPath" src/views/components-doc/cmp-config.js | grep "return" | grep -v "path" | sed 's/.*return //' | sed "s/'//g" | sed 's/"//g' | sed 's/ //g' | tr -d '\n') echo "Components with special path handling: $components" # Then check if any markdown files follow these special path patterns echo "Checking for markdown files using special paths..." find ../plusdocs/app -name "*.md" | grep -E "$components"Length of output: 592
Simplified Markdown File Path Construction – Please Verify Directory Structure
The update to
examples/sites/src/views/components-doc/plus.vuenow directly builds the markdown file path using the component ID instead of the legacygetWebdocPathfunction, which streamlines path resolution. Note that our verification script did identify a special case (gridchartdirectives), but attempting to locate markdown files using the old special path logic resulted in a missing directory (plusdocs/app). Please manually verify that this structural change hasn’t affected any components that might still rely on the previous special path handling.
- Confirm that components requiring special handling (e.g., gridchartdirectives) are unaffected.
- Verify that markdown documentation is present at the intended location and that no legacy paths are inadvertently needed.
| const apisPath = '../plusdocs/apis' | ||
| viteConfig.resolve.alias['@menu'] = path.resolve(demosPath) | ||
| viteConfig.resolve.alias['@demo'] = path.resolve(demosPath) | ||
| viteConfig.resolve.alias['@demos'] = path.resolve(demosPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Renamed alias from '@demo' to '@demos'
The alias has been renamed from '@demo' to '@demos' to maintain consistency with other alias references in the codebase.
🏁 Script executed:
#!/bin/bash
# Check for any references to the old '@demo' alias that might need updating
rg -l "@demo" --type=js --type=vue --type=tsLength of output: 72
Alias Replacement Verification Needed: Confirm No Residual '@demo' References
To ensure consistency, please re-run the following commands to search for any lingering references to '@demo' using explicit file glob patterns:
If these commands return no files, it confirms that the alias update—from '@demo' to '@demos' in examples/sites/vite.extend.ts—is applied consistently across the codebase.
🏁 Script executed:
#!/bin/bash
# Re-run search for the old alias '@demo' using proper glob patterns for file types
echo "Checking JavaScript files (.js):"
rg -l "@demo" -g "*.js"
echo "Checking TypeScript files (.ts):"
rg -l "@demo" -g "*.ts"
echo "Checking Vue files (.vue):"
rg -l "@demo" -g "*.vue"Length of output: 841
Ensure Uniform Alias Update Across the Codebase
While the change in examples/sites/vite.extend.ts (line 85) correctly updates the alias to '@demos', our re-verification reveals multiple occurrences of '@demo' in the following files:
-
JavaScript Files:
examples/sites/src/main.jsexamples/sites/src/tools/useTemplateMode.jsexamples/sites/src/views/components-doc/cmp-config.jsexamples/sites/src/views/docs/docConfig.js
-
TypeScript Files:
examples/sites/vite.config.ts- (and potentially other instances within)
examples/sites/vite.extend.ts
-
Vue Files:
examples/sites/playground/App.vueexamples/sites/src/views/components-doc/components/demo.vueexamples/sites/src/views/components-doc/pc.vueexamples/sites/src/views/components-doc/mobile.vueexamples/sites/src/views/components-doc/plus.vueexamples/sites/src/views/overview.vueexamples/sites/src/views/components-doc/saas.vue
To maintain consistency with the alias update, please review these files and update any remaining '@demo' references to '@demos', or confirm if they are intentionally left unchanged.
修复plus官网文档启动报错
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
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
Refactor
Chore