添加一个依赖到 Lerna Package 中。
用法
$ lerna add <pkg> [globs..]
Add a single dependency to matched packages
Positionals:
pkg Package name to add as a dependency [string] [required]
globs Optional package directory globs to match [array] [default: []]
Command Options:
-D, --dev Save to devDependencies [boolean]
-E, --exact Save version exactly [boolean]
-P, --peer Save to peerDependencies [boolean]
--registry Use the specified registry for all npm client operations. [string]
--no-bootstrap Do not automatically chain `lerna bootstrap` after changes are made. [boolean]
Filter Options:
--scope Include only packages with names matching the given glob. [string]
--ignore Exclude packages with names matching the given glob. [string]
--no-private Exclude packages with { "private": true } in their package.json. [boolean]
--since Only include packages that have been changed since the specified [ref].
If no ref is passed, it defaults to the most-recent tag. [string]
--exclude-dependents Exclude all transitive dependents when running a command
with --since, overriding the default "changed" algorithm. [boolean]
--include-dependents Include all transitive dependents when running a command
regardless of --scope, --ignore, or --since. [boolean]
--include-dependencies Include all transitive dependencies when running a command
regardless of --scope, --ignore, or --since. [boolean]
--include-merged-tags Include tags from merged branches when running a command with --since. [boolean]
Global Options:
--loglevel What level of logs to report. [string] [default: info]
--concurrency How many processes to use when lerna parallelizes tasks. [number] [default: 12]
--reject-cycles Fail if a cycle is detected among dependencies. [boolean]
--no-progress Disable progress bars. (Always off in CI) [boolean]
--no-sort Do not sort packages topologically (dependencies before dependents). [boolean]
--max-buffer Set max-buffer (in bytes) for subcommand execution [number]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
Examples:
lerna add module-1 packages/prefix-* Adds the module-1 package to the packages in the 'prefix-' prefixed folders
lerna add module-1 --scope=module-2 Install module-1 to module-2
lerna add module-1 --scope=module-2 --dev Install module-1 to module-2 in devDependencies
lerna add module-1 --scope=module-2 --peer Install module-1 to module-2 in peerDependencies
lerna add module-1 Install module-1 in all modules except module-1
lerna add module-1 --no-bootstrap Skip automatic `lerna bootstrap`
lerna add babel-core Install babel-core in all modules