Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

Commit f21a14b

Browse files
authored
Merge pull request #10 from apilytics/remove-git-head
Make `lerna release` not leave `gitHead`s to package.json files
2 parents 3859bc6 + e66e604 commit f21a14b

6 files changed

Lines changed: 19 additions & 8 deletions

File tree

.github/workflows/cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
id: publish
4040
run: |
4141
echo '//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}' > .npmrc
42-
yarn publish:all ${{ github.event.inputs.release-type }}
42+
yarn release ${{ github.event.inputs.release-type }}
4343
echo "::set-output name=version::$(node --print 'require("./lerna.json").version')"
4444
4545
- name: "Update the changelog"

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"scripts": {
77
"build": "lerna run build",
88
"clean": "lerna run clean",
9-
"publish:all": "lerna publish --force-publish='*' --exact --no-git-tag-version --no-git-reset --no-verify-access --yes",
9+
"clean:git-head": "lerna exec node \\$LERNA_ROOT_PATH/scripts/clean-git-head.js",
10+
"release": "lerna publish --force-publish='*' --exact --no-git-tag-version --no-git-reset --no-verify-access --yes && yarn clean:git-head",
1011
"format": "prettier --write '**/*.{ts,js,json}' && eslint --fix --max-warnings=0 --ext=.ts,.js .",
1112
"lint": "prettier --check '**/*.{ts,js,json}' && eslint --max-warnings=0 --ext=.ts,.js .",
1213
"type-check": "yarn tsc --noEmit",

packages/core/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,5 @@
3535
},
3636
"engines": {
3737
"node": ">=12.0.0"
38-
},
39-
"gitHead": "d83199fe1aaa931a7dcf4c12f6f67ef0083cbecc"
38+
}
4039
}

packages/express/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,5 @@
3939
},
4040
"engines": {
4141
"node": ">=12.0.0"
42-
},
43-
"gitHead": "d83199fe1aaa931a7dcf4c12f6f67ef0083cbecc"
42+
}
4443
}

packages/next/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,5 @@
3939
},
4040
"engines": {
4141
"node": ">=12.0.0"
42-
},
43-
"gitHead": "d83199fe1aaa931a7dcf4c12f6f67ef0083cbecc"
42+
}
4443
}

scripts/clean-git-head.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
const packageJsonPath = path.resolve('./package.json');
5+
6+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath));
7+
8+
delete packageJson.gitHead;
9+
10+
fs.writeFileSync(
11+
packageJsonPath,
12+
JSON.stringify(packageJson, undefined, 2) + '\n',
13+
);

0 commit comments

Comments
 (0)