Skip to content

Commit 3e1eede

Browse files
committed
ask bump method first
1 parent 2df0250 commit 3e1eede

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

scripts/publish.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const main = async () => {
4141

4242
ctx.packages = JSON.parse(list.stdout)
4343

44-
const pwdsCommand = await execa('pnpm', ['recursive', 'exec', 'pwd'])
44+
const pwdsCommand = await execa('pnpm', ['recursive', 'exec', 'pwd']) // use `pnpm recursive exec` to get the correct topological sort order // https://github.com/pnpm/pnpm/issues/7716
4545
const pwds = pwdsCommand.stdout
4646
.split('\n')
4747
.map(s => s.trim())
@@ -127,7 +127,8 @@ const main = async () => {
127127

128128
let bumpedVersion = await task.prompt(ListrEnquirerPromptAdapter).run<string>({
129129
type: 'Select',
130-
message: `Select semver increment or specify new version (current latest is ${maxVersion})`,
130+
message: `Select semver increment for all packages, specify new version, or publish packages independently`,
131+
hint: `Current latest version across all packageas is ${maxVersion}`,
131132
choices: [
132133
...bumpChoices(maxVersion),
133134
{
@@ -138,6 +139,18 @@ const main = async () => {
138139
})
139140

140141
if (bumpedVersion === 'independent') {
142+
const bumpMethod = await task.prompt(ListrEnquirerPromptAdapter).run<semver.ReleaseType | null>({
143+
type: 'Select',
144+
message: 'Select semver increment for each package',
145+
choices: [
146+
...allReleaseTypes.map(type => ({message: type, value: type})),
147+
{
148+
message: 'Ask for each package',
149+
value: null,
150+
},
151+
],
152+
})
153+
141154
const rawChanges = await gatherPackageChanges(ctx)
142155
const changes = rawChanges.map(c => {
143156
fs.mkdirSync(path.join(c.pkg.folder, 'changes'), {recursive: true})
@@ -148,6 +161,7 @@ const main = async () => {
148161
}
149162
return {...c, changelog: null}
150163
})
164+
151165
const include = await task.prompt(ListrEnquirerPromptAdapter).run<string[]>({
152166
type: 'MultiSelect',
153167
message: 'Select packages',
@@ -158,21 +172,11 @@ const main = async () => {
158172
value: c.pkg.name,
159173
})),
160174
})
161-
const bump = await task.prompt(ListrEnquirerPromptAdapter).run<semver.ReleaseType | 'ask'>({
162-
type: 'Select',
163-
message: 'Select semver increment for each package',
164-
choices: [
165-
...allReleaseTypes.map(type => ({message: type, value: type})),
166-
{
167-
message: 'Ask for each package',
168-
value: 'ask',
169-
},
170-
],
171-
})
175+
172176
ctx.versionStrategy = {
173177
type: 'independent',
174178
include,
175-
bump: bump === 'ask' ? null : bump,
179+
bump: bumpMethod,
176180
}
177181
} else if (bumpedVersion === 'other') {
178182
bumpedVersion = await task.prompt(ListrEnquirerPromptAdapter).run<string>({

0 commit comments

Comments
 (0)