Skip to content

Commit 0c39f16

Browse files
committed
workflow: release script
1 parent 09232ee commit 0c39f16

File tree

2 files changed

+8
-40
lines changed

2 files changed

+8
-40
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
},
1919
"scripts": {
2020
"dev": "unbuild --stub",
21-
"build": "unbuild && esno scripts/patchCJS.ts"
21+
"build": "unbuild && esno scripts/patchCJS.ts",
22+
"release": "node scripts/release.js",
23+
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
2224
},
2325
"engines": {
2426
"node": ">=14.6.0"

scripts/release.js

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ const preId =
1313
const isDryRun = args.dry
1414
const skipTests = args.skipTests
1515
const skipBuild = args.skipBuild
16-
const packages = fs
17-
.readdirSync(path.resolve(__dirname, '../packages'))
18-
.filter(p => !p.endsWith('.ts') && !p.startsWith('.'))
19-
.concat('vue')
2016

2117
const versionIncrements = [
2218
'patch',
@@ -81,17 +77,10 @@ async function main() {
8177
console.log(`(skipped)`)
8278
}
8379

84-
// update all package versions and inter-dependencies
85-
step('\nUpdating package versions...')
86-
packages.forEach(p => updatePackage(getPkgRoot(p), targetVersion))
87-
8880
// build all packages with types
89-
step('\nBuilding all packages...')
81+
step('\nBuilding for production...')
9082
if (!skipBuild && !isDryRun) {
9183
await run('pnpm', ['run', 'build'])
92-
if (skipTests) {
93-
await run('pnpm', ['run', 'build:types'])
94-
}
9584
} else {
9685
console.log(`(skipped)`)
9786
}
@@ -114,10 +103,8 @@ async function main() {
114103
}
115104

116105
// publish packages
117-
step('\nPublishing packages...')
118-
for (const pkg of packages) {
119-
await publishPackage(pkg, targetVersion, runIfNotDry)
120-
}
106+
step('\nPublishing...')
107+
await publishPackage(targetVersion, runIfNotDry)
121108

122109
// push to GitHub
123110
step('\nPushing to GitHub...')
@@ -131,20 +118,8 @@ async function main() {
131118
console.log()
132119
}
133120

134-
function updatePackage(pkgRoot, version) {
135-
const pkgPath = path.resolve(pkgRoot, 'package.json')
136-
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
137-
pkg.version = version
138-
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
139-
}
140-
141-
const getPkgRoot = pkg =>
142-
pkg === 'vue'
143-
? path.resolve(__dirname, '../')
144-
: path.resolve(__dirname, '../packages/' + pkg)
145-
146-
async function publishPackage(pkgName, version, runIfNotDry) {
147-
const pkgRoot = getPkgRoot(pkgName)
121+
async function publishPackage(version, runIfNotDry) {
122+
const pkgRoot = path.resolve(__dirname, '../')
148123
const pkgPath = path.resolve(pkgRoot, 'package.json')
149124
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
150125
const publishedName = pkg.name
@@ -163,15 +138,6 @@ async function publishPackage(pkgName, version, runIfNotDry) {
163138
releaseTag = 'rc'
164139
}
165140

166-
// avoid overwriting tags for v3
167-
if (pkgName === 'vue' || pkgName === 'compiler-sfc') {
168-
if (releaseTag) {
169-
releaseTag = `v2-${releaseTag}`
170-
} else {
171-
releaseTag = 'v2'
172-
}
173-
}
174-
175141
step(`Publishing ${publishedName}...`)
176142
try {
177143
await runIfNotDry(

0 commit comments

Comments
 (0)