我已经使用
lerna import <PATH_OF_PROJECT>
命令
每个项目都有一个
package.json
文件,他们有一些共同点
devDependencies
:
packages/redux-saga-examples/package.json
:
"devDependencies": {
"@testing-library/react": "^12.0.0",
"@types/jest": "^26.0.24",
"@types/redux-actions": "^2.6.2",
"jest": "^27.0.6",
"ts-jest": "^27.0.4",
"ts-node": "^9.1.1",
"typescript": "^4.3.5"
}
packages/redux-toolkit-example/package.json
:
"devDependencies": {
"@redux-saga/testing-utils": "^1.1.3",
"@types/jest": "^26.0.23",
"@types/redux-mock-store": "^1.0.2",
"jest": "^27.0.4",
"prettier": "^2.3.1",
"redux-mock-store": "^1.5.4",
"redux-saga-test-plan": "^4.0.1",
"ts-jest": "^27.0.3",
"ts-node": "^10.0.0",
"typescript": "^4.3.4"
}
redux-examples/package.json
:
{
"name": "root",
"private": true,
"scripts": {
"bootstrap": "lerna bootstrap --hoist",
"test": "jest"
},
"devDependencies": {
"lerna": "^4.0.0"
}
}
现在我想提取常见的
依赖性
例如
typescript
,
jest
,
@types/jest
到
依赖性
关于monorepo根
包裹json
.我试过了
lerna bootstrap --hoist
这个
依赖性
每个包裹里都有。
有什么命令吗
lerna
怎么做?期待
包裹json
根目录:
{
"name": "root",
"private": true,
"scripts": {
"bootstrap": "lerna bootstrap --hoist",
"test": "jest"
},
"devDependencies": {
"@types/jest": "^26.0.24",
"lerna": "^4.0.0",
"jest": "^27.0.6",
"ts-jest": "^27.0.4",
"ts-node": "^9.1.1",
"typescript": "^4.3.5"
}
}
和
包裹json
每个包的文件:
软件包/redux saga示例/软件包。json
:
"devDependencies": {
"@testing-library/react": "^12.0.0",
"@types/redux-actions": "^2.6.2"
}
packages/redux工具包示例/package。json
:
"devDependencies": {
"@redux-saga/testing-utils": "^1.1.3",
"@types/redux-mock-store": "^1.0.2",
"prettier": "^2.3.1",
"redux-mock-store": "^1.5.4",
"redux-saga-test-plan": "^4.0.1"
}