Lerna - DaoCasino/Documentation GitHub Wiki
Publish packages in the current project
To publish anything to our account token from .npmrc (our account) is needed.
npm install -g lerna
lerna bootstrapThis will create a dummy file and a packages folder.
lerna bootstrap- Link together all packages that depend on each other.
-
npm installall other dependencies of each package.
lerna updated- Check which
packageshave changed since the last release, and log it.
lerna publish- Publish each module in
packagesthat has been updated since the last version to npm with the tagprerelease. - Once all packages have been published, remove the
prereleasetags and add the tagslatestandstable.
If you need to publish prerelease versions, set an env variable.
NPM_DIST_TAG=next lerna publish. This will add the tag you specify instead oflatestandstable.
Lerna projects operate on a single version line. The version is kept in the file VERSION
at the root of your project. When you run lerna publish, if a module has been updated
since the last time a release was made, it will be updated to the new version you're
releasing. This means that you only publish a new version of a package when you need to.
lerna publish # publish packages that have changed since the last release
lerna publish from-git # publish packages tagged in current commitWhen run, this command does one of the following things:
- Publish packages updated since the last release (calling
lerna version) - Publish packages tagged in the current commit (
from-git). - Publish an unversioned "canary" release of packages (and their dependents) updated in the previous commit.
It will never publish packages which are marked as private.
Note: to publish scoped packages, you need to add the following to each package.json:
"publishConfig": {
"access": "public"
}In addition to the semver keywords supported by lerna version
lerna publish also supports the from-git keyword.
This will identify packages tagged by lerna version and publish them to npm.
lerna publish supports all of the options provided by lerna version in addition to the following:
--canary--npm-client <client>--npm-tag <dist-tag>--no-verify-access--registry <url>--temp-tag--yes
lerna publish --canary
# 1.0.0 => 1.0.1-alpha.0+${SHA} of packages changed since the previous commit
lerna publish --canary --preid beta
# 1.0.0 => 1.0.1-beta.0+${SHA}
# The following are equivalent:
lerna publish --canary minor
lerna publish --canary preminor
# 1.0.0 => 1.1.0-alpha.0+${SHA}When run with this flag, lerna publish publishes packages in a more granular way (per commit). Before publishing to npm, it creates the new version tag by taking the current version, bumping it to the next minor version, adding the provided meta and appending the current git sha (ex: 1.0.0 becomes 1.1.0-alpha.${SHA}).
Must be an executable that knows how to publish packages to an npm registry.
The default --npm-client is npm.
lerna publish --npm-client yarnMay also be configured in lerna.json:
{
"command": {
"publish": {
"npmClient": "yarn"
}
}
}lerna publish --npm-tag nextWhen run with this flag, lerna publish will publish to npm with the given npm dist-tag (defaults to latest).
This option can be used to publish a prerelease or beta version under a non-latest dist-tag, helping consumers avoid automatically upgrading to prerelease-quality code.
Note: the
latesttag is the one that is used when a user runsnpm install my-package. To install a different tag, a user can runnpm install my-package@prerelease.
By default, lerna will verify the logged-in npm user's access to the packages about to be published. Passing this flag will disable that check.
If you are using a third-party registry that does not support npm access ls-packages, you will need to pass this flag (or set command.publish.verifyAccess to false in lerna.json).
When run with this flag, forwarded npm commands will use the specified registry for your package(s).
This is useful if you do not want to explicitly set up your registry configuration in all of your package.json files individually when e.g. using private registries.
When passed, this flag will alter the default publish process by first publishing
all changed packages to a temporary dist-tag (lerna-temp) and then moving the
new version(s) to the default dist-tag (latest).
This is not generally necessary, as Lerna will publish packages in topological order (all dependencies before dependents) by default.
lerna publish --canary --yes
# skips `Are you sure you want to publish the above changes?`When run with this flag, lerna publish will skip all confirmation prompts.
For this case you can call lerna version directly. It skips publishing to npm registry.
When publishing you can skip pushing packages to git (use monorepotools instead).