不能使用lerna传递命令行参数
can`t pass command line args using lerna
我从根尝试 运行 脚本,但出现错误:
ERR! lerna Unknown argument: d
来自 root 的命令 package.json:
"start:scripts:api-football:start:collectDayMatches:dev": "lerna run start:collectDayMatches:dev --stream"
尝试运行yarn start:scripts:api-football:start:collectDayMatches:dev -- -d 2002-02-02
您似乎在尝试将命令参数传递给每个包的 npm 脚本。
例如:
packages/pkg-a/package.json
:
"scripts": {
"start:collectDayMatches:dev": "ls"
}
root package.json
:
"scripts": {
"start:scripts:api-football:start:collectDayMatches:dev": "lerna run start:collectDayMatches:dev --stream"
}
让我们将 -a
选项传递给 ls
命令。
您应该 运行 带有三个双破折号 (--
) 的 npm 脚本,如下所示:
[main] ⚡ yarn start:scripts:api-football:start:collectDayMatches:dev -- -- -- -a
yarn run v1.22.10
warning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded. In a future version, any explicit "--" will be forwarded as-is to the scripts.
$ lerna run start:collectDayMatches:dev --stream -- -- -a
lerna notice cli v3.22.1
lerna info Executing command in 1 package: "npm run start:collectDayMatches:dev -- -a"
pkg-a: > pkg-a@1.0.0 start:collectDayMatches:dev /Users/dulin/workspace/github.com/mrdulin/lerna-codelab/packages/pkg-a
pkg-a: > ls "-a"
pkg-a: .
pkg-a: ..
pkg-a: app.js
pkg-a: app.test.js
pkg-a: docs
pkg-a: jest.config.js
pkg-a: node_modules
pkg-a: package-lock.json
pkg-a: package.json
lerna success run Ran npm script 'start:collectDayMatches:dev' in 1 package in 0.2s:
lerna success - pkg-a
✨ Done in 0.60s.
如你所见,最后的命令是ls "-a"
。
我从根尝试 运行 脚本,但出现错误:
ERR! lerna Unknown argument: d
来自 root 的命令 package.json:
"start:scripts:api-football:start:collectDayMatches:dev": "lerna run start:collectDayMatches:dev --stream"
尝试运行yarn start:scripts:api-football:start:collectDayMatches:dev -- -d 2002-02-02
您似乎在尝试将命令参数传递给每个包的 npm 脚本。
例如:
packages/pkg-a/package.json
:
"scripts": {
"start:collectDayMatches:dev": "ls"
}
root package.json
:
"scripts": {
"start:scripts:api-football:start:collectDayMatches:dev": "lerna run start:collectDayMatches:dev --stream"
}
让我们将 -a
选项传递给 ls
命令。
您应该 运行 带有三个双破折号 (--
) 的 npm 脚本,如下所示:
[main] ⚡ yarn start:scripts:api-football:start:collectDayMatches:dev -- -- -- -a
yarn run v1.22.10
warning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded. In a future version, any explicit "--" will be forwarded as-is to the scripts.
$ lerna run start:collectDayMatches:dev --stream -- -- -a
lerna notice cli v3.22.1
lerna info Executing command in 1 package: "npm run start:collectDayMatches:dev -- -a"
pkg-a: > pkg-a@1.0.0 start:collectDayMatches:dev /Users/dulin/workspace/github.com/mrdulin/lerna-codelab/packages/pkg-a
pkg-a: > ls "-a"
pkg-a: .
pkg-a: ..
pkg-a: app.js
pkg-a: app.test.js
pkg-a: docs
pkg-a: jest.config.js
pkg-a: node_modules
pkg-a: package-lock.json
pkg-a: package.json
lerna success run Ran npm script 'start:collectDayMatches:dev' in 1 package in 0.2s:
lerna success - pkg-a
✨ Done in 0.60s.
如你所见,最后的命令是ls "-a"
。