Skip to content

Instantly share code, notes, and snippets.

@Frikki

Frikki/learn.json

Last active Jul 17, 2018
Embed
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": [
"packages/*"
],
"devDependencies": {
"lerna": "^2.11.0",
"rimraf": "^2.6.2"
}
}
#!/bin/bash
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
#!/bin/bash
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!"
else
echo "📦 Publishing: $package@$version (published: $published)"
yarn publish --non-interactive --new-version $version
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment