Skip to content

Commit 6c611cf

Browse files
committed
chore: update release script
1 parent baf8083 commit 6c611cf

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

scripts/release.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import { readFileSync, writeFileSync } from 'fs'
22
import { resolve } from 'path'
3+
import { fileURLToPath } from 'url'
34
import c from 'picocolors'
4-
import { inc as _inc, valid } from 'semver'
55
import prompts from 'prompts'
66
import { execa } from 'execa'
7+
import { inc as _inc, valid } from 'semver'
78
import { version as currentVersion } from '../package.json'
8-
import { fileURLToPath } from 'url'
99

1010
const versionIncrements = ['patch', 'minor', 'major']
1111

12+
const tags = ['latest', 'next']
13+
1214
const dir = dirname(fileURLToPath(import.meta.url))
1315
const inc = (i) => _inc(currentVersion, i)
1416
const run = (bin, args, opts = {}) =>
@@ -42,10 +44,17 @@ async function main() {
4244
throw new Error(`Invalid target version: ${targetVersion}`)
4345
}
4446

47+
const { tag } = await enquirer.prompt({
48+
type: 'select',
49+
name: 'tag',
50+
message: 'Select tag type',
51+
choices: tags
52+
})
53+
4554
const { yes: tagOk } = await prompts({
4655
type: 'confirm',
4756
name: 'yes',
48-
message: `Releasing v${targetVersion}. Confirm?`
57+
message: `Releasing v${targetVersion} in ${tag}. Confirm?`
4958
})
5059

5160
if (!tagOk) {
@@ -83,7 +92,13 @@ async function main() {
8392

8493
// Publish the package.
8594
step('\nPublishing the package...')
86-
await run('pnpm', ['publish', '--ignore-scripts', '--no-git-checks'])
95+
await run('pnpm', [
96+
'publish',
97+
'--tag',
98+
tag,
99+
'--ignore-scripts',
100+
'--no-git-checks'
101+
])
87102

88103
// Push to GitHub.
89104
step('\nPushing to GitHub...')

0 commit comments

Comments
 (0)