@@ -35,25 +35,29 @@ if (args[0] === 'sync') {
3535
3636await runInteractiveRelease ( {
3737 requestedTag : readFlagValue ( args , '--tag' ) ,
38+ requestedBump : readFlagValue ( args , '--bump' ) ,
3839 dryRun : args . includes ( '--dry-run' ) ,
40+ skipConfirm : args . includes ( '--yes' ) ,
3941} )
4042
41- async function runInteractiveRelease ( { requestedTag, dryRun } ) {
43+ async function runInteractiveRelease ( { requestedTag, requestedBump , dryRun, skipConfirm } ) {
4244 if ( ! isWorkingDirectoryClean ( ) ) {
4345 fail ( 'Working directory is not clean. Commit or stash changes first.' )
4446 }
4547
4648 const branch = exec ( 'git branch --show-current' )
4749 const stableVersion = getStableVersion ( readJson ( rootPackagePath ) . version || readPackageVersion ( 'packages/core' ) )
4850 const releaseTag = await resolveReleaseTag ( branch , requestedTag )
49- const bumpType = await promptChoice (
50- 'Select version bump type:' ,
51- [
52- { key : '1' , value : 'patch' , label : `patch (${ stableVersion } -> ${ bumpVersion ( stableVersion , 'patch' ) } )` } ,
53- { key : '2' , value : 'minor' , label : `minor (${ stableVersion } -> ${ bumpVersion ( stableVersion , 'minor' ) } )` } ,
54- { key : '3' , value : 'major' , label : `major (${ stableVersion } -> ${ bumpVersion ( stableVersion , 'major' ) } )` } ,
55- ]
56- )
51+ const bumpType = requestedBump
52+ ? validateBumpType ( requestedBump )
53+ : await promptChoice (
54+ 'Select version bump type:' ,
55+ [
56+ { key : '1' , value : 'patch' , label : `patch (${ stableVersion } -> ${ bumpVersion ( stableVersion , 'patch' ) } )` } ,
57+ { key : '2' , value : 'minor' , label : `minor (${ stableVersion } -> ${ bumpVersion ( stableVersion , 'minor' ) } )` } ,
58+ { key : '3' , value : 'major' , label : `major (${ stableVersion } -> ${ bumpVersion ( stableVersion , 'major' ) } )` } ,
59+ ]
60+ )
5761 const nextStable = bumpVersion ( stableVersion , bumpType )
5862 const commitHash = exec ( 'git rev-parse --short=7 HEAD' )
5963 const version = releaseTag === 'latest'
@@ -72,7 +76,9 @@ async function runInteractiveRelease({ requestedTag, dryRun }) {
7276 ] . join ( '\n' )
7377 )
7478
75- const confirmed = await promptConfirm ( dryRun ? 'Continue with dry run?' : 'Continue with release?' )
79+ const confirmed = skipConfirm
80+ ? true
81+ : await promptConfirm ( dryRun ? 'Continue with dry run?' : 'Continue with release?' )
7682 if ( ! confirmed ) {
7783 process . stdout . write ( 'Release cancelled.\n' )
7884 process . exit ( 0 )
@@ -150,6 +156,14 @@ function validateReleaseTag(branch, requestedTag) {
150156 }
151157}
152158
159+ function validateBumpType ( value ) {
160+ if ( ! [ 'patch' , 'minor' , 'major' ] . includes ( value ) ) {
161+ fail ( `Unknown bump type "${ value } ". Use patch, minor, or major.` )
162+ }
163+
164+ return value
165+ }
166+
153167function getStableVersion ( version ) {
154168 return version . split ( '-' ) [ 0 ]
155169}
0 commit comments