Lerna template. github workflow
Clone the repository:
git clone https://github.com/remarkablemark/lerna-template.git
cd lerna-template
Install the dependencies:
npm install
In the root directory, you can run:
Builds all packages:
npm run build
Builds a single package:
npm run build -- --scope=<package-name>
For example:
npm run build -- --scope=example-a
Deletes build artifacts for all packages:
npm run clean
Cleans a single package:
npm run clean -- --scope=<package-name>
For example:
npm run clean -- --scope=example-a
Creates a package:
npm run create-package
Creates a package using the CLI:
npm run create-package <package-name> -- --template=<template>
Creates package foo
using the TypeScript template (default):
npm run create-package foo -- --template=typescript
Creates package bar
using the React template:
npm run create-package bar -- --template=react
Lints all packages:
npm run lint
Lints a single package:
npm run lint -- --scope=<package-name>
For example:
npm run lint -- --scope=example-a
Fixes lint errors for all packages:
npm run lint:fix
Fixes lint errors for a single package:
npm run lint:fix -- --scope=<package-name>
For example:
npm run lint:fix -- --scope=example-a
Runs Storybook server:
npm run storybook
Runs tests for all packages:
npm test
Runs tests for a single package:
npm test -- --scope=<package-name>
For example:
npm run test -- --scope=example-a
Release is automated with Lerna.
If npm publish failed:
- Delete the Git tags on remote
- Rerun the publish workflow
Because Lerna commits and pushes the release to the remote repository, branch protection rules have been disabled.
To prevent race conditions with Lerna release, don't merge PRs until after the publish workflow is done.
To release a canary version for testing, run the publish workflow with a branch other than master
.
To see the to-be-updated versions, run the publish workflow and enable Dry run.