Skip to content

Commit 4bb22fb

Browse files
committed
feat: Add release utilities
1 parent c2f486b commit 4bb22fb

File tree

3 files changed

+203
-3
lines changed

3 files changed

+203
-3
lines changed

package.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@
33
"license": "MIT",
44
"scripts": {
55
"postinstall": "lerna bootstrap",
6-
"test": "lerna run test"
6+
"test": "lerna run test",
7+
"release:note": "node scripts/gen-release-notes.js run",
8+
"release:build": "lerna run build",
9+
"prerelease": "yarn release:note && yarn release:build",
10+
"release": "lerna publish"
711
},
812
"devDependencies": {
13+
"@vue/conventional-changelog": "^0.1.1",
14+
"conventional-changelog": "^2.0.3",
15+
"execa": "^1.0.0",
916
"lerna": "^3.1.4"
1017
}
1118
}

scripts/gen-release-notes.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const execa = require('execa')
2+
const cc = require('conventional-changelog')
3+
const config = require('@vue/conventional-changelog')
4+
5+
const gen = (module.exports = version => {
6+
const fileStream = require('fs').createWriteStream(`CHANGELOG.md`)
7+
8+
cc({
9+
config,
10+
releaseCount: 0,
11+
pkg: {
12+
transform(pkg) {
13+
pkg.version = `v${version}`
14+
return pkg
15+
},
16+
},
17+
})
18+
.pipe(fileStream)
19+
.on('close', async () => {
20+
delete process.env.PREFIX
21+
await execa('git', ['add', '-A'], { stdio: 'inherit' })
22+
await execa('git', ['commit', '-m', `chore: ${version} changelog [ci skip]`], { stdio: 'inherit' })
23+
})
24+
})
25+
26+
if (process.argv[2] === 'run') {
27+
const version = require('../lerna.json').version
28+
gen(version)
29+
}

yarn.lock

+166-2
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,14 @@
533533
version "1.1.1"
534534
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.1.tgz#53f349bb986ab273d601175aa1b25a655ab90ee3"
535535

536+
"@vue/conventional-changelog@^0.1.1":
537+
version "0.1.1"
538+
resolved "https://registry.yarnpkg.com/@vue/conventional-changelog/-/conventional-changelog-0.1.1.tgz#48d2227ca65c354cba4be60754ea531afd0c3718"
539+
dependencies:
540+
compare-func "^1.3.2"
541+
execa "^0.10.0"
542+
q "^1.5.1"
543+
536544
JSONStream@^1.0.4, JSONStream@^1.3.4:
537545
version "1.3.4"
538546
resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.4.tgz#615bb2adb0cd34c8f4c447b5f6512fa1d8f16a2e"
@@ -945,7 +953,7 @@ [email protected], combined-stream@~1.0.6:
945953
dependencies:
946954
delayed-stream "~1.0.0"
947955

948-
compare-func@^1.3.1:
956+
compare-func@^1.3.1, compare-func@^1.3.2:
949957
version "1.3.2"
950958
resolved "https://registry.yarnpkg.com/compare-func/-/compare-func-1.3.2.tgz#99dd0ba457e1f9bc722b12c08ec33eeab31fa648"
951959
dependencies:
@@ -987,6 +995,18 @@ conventional-changelog-angular@^1.6.6:
987995
compare-func "^1.3.1"
988996
q "^1.5.1"
989997

998+
conventional-changelog-atom@^2.0.0:
999+
version "2.0.0"
1000+
resolved "https://registry.yarnpkg.com/conventional-changelog-atom/-/conventional-changelog-atom-2.0.0.tgz#cd6453469cfb8fc345af3391b92990251c95558b"
1001+
dependencies:
1002+
q "^1.5.1"
1003+
1004+
conventional-changelog-codemirror@^2.0.0:
1005+
version "2.0.0"
1006+
resolved "https://registry.yarnpkg.com/conventional-changelog-codemirror/-/conventional-changelog-codemirror-2.0.0.tgz#bfb61ccabacdd3bf8425a5cbe92276c86c5a0c1e"
1007+
dependencies:
1008+
q "^1.5.1"
1009+
9901010
conventional-changelog-core@^2.0.5:
9911011
version "2.0.11"
9921012
resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-2.0.11.tgz#19b5fbd55a9697773ed6661f4e32030ed7e30287"
@@ -1005,10 +1025,69 @@ conventional-changelog-core@^2.0.5:
10051025
read-pkg-up "^1.0.1"
10061026
through2 "^2.0.0"
10071027

1028+
conventional-changelog-core@^3.1.0:
1029+
version "3.1.0"
1030+
resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-3.1.0.tgz#96a81bb3301b4b2a3dc2851cc54c5fb674ac1942"
1031+
dependencies:
1032+
conventional-changelog-writer "^4.0.0"
1033+
conventional-commits-parser "^3.0.0"
1034+
dateformat "^3.0.0"
1035+
get-pkg-repo "^1.0.0"
1036+
git-raw-commits "^2.0.0"
1037+
git-remote-origin-url "^2.0.0"
1038+
git-semver-tags "^2.0.0"
1039+
lodash "^4.2.1"
1040+
normalize-package-data "^2.3.5"
1041+
q "^1.5.1"
1042+
read-pkg "^1.1.0"
1043+
read-pkg-up "^1.0.1"
1044+
through2 "^2.0.0"
1045+
1046+
conventional-changelog-ember@^2.0.1:
1047+
version "2.0.1"
1048+
resolved "https://registry.yarnpkg.com/conventional-changelog-ember/-/conventional-changelog-ember-2.0.1.tgz#5a5595b9ed50a6daca4bd3508a47ffe4a1a7152f"
1049+
dependencies:
1050+
q "^1.5.1"
1051+
1052+
conventional-changelog-eslint@^3.0.0:
1053+
version "3.0.0"
1054+
resolved "https://registry.yarnpkg.com/conventional-changelog-eslint/-/conventional-changelog-eslint-3.0.0.tgz#cc5376cb29a622c1ade197e155bf054640c05cd3"
1055+
dependencies:
1056+
q "^1.5.1"
1057+
1058+
conventional-changelog-express@^2.0.0:
1059+
version "2.0.0"
1060+
resolved "https://registry.yarnpkg.com/conventional-changelog-express/-/conventional-changelog-express-2.0.0.tgz#d3d020118fbfce21a75e025ec097101e355a2361"
1061+
dependencies:
1062+
q "^1.5.1"
1063+
1064+
conventional-changelog-jquery@^0.1.0:
1065+
version "0.1.0"
1066+
resolved "https://registry.yarnpkg.com/conventional-changelog-jquery/-/conventional-changelog-jquery-0.1.0.tgz#0208397162e3846986e71273b6c79c5b5f80f510"
1067+
dependencies:
1068+
q "^1.4.1"
1069+
1070+
conventional-changelog-jscs@^0.1.0:
1071+
version "0.1.0"
1072+
resolved "https://registry.yarnpkg.com/conventional-changelog-jscs/-/conventional-changelog-jscs-0.1.0.tgz#0479eb443cc7d72c58bf0bcf0ef1d444a92f0e5c"
1073+
dependencies:
1074+
q "^1.4.1"
1075+
1076+
conventional-changelog-jshint@^2.0.0:
1077+
version "2.0.0"
1078+
resolved "https://registry.yarnpkg.com/conventional-changelog-jshint/-/conventional-changelog-jshint-2.0.0.tgz#7a038330f485082e489f47f5d07539036949f87d"
1079+
dependencies:
1080+
compare-func "^1.3.1"
1081+
q "^1.5.1"
1082+
10081083
conventional-changelog-preset-loader@^1.1.8:
10091084
version "1.1.8"
10101085
resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-1.1.8.tgz#40bb0f142cd27d16839ec6c74ee8db418099b373"
10111086

1087+
conventional-changelog-preset-loader@^2.0.1:
1088+
version "2.0.1"
1089+
resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.0.1.tgz#d134734e0cc1b91b88b30586c5991f31442029f1"
1090+
10121091
conventional-changelog-writer@^3.0.9:
10131092
version "3.0.9"
10141093
resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-3.0.9.tgz#4aecdfef33ff2a53bb0cf3b8071ce21f0e994634"
@@ -1024,13 +1103,51 @@ conventional-changelog-writer@^3.0.9:
10241103
split "^1.0.0"
10251104
through2 "^2.0.0"
10261105

1106+
conventional-changelog-writer@^4.0.0:
1107+
version "4.0.0"
1108+
resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-4.0.0.tgz#3ed983c8ef6a3aa51fe44e82c9c75e86f1b5aa42"
1109+
dependencies:
1110+
compare-func "^1.3.1"
1111+
conventional-commits-filter "^2.0.0"
1112+
dateformat "^3.0.0"
1113+
handlebars "^4.0.2"
1114+
json-stringify-safe "^5.0.1"
1115+
lodash "^4.2.1"
1116+
meow "^4.0.0"
1117+
semver "^5.5.0"
1118+
split "^1.0.0"
1119+
through2 "^2.0.0"
1120+
1121+
conventional-changelog@^2.0.3:
1122+
version "2.0.3"
1123+
resolved "https://registry.yarnpkg.com/conventional-changelog/-/conventional-changelog-2.0.3.tgz#779cff582c0091d2b24574003eaa82ef5ddf653d"
1124+
dependencies:
1125+
conventional-changelog-angular "^1.6.6"
1126+
conventional-changelog-atom "^2.0.0"
1127+
conventional-changelog-codemirror "^2.0.0"
1128+
conventional-changelog-core "^3.1.0"
1129+
conventional-changelog-ember "^2.0.1"
1130+
conventional-changelog-eslint "^3.0.0"
1131+
conventional-changelog-express "^2.0.0"
1132+
conventional-changelog-jquery "^0.1.0"
1133+
conventional-changelog-jscs "^0.1.0"
1134+
conventional-changelog-jshint "^2.0.0"
1135+
conventional-changelog-preset-loader "^2.0.1"
1136+
10271137
conventional-commits-filter@^1.1.6:
10281138
version "1.1.6"
10291139
resolved "https://registry.yarnpkg.com/conventional-commits-filter/-/conventional-commits-filter-1.1.6.tgz#4389cd8e58fe89750c0b5fb58f1d7f0cc8ad3831"
10301140
dependencies:
10311141
is-subset "^0.1.1"
10321142
modify-values "^1.0.0"
10331143

1144+
conventional-commits-filter@^2.0.0:
1145+
version "2.0.0"
1146+
resolved "https://registry.yarnpkg.com/conventional-commits-filter/-/conventional-commits-filter-2.0.0.tgz#a0ce1d1ff7a1dd7fab36bee8e8256d348d135651"
1147+
dependencies:
1148+
is-subset "^0.1.1"
1149+
modify-values "^1.0.0"
1150+
10341151
conventional-commits-parser@^2.1.7:
10351152
version "2.1.7"
10361153
resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-2.1.7.tgz#eca45ed6140d72ba9722ee4132674d639e644e8e"
@@ -1043,6 +1160,18 @@ conventional-commits-parser@^2.1.7:
10431160
through2 "^2.0.0"
10441161
trim-off-newlines "^1.0.0"
10451162

1163+
conventional-commits-parser@^3.0.0:
1164+
version "3.0.0"
1165+
resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.0.0.tgz#7f604549a50bd8f60443fbe515484b1c2f06a5c4"
1166+
dependencies:
1167+
JSONStream "^1.0.4"
1168+
is-text-path "^1.0.0"
1169+
lodash "^4.2.1"
1170+
meow "^4.0.0"
1171+
split2 "^2.0.0"
1172+
through2 "^2.0.0"
1173+
trim-off-newlines "^1.0.0"
1174+
10461175
conventional-recommended-bump@^2.0.6:
10471176
version "2.0.9"
10481177
resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-2.0.9.tgz#7392421e7d0e3515f3df2040572a23cc73a68a93"
@@ -1315,6 +1444,18 @@ execa@^0.7.0:
13151444
signal-exit "^3.0.0"
13161445
strip-eof "^1.0.0"
13171446

1447+
execa@^1.0.0:
1448+
version "1.0.0"
1449+
resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8"
1450+
dependencies:
1451+
cross-spawn "^6.0.0"
1452+
get-stream "^4.0.0"
1453+
is-stream "^1.1.0"
1454+
npm-run-path "^2.0.0"
1455+
p-finally "^1.0.0"
1456+
signal-exit "^3.0.0"
1457+
strip-eof "^1.0.0"
1458+
13181459
expand-brackets@^2.1.4:
13191460
version "2.1.4"
13201461
resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622"
@@ -1545,6 +1686,12 @@ get-stream@^3.0.0:
15451686
version "3.0.0"
15461687
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"
15471688

1689+
get-stream@^4.0.0:
1690+
version "4.0.0"
1691+
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.0.0.tgz#9e074cb898bd2b9ebabb445a1766d7f43576d977"
1692+
dependencies:
1693+
pump "^3.0.0"
1694+
15481695
get-value@^2.0.3, get-value@^2.0.6:
15491696
version "2.0.6"
15501697
resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28"
@@ -1565,6 +1712,16 @@ git-raw-commits@^1.3.6:
15651712
split2 "^2.0.0"
15661713
through2 "^2.0.0"
15671714

1715+
git-raw-commits@^2.0.0:
1716+
version "2.0.0"
1717+
resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.0.tgz#d92addf74440c14bcc5c83ecce3fb7f8a79118b5"
1718+
dependencies:
1719+
dargs "^4.0.1"
1720+
lodash.template "^4.0.2"
1721+
meow "^4.0.0"
1722+
split2 "^2.0.0"
1723+
through2 "^2.0.0"
1724+
15681725
git-remote-origin-url@^2.0.0:
15691726
version "2.0.0"
15701727
resolved "https://registry.yarnpkg.com/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz#5282659dae2107145a11126112ad3216ec5fa65f"
@@ -1579,6 +1736,13 @@ git-semver-tags@^1.3.6:
15791736
meow "^4.0.0"
15801737
semver "^5.5.0"
15811738

1739+
git-semver-tags@^2.0.0:
1740+
version "2.0.0"
1741+
resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-2.0.0.tgz#c218fd895bdf8e8e02f6bde555b2c3893ac73cd7"
1742+
dependencies:
1743+
meow "^4.0.0"
1744+
semver "^5.5.0"
1745+
15821746
gitconfiglocal@^1.0.0:
15831747
version "1.0.0"
15841748
resolved "https://registry.yarnpkg.com/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz#41d045f3851a5ea88f03f24ca1c6178114464b9b"
@@ -2823,7 +2987,7 @@ punycode@^2.1.0:
28232987
version "2.1.1"
28242988
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
28252989

2826-
q@^1.5.1:
2990+
q@^1.4.1, q@^1.5.1:
28272991
version "1.5.1"
28282992
resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
28292993

0 commit comments

Comments
 (0)