mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-24 13:44:54 +00:00
2.7 KiB
2.7 KiB
Dependency Management Guide
Overview
This project uses npm workspaces with custom overrides configuration to manage dependencies without requiring --legacy-peer-deps.
Key Changes
1. Workspace Protocol Replacement
Before:
"@github/spark": "workspace:*"
After:
"@github/spark": "file:./packages/spark-tools"
Why: The workspace:* protocol is not supported by standard npm in CI/CD environments. Using file: protocol ensures compatibility across all npm versions and build contexts.
2. Dependency Overrides
The overrides field forces consistent versions across all dependencies, eliminating peer dependency conflicts:
"overrides": {
"react": "^19.0.0",
"react-dom": "^19.0.0",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"vite": "^7.3.1",
"@github/spark": {
"react": "^19.0.0",
"vite": "^7.3.1"
},
"@local/spark-wrapper": {
"react": "^19.0.0"
}
}
Benefits
- No More
--legacy-peer-deps: Overrides resolve peer dependency conflicts automatically - CI/CD Compatible: Works with standard
npm ciin GitHub Actions and other CI systems - Version Consistency: Ensures all packages use the same React and Vite versions
- Monorepo Support: Maintains workspace functionality while improving compatibility
Installation
Local Development
npm install
CI/CD
npm ci
Both commands now work without additional flags.
Troubleshooting
Lock File Out of Sync
If you see "lock file out of sync" errors in CI:
# Locally run:
npm install
# Commit the updated package-lock.json:
git add package-lock.json
git commit -m "Update lock file"
git push
Peer Dependency Warnings
If you still see peer dependency warnings:
- Check that the override versions match your main dependency versions
- Update the override to match the required version
- Run
npm installto regenerate the lock file
Workspace Package Not Found
If the workspace package isn't found:
- Verify the path in the
file:reference is correct - Ensure the workspace package has a valid
package.json - Run
npm installto rebuild workspace links
Architecture
spark-template/
├── package.json (root with overrides)
├── packages/
│ ├── spark/ (@local/spark-wrapper)
│ └── spark-tools/ (@github/spark)
└── node_modules/
└── @github/spark → ../packages/spark-tools