Last active
July 17, 2018 12:58
-
-
Save Frikki/ab893c3e5d9747fed9be827fec8ce56d to your computer and use it in GitHub Desktop.
Monorepo setup with yarn + lerna
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"lerna": "2.11.0", | |
"version": "independent", | |
"npmClient": "yarn", | |
"useWorkspaces": true, | |
"command": { | |
"publish": { | |
"allowBranch": "master" | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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