прm workspaces
1. Create a project
npm init --workspace a
or
npm init -w a
After the project is created, node_modules will be created in the top directory of the project and all package dependencies will be stored:
node_modules
- @samtestgroup
- imooc-test-a -> •./../a
- imooc-test-cli -> ..../cli
2. Install dependencies or update dependencies
Install dependencies for a specific workspace
npm install chalk -w a
or
npm install @samtestgroup/imooc-test-a -w cli
When the content of package is modified (such as: name in package.json)
npm install --workspaces
or
прт install -ws
3. Publish project
npm publish -ws
the clays
1. Initialize project
npx lerna init
2. Add subprojects
прx lerna create demo
More features:
npx lerna create cli --access public --bin --es-module
3. Add dependencies
npx lerna add chalk packages/demo
or
npx lerna add @samtestgroup/lerna-test-demo packages/cli
4. Update dependencies
nx lerna bootstrap
5. Automated testing
npx lerha run test
6. Project release
npx lerna publish