Skip to content

Commit f3bf651

Browse files
committed
chore: update release script
1 parent 56cb732 commit f3bf651

File tree

1 file changed

+31
-13
lines changed

1 file changed

+31
-13
lines changed

scripts/release.js

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ const currentVersion = require('../package.json').version
99
const versionIncrements = [
1010
'patch',
1111
'minor',
12-
'major',
13-
'prepatch',
14-
'preminor',
15-
'premajor',
16-
'prerelease'
12+
'major'
1713
]
1814

19-
const inc = (i) => semver.inc(currentVersion, i, 'alpha')
15+
const tags = [
16+
'latest',
17+
'next'
18+
]
19+
20+
const inc = (i) => semver.inc(currentVersion, i)
2021
const bin = (name) => path.resolve(__dirname, `../node_modules/.bin/${name}`)
2122
const run = (bin, args, opts = {}) => execa(bin, args, { stdio: 'inherit', ...opts })
2223
const step = (msg) => console.log(chalk.cyan(msg))
@@ -46,20 +47,27 @@ async function main() {
4647
throw new Error(`Invalid target version: ${targetVersion}`)
4748
}
4849

49-
const { yes } = await prompt({
50+
const { tag } = await prompt({
51+
type: 'select',
52+
name: 'tag',
53+
message: 'Select tag type',
54+
choices: tags
55+
})
56+
57+
console.log(tag)
58+
59+
const { yes: tagOk } = await prompt({
5060
type: 'confirm',
5161
name: 'yes',
52-
message: `Releasing v${targetVersion}. Confirm?`
62+
message: `Releasing v${targetVersion} with the "${tag}" tag. Confirm?`
5363
})
5464

55-
if (!yes) {
65+
if (!tagOk) {
5666
return
5767
}
5868

5969
// Run tests before release.
6070
step('\nRunning tests...')
61-
await run(bin('jest'), ['--clearCache'])
62-
await run('yarn', ['lint:fail'])
6371
await run('yarn', ['test'])
6472

6573
// Update the package version.
@@ -74,6 +82,16 @@ async function main() {
7482
step('\nGenerating the changelog...')
7583
await run('yarn', ['changelog'])
7684

85+
const { yes: changelogOk } = await prompt({
86+
type: 'confirm',
87+
name: 'yes',
88+
message: `Changelog generated. Does it look good?`
89+
})
90+
91+
if (!changelogOk) {
92+
return
93+
}
94+
7795
// Commit changes to the Git.
7896
step('\nCommitting changes...')
7997
await run('git', ['add', '-A'])
@@ -82,8 +100,8 @@ async function main() {
82100
// Publish the package.
83101
step('\nPublishing the package...')
84102
await run ('yarn', [
85-
'publish', '--tag', 'next', '--new-version', targetVersion,
86-
'--no-commit-hooks', '--no-git-tag-version'
103+
'publish', '--tag', tag, '--new-version', targetVersion, '--no-commit-hooks',
104+
'--no-git-tag-version'
87105
])
88106

89107
// Push to GitHub.

0 commit comments

Comments
 (0)