Skip to content

Commit e6d7b25

Browse files
committed
chore: update scripts
1 parent f16e635 commit e6d7b25

File tree

3 files changed

+33
-6
lines changed

3 files changed

+33
-6
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
"ci": "npm run build && npm run cov",
3333
"purge": "npm run clean && rm -rf node_modules && rm -rf pnpm-lock.yaml",
3434
"reset": "npm run purge && npm i && npm run ci",
35-
"canary": "npm run build && lerna publish major --canary --preid alpha --dist-tag alpha",
36-
"beta": "sh scripts/publish.sh --npm-tag beta --force-publish=*",
37-
"next": "sh scripts/publish.sh --npm-tag next",
38-
"release": "rm -f ./packages/.DS* && sh scripts/publish.sh",
35+
"canary": "sh scripts/publish.sh canary",
36+
"beta": "sh scripts/publish.sh beta",
37+
"next": "sh scripts/publish.sh next",
38+
"release": "sh scripts/publish.sh",
3939
"bootstrap": "rm -f ./packages/.DS* && lerna bootstrap --concurrency 4",
4040
"clean": "lerna clean --yes && rm -rf ./packages/**/package-lock.json && rm -f package-lock.json && rm -rf ./packages/**/pnpm-lock.json ",
4141
"build": "sh scripts/build.sh",
4242
"authors": "git log --format='%aN <%aE>' | sort -u > AUTHORS",
43-
"version": "node ./scripts/generate_rollback.js && node ./scripts/generate_version.js && node ./scripts/generate_changelog.js && git add .",
43+
"version": "if [ \"$SKIP_VERSION_SCRIPTS\" != \"true\" ]; then node ./scripts/generate_rollback.js && node ./scripts/generate_version.js && node ./scripts/generate_changelog.js && git add .; fi",
4444
"lint": "lerna exec mwts check",
4545
"lint:cycle": "lerna exec --ignore @midwayjs/version --ignore @midwayjs/faas-typings --ignore @midwayjs/*-layer --ignore @midwayjs/core -- madge --circular --extensions ts src",
4646
"lint:fix": "lerna exec mwts fix",

scripts/generate_version.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ for (const info of data) {
1212
result[info.name] = info.version;
1313
}
1414

15+
if (!result['@midwayjs/decorator']) {
16+
result['@midwayjs/decorator'] = '3.18.0';
17+
}
18+
1519
const key =
1620
result['@midwayjs/decorator'].replace(/\./g, '_') +
1721
'-' +

scripts/publish.sh

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
#!/usr/bin/env bash
2+
set -e
23

4+
rm -f ./packages/.DS*
35
source `dirname $0`/build.sh
46
git add .
5-
lerna publish $*
7+
8+
RELEASE_TYPE="$1"
9+
10+
case "$RELEASE_TYPE" in
11+
"beta")
12+
SKIP_VERSION_SCRIPTS=true lerna version --yes --force-publish=*
13+
lerna publish from-git --yes --dist-tag beta
14+
;;
15+
"next")
16+
SKIP_VERSION_SCRIPTS=true lerna version --yes
17+
lerna publish from-git --yes --dist-tag next
18+
;;
19+
"canary")
20+
SKIP_VERSION_SCRIPTS=true lerna version major --yes
21+
lerna publish from-git --yes --canary --preid alpha --dist-tag alpha
22+
;;
23+
*)
24+
# release (default) - 只有这个会执行完整的 version 脚本
25+
lerna version --yes
26+
lerna publish from-git --yes
27+
;;
28+
esac

0 commit comments

Comments
 (0)