Lovingly stolen from Lerna.
Slightly-to-moderately significantly modified for PicnicHealth.
Here's Lerna's README, with sed 's/lerna/basket/g'
and other important changes.
A tool for managing JavaScript projects with multiple packages.
While developing Babel I followed a monorepo approach where the entire project was split into individual packages but everything lived in the same repo. This was great. It allowed super easy modularisation which meant the core was easier to approach and meant others could use the useful parts of Babel in their own projects.
This tool was abstracted out of that and deals with bootstrapping packages by linking them together as well as publishing them to npm. You can see the Babel repo for an example of a large Basket project.
$ npm install -g basket
$ basket bootstrap
This will create a dummy VERSION
file as well as a packages
folder.
$ basket bootstrap
- Link together all packages that depend on each other.
npm install
all other dependencies of each package.
$ basket upgrade
- Set a dependency to a sepcific version in all packages
$ basket updated
- Check which
packages
have changed since the last release, and log it. Changed means changed in commits
$ basket release
- Publish each module in
packages
that has been updated since the last version to npm with the tagprerelease
. - Once all packages have been published, remove the
prerelease
tags and add the tagslatest
andstable
.
$ basket release
- Release each module in
packages
that has been updated since the last version
Basket projects operate on a single version line. The version is kept in the file VERSION
at the root of your project. When you run basket release
, 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 release a new version of a package when you need to.