Skip to content

Commit bc7c257

Browse files
committed
version bump to 2.2.4-beta.1
1 parent 6933385 commit bc7c257

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

.husky/pre-push

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/bin/sh
22

3-
node scripts/check-tag.js
3+
node scripts/check-tag.js
4+
node scripts/check-readme.js

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wing-companion",
3-
"version": "2.2.3",
3+
"version": "2.2.4-beta.1",
44
"main": "dist/index.js",
55
"type": "module",
66
"scripts": {

scripts/check-readme.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import * as fs from 'fs'
2+
import { exit } from 'process'
3+
4+
let pkg
5+
try {
6+
pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'))
7+
} catch {
8+
throw new Error('Cannot parse package.json')
9+
}
10+
11+
const pkgVersion = pkg.version
12+
13+
if (pkgVersion.includes('alpha') || pkgVersion.includes('beta') || pkgVersion.includes('rc')) {
14+
console.log(`Version '${pkgVersion}' is a pre-release, skipping README check`)
15+
exit(0)
16+
}
17+
18+
let readme = ''
19+
try {
20+
readme = fs.readFileSync('README.md', 'utf8')
21+
} catch {
22+
throw new Error('Cannot read README.md')
23+
}
24+
25+
if (!readme.includes(`## ${pkgVersion}`)) {
26+
throw new Error(`README.md does not contain version '${pkgVersion}'`)
27+
}
28+
29+
console.log(`README.md contains version '${pkgVersion}'`)

scripts/check-tag.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ if (!tag) {
2121
throw new Error('No git tag found on this branch')
2222
}
2323

24-
if (!/^v\d+(\.\d+){2,3}$/.test(tag)) {
25-
throw new Error(`Latest tag '${tag}' does not match vX.Y.Z or vX.Y.Z.W`)
24+
const VERSION_RE = /^v\d+\.\d+\.\d+(-(alpha|beta|rc)(\.\d+)?)?$/
25+
26+
if (!VERSION_RE.test(tag)) {
27+
throw new Error(`Latest tag '${tag}' does not match vX.Y.Z[-(alpha|beta|rc)[.n]]`)
2628
}
2729

2830
let pkg
@@ -36,7 +38,7 @@ const pkgVersion = pkg.version
3638
const tagVersion = tag.slice(1)
3739

3840
if (pkgVersion !== tagVersion) {
39-
throw new Error(`ERROR: package.json version (${pkgVersion}) does not match git tag (${tag})`)
41+
throw new Error(`package.json version (${pkgVersion}) does not match git tag (${tag})`)
4042
}
4143

4244
console.log(`Git tag '${tag}' matches package.json version '${pkgVersion}'`)

0 commit comments

Comments
 (0)