@@ -104,6 +104,9 @@ const yargsConf = yargs
104
104
default : false ,
105
105
describe : 'Skip `npm run test` step'
106
106
} )
107
+ . option ( 'skip-version-bumping' , {
108
+ describe : 'Skip version bumping step'
109
+ } )
107
110
. option ( 'notes' , {
108
111
demand : false ,
109
112
default : false ,
@@ -120,7 +123,7 @@ const versionBumpOptions = {
120
123
npmTagName : argv . tag || argv . preid
121
124
} ;
122
125
123
- if ( versionBumpOptions . type === undefined && versionBumpOptions . preid === undefined ) {
126
+ if ( ! argv . skipVersionBumping && versionBumpOptions . type === undefined && versionBumpOptions . preid === undefined ) {
124
127
console . log ( 'Must provide either a version bump type, "preid" or "--only-docs"' . red ) ;
125
128
console . log ( yargsConf . help ( ) ) ;
126
129
exit ( 1 ) ;
@@ -212,8 +215,6 @@ function releaseAdRepo(repo, srcFolder, tmpFolder, vVersion) {
212
215
}
213
216
214
217
function release ( { type, preid, npmTagName } ) {
215
- if ( type === undefined && ! preid ) printErrorAndExit ( 'Must specify version type or preid' ) ;
216
-
217
218
// ensure git repo has no pending changes
218
219
if ( exec ( 'git diff-index --name-only HEAD --' ) . output . length ) {
219
220
printErrorAndExit ( 'Git repository must be clean' ) ;
@@ -227,27 +228,32 @@ function release({ type, preid, npmTagName }) {
227
228
}
228
229
console . info ( 'Current with latest changes from remote' . cyan ) ;
229
230
230
- // version bump
231
+ // version bumping
231
232
const oldVersion = npmjson . version ;
232
233
let newVersion ;
233
234
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 ) ;
238
238
} 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
+ }
241
246
242
- if ( preid ) {
243
- newVersion = semver . inc ( newVersion , 'pre' , preid ) ;
244
- }
247
+ if ( preid ) {
248
+ newVersion = semver . inc ( newVersion , 'pre' , preid ) ;
249
+ }
245
250
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 ) ;
248
253
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
+ }
251
257
252
258
if ( npmjson . scripts ) { // do not throw if there are no 'scripts' at all
253
259
if ( npmjson . scripts . test && ! argv . skipTests ) {
0 commit comments