Skip to content

Instantly share code, notes, and snippets.

Last active Jul 17, 2018
What would you like to do?
Monorepo setup with yarn + lerna
"lerna": "2.11.0",
"version": "independent",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
"publish": {
"allowBranch": "master"
"private": true,
"scripts": {
"bootstrap": "lerna bootstrap",
"test": "lerna run test",
"prepare": "lerna run prepare",
"clean": "rimraf packages/**/lib",
"distclean": "lerna clean --yes && yarn clean",
"build:libs": "yarn clean && yarn prepare",
"bump": "lerna publish --exact --skip-npm",
"release": "yarn bump && git push --follow-tags && scripts/release"
"workspaces": [
"devDependencies": {
"lerna": "^2.11.0",
"rimraf": "^2.6.2"
set -e
echo "📦 Publishing latest release..."
# Note: try-publish should exit cleanly if it detects a duplicate.
# published version
$(npm bin)/lerna exec --concurrency 1 -- $(pwd)/scripts/try-publish
set -e
# pwd
package=$(jq -r .name package.json)
version=$(jq -r .version package.json)
published=$(yarn info $package version) || published="N/A"
if [[ "$version" = "$published" ]]; then
echo "⚠️ $package@$version is already published!"
echo "📦 Publishing: $package@$version (published: $published)"
yarn publish --non-interactive --new-version $version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment