-
Notifications
You must be signed in to change notification settings - Fork 67
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: monorepo #174
base: main
Are you sure you want to change the base?
feat: monorepo #174
Conversation
WalkthroughThe pull request introduces significant modifications across various configuration and package files within the repository. It reorganizes the Changes
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
docs/.vitepress/plugins/demo.tsOops! Something went wrong! :( ESLint: 8.57.1 Error: Failed to load parser 'vue-eslint-parser' declared in '.eslintrc.js': Cannot find module 'vue-eslint-parser'
internal/build-utils/build.config.tsOops! Something went wrong! :( ESLint: 8.57.1 Error: Failed to load parser 'vue-eslint-parser' declared in '.eslintrc.js': Cannot find module 'vue-eslint-parser'
packages/ant-design-x-vue/src/index.tsOops! Something went wrong! :( ESLint: 8.57.1 Error: Failed to load parser 'vue-eslint-parser' declared in '.eslintrc.js': Cannot find module 'vue-eslint-parser'
🪧 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 (
|
❌ Deploy Preview for antd-design-x-vue failed. Why did it fail? →
|
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: 0
🧹 Nitpick comments (9)
package.json (2)
10-22
: Update of Build and Utility ScriptsThe scripts have been modernized to leverage
pnpm
for workspace filtering and cross-directory commands. A couple of points to note:
- The
"postinstall": "pnpm stub"
and"stub": "pnpm run -r --parallel stub"
commands appear to be placeholders or utility stubs. Verify that these commands meet your intended setup or consider adding a brief comment for clarity.
28-34
: Centralized Dependency ManagementDefining shared dependencies at the workspace root is appropriate. If many sub-packages rely on these libraries, you might explore hoisting common dependencies to avoid version conflicts and duplication.
docs/.vitepress/plugins/demo.ts (1)
3-3
: Absolute Import fordocRoot
Updated.
The import fordocRoot
now uses an absolute path (@ant-design-x-vue/build-utils
) instead of a relative one. This improves maintainability and clarity regarding the module source. Make sure that the package alias is correctly configured in both the monorepo’s package management and the TypeScript path mappings.docs/tsconfig.json (1)
1-23
: New TypeScript Configuration File Added.
This new tsconfig.json defines essential compiler options (ESNext target, module resolution, strict mode, etc.) and provides custom path mappings (e.g. mapping"ant-design-x-vue"
to"../packages/ant-design-x-vue"
and"~/*"
to".vitepress/vitepress/*"
). Please verify that these mappings correctly reflect the monorepo structure and include all necessary directories for proper compilation.play/package.json (2)
2-2
: Package Name Renaming.
The package name has been updated to"@ant-design-x-vue/play"
, which aligns with the monorepo’s naming conventions. Ensure that downstream dependencies and internal documentation reference the new name.
12-14
: Workspace Dependency Update.
The dependency for"ant-design-x-vue"
now uses"workspace:*"
instead of a local file reference. Confirm that the workspace tooling supports this syntax and that the dependency resolves correctly within your monorepo.docs/package.json (1)
1-22
: Documentation Package Configuration Introduced.
This new package.json for@ant-design-x-vue/docs
outlines development scripts for VitePress and specifies both dependencies and devDependencies (including a workspace reference for@ant-design-x-vue/build-utils
). Ensure that these dependencies resolve as intended in the monorepo setup and that the versioning meets the project’s requirements.docs/.vitepress/config.mts (1)
21-24
: Alias Configuration forant-design-x-vue
Commented Out.
The alias configuration for resolvingant-design-x-vue
(mapping it to a local source directory) has been commented out. Confirm that the removal of this alias does not affect module resolution in your build process. If it is no longer needed, consider removing the commented code to keep the configuration clean.packages/ant-design-x-vue/package.json (1)
15-17
: Enhance the Repository Field for Better TraceabilityCurrently, the repository field only specifies the type. Including a repository URL will provide a direct link to the source code. Consider updating as follows:
"repository": { - "type": "git" + "type": "git", + "url": "https://github.com/your-repo.git" }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (18)
.gitignore
(1 hunks)docs/.vitepress/config.mts
(1 hunks)docs/.vitepress/plugins/demo.ts
(1 hunks)docs/.vitepress/plugins/markdown-transform.ts
(1 hunks)docs/package.json
(1 hunks)docs/tsconfig.json
(1 hunks)internal/build-utils/build.config.ts
(1 hunks)internal/build-utils/package.json
(1 hunks)package.json
(2 hunks)packages/ant-design-x-vue/package.json
(1 hunks)packages/ant-design-x-vue/src/index.ts
(1 hunks)packages/ant-design-x-vue/vite.config.mts
(2 hunks)packages/components/package.json
(1 hunks)play/package.json
(2 hunks)play/vite.config.ts
(1 hunks)pnpm-workspace.yaml
(1 hunks)tsconfig.build.json
(2 hunks)tsconfig.json
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Redirect rules - antd-design-x-vue
- GitHub Check: Header rules - antd-design-x-vue
- GitHub Check: Pages changed - antd-design-x-vue
- GitHub Check: Pages changed - antd-design-x-vue
🔇 Additional comments (22)
pnpm-workspace.yaml (1)
2-5
: Workspace Configuration Update ValidityThe updated workspace entries are set properly. Changing
"play"
toplay
is acceptable since quoting isn’t necessary here, and the new entries—docs
,internal/*
, andpackages/*
—correctly expand the monorepo to include the additional directories. Make sure these align with any internal naming conventions if they exist..gitignore (1)
1-23
: Enhanced .gitignore OrganizationThe file has been restructured into clear sections (Dependencies, System Files, Package Manager, Bundle, and local env files). New entries like
dist
,coverage
,.pnpm-debug.log*
, and the additional temporary directories (e.g..dumi/tmp
) are appropriately added to ignore build outputs and logs typical in a monorepo setting.package.json (3)
2-9
: Monorepo Identification and Workspace SetupRenaming the package to
"ant-design-x-vue-monorepo"
and marking it as private clearly indicates the intent for a monorepo structure. The"workspaces"
field now properly includes directories for sub-packages and projects.
77-80
: Peer Dependencies SpecificationThe peer dependency constraints (for
ant-design-vue
andvue
) are clearly defined to ensure compatibility among downstream consumers. This is a good practice.
81-85
: Package Manager and VersioningSpecifying
"packageManager": "pnpm@9.6.0"
standardizes the tooling across the repository. The version bump to"0.0.1"
is appropriate as an initial release version—just remember to update it as further changes are made.packages/ant-design-x-vue/src/index.ts (1)
1-2
: Centralized API ExportRe-exporting everything from
@ant-design-x-vue/components
in this newindex.ts
provides a clean, centralized access point for consumers. This approach enhances modularity and simplifies import paths in other parts of the project.packages/components/package.json (1)
1-17
: New Components Package SetupThe new
package.json
for@ant-design-x-vue/components
is succinct and well-structured. It correctly establishes the package metadata, designatesindex.ts
for both main and module fields, and includes essential scripts for testing, type checking, and linting. The peer dependency on Vue ensures that consumers adhere to the required version. Consider expanding the description further as the package evolves.internal/build-utils/build.config.ts (1)
1-10
: Build configuration looks well-structuredThe build configuration uses
unbuild
to set up a clean, standardized build process with TypeScript declarations and CommonJS output support. This is a good foundation for the monorepo structure.docs/.vitepress/plugins/markdown-transform.ts (1)
5-5
: Import path update aligns with monorepo structureChanging the import from a relative path to a package reference (
@ant-design-x-vue/build-utils
) is appropriate for a monorepo setup. This improves maintainability by reducing path complexity and making dependencies explicit.packages/ant-design-x-vue/vite.config.mts (2)
3-5
: Import statements reorderingThe reordering of imports follows a logical structure and improves code organization.
28-28
: Consistent object key stylingRemoving quotes from the
vue
key is a minor stylistic change that maintains consistency with typical JavaScript object notation.play/vite.config.ts (1)
15-15
:❓ Verification inconclusive
Simplified configuration aligns with monorepo architecture
Removing the path alias for
ant-design-x-vue
is appropriate in a monorepo setup where packages can be referenced directly through workspace dependencies. However, ensure that all imports in theplay
directory have been updated to use the workspace package reference instead of relying on this alias.
🏁 Script executed:
#!/bin/bash # Check if there are any imports using 'ant-design-x-vue' in the play directory echo "Checking for imports of 'ant-design-x-vue' in play directory:" rg -t ts -t vue "from\s+['\"]ant-design-x-vue['\"]" play/Length of output: 230
#!/bin/bash echo "Searching for 'ant-design-x-vue' imports in TypeScript files in the play directory:" rg -t ts "from\s+['\"]ant-design-x-vue['\"]" play/ echo "" echo "Searching for 'ant-design-x-vue' imports in Vue files in the play directory:" rg "from\s+['\"]ant-design-x-vue['\"]" -g '*.vue' play/Action Required: Confirm Import Updates for "ant-design-x-vue"
The removal of the path alias for
ant-design-x-vue
is aligned with our monorepo strategy, where packages are referenced directly via workspace dependencies. However, before finalizing this change, please verify that no files in theplay
directory—neither TypeScript nor Vue—are still importingant-design-x-vue
using the old alias. Use the updated script above to perform a comprehensive check.
- Ensure that all TS files in
play/
no longer use the alias.- Confirm that Vue files are also free from residual alias imports.
Please run the provided script and manually verify the results before merging.
internal/build-utils/package.json (1)
1-28
: New Package Metadata: Structure and Exports are Well-DefinedThis new
package.json
sets up the@ant-design-x-vue/build-utils
package with clear metadata, export mappings (for types, ESM, and CommonJS), and a dedicated stub script. The use of a devDependency (unbuild
) with an appropriate version constraint is in line with best practices for internal build utilities.tsconfig.json (2)
13-16
: Updated Path Mappings Reflect the Monorepo StructureThe new alias mappings—specifically
"ant-design-x-vue": ["packages/ant-design-x-vue"]
and"@ant-design-x-vue/*": ["packages/*"]
—align well with the reorganized monorepo layout. Please ensure that all module references in the codebase are updated accordingly.
21-21
: Refined Include PathsChanging the
include
from the old"src/**/*"
to"packages/components/**/*"
(while still includingdocs
andinternal
) accurately reflects the new file structure and focuses type-checking on the components directory.packages/ant-design-x-vue/package.json (4)
1-14
: Robust Package Setup with Comprehensive MetadataThe package metadata for
ant-design-x-vue
is thorough—covering description, keywords, versioning, and author details. This new setup is an important step toward a well-organized monorepo.
24-31
: Clear Export DefinitionsThe
exports
field accurately defines the entry points for types, ESM, and CommonJS as well as handles CSS file exposure. This creates a smooth consumption experience for various module formats.
39-46
: Scripts Reflect a Monorepo Build and Release WorkflowThe build, watch, changelog, release, and publish scripts seem to be well-thought-out for integrating with the monorepo setup. Just verify that the test script (which filters
@ant-design-x-vue/components
) fits your overall testing strategy.
69-78
: Organized Dependencies ManagementThe dependencies and devDependencies are well segmented. Using
"workspace:*"
for@ant-design-x-vue/components
helps enforce inter-package version consistency within the monorepo.tsconfig.build.json (3)
7-8
: Updated Declaration Directory Aligns with the New Package StructureChanging
"declarationDir"
to"packages/ant-design-x-vue/dist/typings"
ensures that generated type declarations are output directly into the package’s distribution folder. This change supports the monorepo’s modular organization.
16-17
: Simplified Path Mapping for ComponentsMapping
"@ant-design-x-vue/components"
to["./packages/components"]
streamlines module resolution. Just make sure that all internal imports reference this alias as intended.
23-29
: Optimized Include/Exclude Settings for TypeScriptThe revised
include
andexclude
arrays focus on the necessary TypeScript files withinpackages/components
while excluding test files (__tests__
). This setup is optimal for production builds and declaration generation.
我发现有一些地方仍需要调整,稍晚些时候我同步提交上来 |
冲突的这个文件直接使用最新的文件内容就可以了 |
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: 0
🧹 Nitpick comments (3)
.gitignore (1)
15-23
: Comprehensive Management of Local Environment Files
The # local env files section consolidates various temporary folders from both VitePress and Dumi. For maintainability, consider verifying if the VitePress (e.g.docs/.vitepress/cache
, etc.) and Dumi entries could be grouped separately if their lifecycles differ. This is, however, a matter of personal/team preference.packages/ant-design-x-vue/package.json (1)
1-14
: Solid Package Metadata and Naming
The metadata (name, version, description, keywords) is clearly defined. One suggestion is to enhance the repository field by including a URL for improved discoverability; for example:{ - "repository": { - "type": "git" - }, + "repository": { + "type": "git", + "url": "https://github.com/wzc520pyfm/ant-design-x-vue.git" + },package.json (1)
77-86
: Versioning and Publishing Setup
ThepackageManager
,publishConfig
, and"version": "0.0.1"
entries are appropriately set for an initial monorepo release. Note that the"prepublishOnly": "npm run test && npm run build"
script (on line 19) might benefit from usingpnpm
for consistency across the repository. For example:-"prepublishOnly": "npm run test && npm run build", +"prepublishOnly": "pnpm run test && pnpm run build",
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (18)
.gitignore
(1 hunks)docs/.vitepress/config.mts
(1 hunks)docs/.vitepress/plugins/demo.ts
(1 hunks)docs/.vitepress/plugins/markdown-transform.ts
(1 hunks)docs/package.json
(1 hunks)docs/tsconfig.json
(1 hunks)internal/build-utils/build.config.ts
(1 hunks)internal/build-utils/package.json
(1 hunks)package.json
(2 hunks)packages/ant-design-x-vue/package.json
(1 hunks)packages/ant-design-x-vue/src/index.ts
(1 hunks)packages/ant-design-x-vue/vite.config.mts
(2 hunks)packages/components/package.json
(1 hunks)play/package.json
(2 hunks)play/vite.config.ts
(1 hunks)pnpm-workspace.yaml
(1 hunks)tsconfig.build.json
(2 hunks)tsconfig.json
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (15)
- docs/.vitepress/plugins/markdown-transform.ts
- pnpm-workspace.yaml
- packages/ant-design-x-vue/src/index.ts
- packages/ant-design-x-vue/vite.config.mts
- docs/.vitepress/plugins/demo.ts
- internal/build-utils/build.config.ts
- play/vite.config.ts
- docs/package.json
- docs/tsconfig.json
- play/package.json
- packages/components/package.json
- internal/build-utils/package.json
- tsconfig.json
- docs/.vitepress/config.mts
- tsconfig.build.json
🔇 Additional comments (16)
.gitignore (4)
1-3
: Clear Categorization for Dependency Files
The introduction of the # Dependencies section withnode_modules
is well placed and improves clarity regarding which folders or files should be excluded from version control.
5-7
: Keep System File Ignorance Simple
The # System Files section correctly retains.DS_Store
. No further changes needed.
8-10
: Proper Handling of Package Manager Logs
Including.pnpm-debug.log*
under the # Package Manager section is an appropriate measure to ignore log files specific to pnpm.
11-14
: Effective Ignorance for Bundle Artifacts
The new # Bundle section, which lists bothdist
andcoverage
, cleanly separates build output and test coverage from source files.packages/ant-design-x-vue/package.json (7)
24-31
: Well-Configured Exports Field
The exports configuration neatly maps type definitions and module paths for both ES modules and CommonJS environments, including a separate export for the CSS asset. This aligns well with Node and bundler expectations.
32-38
: Clear Distribution and File Inclusion
The specification of entry points (main
,module
,types
) along with the"files": [ "dist" ]
array ensures that only the necessary build outputs are published.
39-46
: Robust Script Definitions for Development and Release
The scripts cover building, watching, changelog generation, testing, and releasing. Usingvite build
together with TypeScript checking throughvue-tsc
is a solid approach.
47-51
: Commit Linting Integration
The commitlint configuration with the conventional config helps maintain commit quality.
52-68
: Lint-Staged Setup Ensures Code Quality
The lint-staged configuration is appropriately segmented by file extensions and applies the necessary formatters and linters.
69-80
: Thoughtful Dependency Management
Dependencies are well organized, and the use of"workspace:*"
for@ant-design-x-vue/components
leverages the monorepo structure effectively. The peer dependencies specifying compatible versions forant-design-vue
andvue
are clear.
81-87
: Consistent Package Tools and Publication Configuration
The definition of the package manager (pnpm@9.6.0
) and the publish configuration (with public access) is consistent with modern monorepo practices.package.json (5)
1-9
: Monorepo Structure and Workspace Definition
The rootpackage.json
now reflects the monorepo architecture. The"name"
change to"ant-design-x-vue-monorepo"
, setting"private": true
, and the clearly defined"workspaces"
array ensure that multiple packages (and internal tools) are managed cohesively.
10-22
: Efficient and Consistent Workspace Scripts
The scripts have been reworked to leveragepnpm
commands across various workspace directories (for build, docs, play, etc.). This approach aligns with best practices in monorepo management.
23-27
: Maintaining Commit Standards
The inclusion of the commitlint configuration in the root helps enforce commit message standards across the entire repository.
28-36
: Streamlined Shared Dependencies
The root-level dependencies list is succinct, focusing on libraries likely shared across multiple sub-packages. This is a good practice to avoid duplication.
37-40
: Robust Development Dependencies and Peer Requirements
The peer dependencies and overall devDependencies configuration mirror those in individual packages, ensuring compatibility and consistency throughout the workspace.
monorepo架构是一项很棒的工作!但目前看来还不是合并的时候,因为我在调试中发现,monorepo能够暴露出一些问题,需要先着手解决,在此期间我会保持该pr与主分支同步。docs中可以使用 发现的问题:
我认为这些问题不是mono导致的,而是mono将其暴露出来了。 |
是的,看了下我自己部署的netlify,深色主题下主题色存在问题,强刷偶尔也能正常观看,还存在较大问题 |
如果你愿意帮忙排查修复的话,可以为修复单独创建pr(建议一次一个修复,可分批pr),此pr只要专注于monorepo架构调整即可(看起来已完成了)。 |
Summary by CodeRabbit
New Features
@ant-design-x-vue/docs
and@ant-design-x-vue/components
.Refactor
Chores