用法
$ lerna import --helplerna import <dir>Import a package into the monorepo with commit historyPositionals:dir The path to an external git repository that contains an npm package [required]Command Options:--flatten Import each merge commit as a single change the merge introduced [boolean]--dest Import destination directory for the external git repository [string]--preserve-commit Preserve original committer in addition to original author [boolean]-y, --yes Skip all confirmation prompts [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: 4]--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
参数
| 参数 | 描述 |
|---|---|
dir |
外部 Git 仓库的路径,该仓库必须包含一个 npm 包以及 Git 提交历史 |
注意事项:
- 不能重复导入,除非变更目标 package 的名称。
选项
| 选项 | 描述 | | —- | —- | |--dest| 指定导入的目标目录,即导入到哪个 Package Location,默认是在packages/*下面 |
注意
lerna import导入时不能改变 Package 的名称,默认以预导入项目的目录名称作为 Package 名称导入时 Lerna 项目必须至少有一个 commit,预导入项目也必须有提交历史
示例
导入到特定的 Package Location
$ lerna import ~/Product --dest=pkgs
移除 Package
如果要移除 Package,直接删除相应的目录即可。
$ rm -r pkgs/Product
