@@ -104,6 +104,9 @@ const yargsConf = yargs
104104 default : false ,
105105 describe : 'Skip `npm run test` step'
106106 } )
107+ . option ( 'skip-version-bumping' , {
108+ describe : 'Skip version bumping step'
109+ } )
107110 . option ( 'notes' , {
108111 demand : false ,
109112 default : false ,
@@ -120,7 +123,7 @@ const versionBumpOptions = {
120123 npmTagName : argv . tag || argv . preid
121124} ;
122125
123- if ( versionBumpOptions . type === undefined && versionBumpOptions . preid === undefined ) {
126+ if ( ! argv . skipVersionBumping && versionBumpOptions . type === undefined && versionBumpOptions . preid === undefined ) {
124127 console . log ( 'Must provide either a version bump type, "preid" or "--only-docs"' . red ) ;
125128 console . log ( yargsConf . help ( ) ) ;
126129 exit ( 1 ) ;
@@ -212,8 +215,6 @@ function releaseAdRepo(repo, srcFolder, tmpFolder, vVersion) {
212215}
213216
214217function release ( { type, preid, npmTagName } ) {
215- if ( type === undefined && ! preid ) printErrorAndExit ( 'Must specify version type or preid' ) ;
216-
217218 // ensure git repo has no pending changes
218219 if ( exec ( 'git diff-index --name-only HEAD --' ) . output . length ) {
219220 printErrorAndExit ( 'Git repository must be clean' ) ;
@@ -227,27 +228,32 @@ function release({ type, preid, npmTagName }) {
227228 }
228229 console . info ( 'Current with latest changes from remote' . cyan ) ;
229230
230- // version bump
231+ // version bumping
231232 const oldVersion = npmjson . version ;
232233 let newVersion ;
233234
234- if ( type === undefined ) {
235- newVersion = oldVersion ; // --preid
236- } else if ( [ 'major' , 'minor' , 'patch' ] . indexOf ( type ) >= 0 ) {
237- newVersion = semver . inc ( oldVersion , type ) ;
235+ if ( argv . skipVersionBumping ) {
236+ newVersion = oldVersion ;
237+ console . log ( 'The version remains the same ' . yellow + oldVersion . green ) ;
238238 } else {
239- newVersion = type ; // '<version>', 'Release specific version'
240- }
239+ if ( type === undefined ) {
240+ newVersion = oldVersion ; // --preid
241+ } else if ( [ 'major' , 'minor' , 'patch' ] . indexOf ( type ) >= 0 ) {
242+ newVersion = semver . inc ( oldVersion , type ) ;
243+ } else {
244+ newVersion = type ; // '<version>', 'Release specific version'
245+ }
241246
242- if ( preid ) {
243- newVersion = semver . inc ( newVersion , 'pre' , preid ) ;
244- }
247+ if ( preid ) {
248+ newVersion = semver . inc ( newVersion , 'pre' , preid ) ;
249+ }
245250
246- npmjson . version = newVersion ;
247- `${ JSON . stringify ( npmjson , null , 2 ) } \n` . to ( packagePath ) ;
251+ npmjson . version = newVersion ;
252+ `${ JSON . stringify ( npmjson , null , 2 ) } \n` . to ( packagePath ) ;
248253
249- console . log ( 'Version changed from ' . cyan + oldVersion . green + ' to ' . cyan + newVersion . green ) ;
250- safeRun ( 'git add package.json' ) ;
254+ console . log ( 'The version changed from ' . cyan + oldVersion . green + ' to ' . cyan + newVersion . green ) ;
255+ safeRun ( 'git add package.json' ) ;
256+ }
251257
252258 if ( npmjson . scripts ) { // do not throw if there are no 'scripts' at all
253259 if ( npmjson . scripts . test && ! argv . skipTests ) {
0 commit comments