Skip to content

Commit 5f70232

Browse files
committed
monorepo: Add manual version bump and publish config/scripts
1 parent 34869fb commit 5f70232

5 files changed

Lines changed: 37 additions & 1 deletion

File tree

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@mm-snap:registry="https://npm.pkg.github.com"

lerna.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
{
22
"version": "0.0.1",
3-
"npmClient": "yarn",
3+
"command": {
4+
"publish": {
5+
"registry": "https://npm.pkg.github.com"
6+
}
7+
},
48
"packages": [
59
"packages/*"
610
],
11+
"npmClient": "yarn",
712
"useWorkspaces": true
813
}

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
],
1111
"scripts": {
1212
"link-packages": "./scripts/link-packages.sh",
13+
"version-bump": "./scripts/version-bump.sh",
14+
"push-version-bump": "./scripts/push-version-bump.sh",
15+
"release": "yarn version-bump && yarn push-version-bump",
16+
"publish": "lerna publish from-package",
1317
"prepare": "lerna run prepare"
1418
},
1519
"devDependencies": {}

scripts/push-version-bump.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -u
5+
set -o pipefail
6+
7+
MM_SNAP_VERSION=$(node -p 'require("./lerna.json").version')
8+
9+
git checkout -b "${MM_SNAP_VERSION}"
10+
git commit -m "${MM_SNAP_VERSION}" || true
11+
git push -u origin "${MM_SNAP_VERSION}"
12+
13+
unset MM_SNAP_VERSION

scripts/version-bump.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -u
5+
set -o pipefail
6+
7+
if [ -z "${1:-}" ]
8+
then
9+
echo "Error: Missing required positional argument: patch|minor|major"
10+
exit 1
11+
fi
12+
13+
lerna version "$1" --no-git-tag-version

0 commit comments

Comments
 (0)