Skip to content

Commit b8c7662

Browse files
committed
workflow: update version when releasing
1 parent 98d5b65 commit b8c7662

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

Diff for: CHANGELOG.md

-12
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,3 @@
44
### Features
55

66
* it is working ([6c387d8](https://github.com/vitejs/vite-plugin-vue2/commit/6c387d8172d76b17df3d13a37f87d0e203bc4523))
7-
8-
9-
10-
# 0.1.0 (2022-06-17)
11-
12-
13-
### Features
14-
15-
* it is working ([6c387d8](https://github.com/vitejs/vite-plugin-vue2/commit/6c387d8172d76b17df3d13a37f87d0e203bc4523))
16-
17-
18-

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vitejs/plugin-vue2",
3-
"version": "0.1.0",
3+
"version": "1.0.0",
44
"license": "MIT",
55
"author": "Evan You",
66
"files": [

Diff for: scripts/release.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ async function main() {
7777
console.log(`(skipped)`)
7878
}
7979

80+
// update package version
81+
updatePackage(targetVersion)
82+
8083
// build all packages with types
8184
step('\nBuilding for production...')
8285
if (!skipBuild && !isDryRun) {
@@ -118,6 +121,14 @@ async function main() {
118121
console.log()
119122
}
120123

124+
function updatePackage(version) {
125+
const pkgRoot = path.resolve(__dirname, '../')
126+
const pkgPath = path.resolve(pkgRoot, 'package.json')
127+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
128+
pkg.version = version
129+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
130+
}
131+
121132
async function publishPackage(version, runIfNotDry) {
122133
const pkgRoot = path.resolve(__dirname, '../')
123134
const pkgPath = path.resolve(pkgRoot, 'package.json')
@@ -165,4 +176,7 @@ async function publishPackage(version, runIfNotDry) {
165176
}
166177
}
167178

168-
main()
179+
main().catch(err => {
180+
updatePackage(currentVersion)
181+
console.error(err)
182+
})

0 commit comments

Comments
 (0)