首页 > 解决方案 > 为什么 lerna 在引导时运行“预发布”?

问题描述

当我运行时lerna bootstrap,根据文档:

Usage

$ lerna bootstrap
Bootstrap the packages in the current Lerna repo. Installs all of their dependencies and links any cross-dependencies.

When run, this command will:

npm install all external dependencies of each package.
Symlink together all Lerna packages that are dependencies of each other.
npm run prepublish in all bootstrapped packages (unless --ignore-prepublish is passed).
npm run prepare in all bootstrapped packages.

既然引导与发布无关,为什么它会运行prepublish?为什么它是默认值?

标签: lerna

解决方案


因为npm install也会触发prepublish脚本。如果您希望不触发预发布脚本,请改用该prepublishOnly脚本。您可以在NPM 脚本文档中阅读所有相关信息


推荐阅读