|
1 | 1 | import { readFileSync, writeFileSync } from 'fs' |
2 | 2 | import { resolve } from 'path' |
| 3 | +import { fileURLToPath } from 'url' |
3 | 4 | import c from 'picocolors' |
4 | | -import { inc as _inc, valid } from 'semver' |
5 | 5 | import prompts from 'prompts' |
6 | 6 | import { execa } from 'execa' |
| 7 | +import { inc as _inc, valid } from 'semver' |
7 | 8 | import { version as currentVersion } from '../package.json' |
8 | | -import { fileURLToPath } from 'url' |
9 | 9 |
|
10 | 10 | const versionIncrements = ['patch', 'minor', 'major'] |
11 | 11 |
|
| 12 | +const tags = ['latest', 'next'] |
| 13 | + |
12 | 14 | const dir = dirname(fileURLToPath(import.meta.url)) |
13 | 15 | const inc = (i) => _inc(currentVersion, i) |
14 | 16 | const run = (bin, args, opts = {}) => |
@@ -42,10 +44,17 @@ async function main() { |
42 | 44 | throw new Error(`Invalid target version: ${targetVersion}`) |
43 | 45 | } |
44 | 46 |
|
| 47 | + const { tag } = await enquirer.prompt({ |
| 48 | + type: 'select', |
| 49 | + name: 'tag', |
| 50 | + message: 'Select tag type', |
| 51 | + choices: tags |
| 52 | + }) |
| 53 | + |
45 | 54 | const { yes: tagOk } = await prompts({ |
46 | 55 | type: 'confirm', |
47 | 56 | name: 'yes', |
48 | | - message: `Releasing v${targetVersion}. Confirm?` |
| 57 | + message: `Releasing v${targetVersion} in ${tag}. Confirm?` |
49 | 58 | }) |
50 | 59 |
|
51 | 60 | if (!tagOk) { |
@@ -83,7 +92,13 @@ async function main() { |
83 | 92 |
|
84 | 93 | // Publish the package. |
85 | 94 | 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 | + ]) |
87 | 102 |
|
88 | 103 | // Push to GitHub. |
89 | 104 | step('\nPushing to GitHub...') |
|
0 commit comments