Commands: cli.js add-caching Interactive prompt to generate task runner configuration cli.js changed List local packages that have changed since the last tagged release [aliases: updated] cli.js clean Remove the node_modules directory from all packages cli.js create <name> [loc] Create a new lerna-managed package cli.js diff [pkgName] Diff all packages or a single package since the last release cli.js exec [cmd] [args..] Execute an arbitrary command in each package cli.js import <dir> Import a package into the monorepo with commit history cli.js info Prints debugging information about the local environment cli.js init Create a new Lerna repo or upgrade an existing repo to the current version of Lerna cli.js list List local packages [aliases: ls, la, ll] cli.js publish [bump] Publish packages in the current project cli.js repair Runs automated migrations to repair the state of a lerna repo cli.js run <script> Run an npm script in each package that contains that script cli.js watch Runs a command whenever packages or their dependents change. cli.js version [bump] Bump version of packages changed since the last release cli.js add <pkg> [globs..] The "add" command was removed by default in v7, and is no longer maintained. cli.js bootstrap The "bootstrap" command was removed by default in v7, and is no longer maintained. cli.js link The "link" command was removed by default in v7, and is no longer maintained.
Global Options: --loglevel What level of logs to report. [string] [default: info] --concurrency How many processes to use when lerna parallelizes tasks. [number] [default: 6] --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]
When a command fails, all logs are written to lerna-debug.log in the current working directory.
For more information, check out the docs at https://lerna.js.org/docs/introduction
使用 lerna 初始化项目
1
npx lerna init --dryRun
Oops! 失败了
1 2 3 4 5
# isaac @ ISAACGAN-PC0 in ~/workspace/practices on git:main x [14:04:06] $ npx lerna init --dryRun lerna notice cli v7.2.0 lerna ERR! Cannot initialize lerna because your package manager has not been configured to use `workspaces`, and you have not explicitly specified any packages to operate on lerna ERR! See https://lerna.js.org/docs/getting-started#adding-lerna-to-an-existing-repo for how to resolve this
# isaac @ ISAACGAN-PC0 in ~/workspace/practices on git:main x [14:08:45] $ npx lerna init --packages="packages/*" lerna notice cli v7.2.0 lerna info Applying the following file system updates: CREATE lerna.json lerna info Git is already initialized lerna info Using pnpm to install packages lerna success Initialized Lerna files lerna info New to Lerna? Check out the docs: https://lerna.js.org/docs/getting-started