@@ -52,17 +52,17 @@ const skipBuildStep = configOptions.skipBuildStep;
52
52
//------------------------------------------------------------------------------
53
53
// command line options
54
54
const yargsConf = yargs
55
- . usage ( 'Usage: $0 <version> [--preid <identifier>]\nor\nUsage: $0 --only-docs' )
56
- . example ( '$0 minor --preid beta' , 'Release with minor version bump with pre-release tag. (npm tag `beta`)' )
57
- . example ( '$0 major' , 'Release with major version bump' )
58
- . example ( '$0 major --notes "This is new cool version"' , 'Add a custom message to release' )
59
- . example ( '$0 major --dry-run ' , 'Release dry run with patch version bump ' )
60
- . example ( '$0 --preid alpha' , 'Release same version with pre-release bump. (npm tag `alpha`)' )
61
- . example ( '$0 0.101.0 --preid rc --tag canary' , 'Release `v0.101.0-rc.0` pre-release version with npm tag `canary`' )
62
- . command ( 'patch' , 'Release patch' )
63
- . command ( 'minor' , 'Release minor' )
64
- . command ( 'major' , 'Release major' )
65
- . command ( '<version>' , 'Release specific version' )
55
+ . usage ( 'Usage: $0 <version> --run [--preid <identifier>]\nor\nUsage: $0 --only-docs --run ' )
56
+ . example ( '$0 minor --preid beta --run ' , 'Release with minor version bump with pre-release tag. (npm tag `beta`)' )
57
+ . example ( '$0 major --run ' , 'Release with major version bump' )
58
+ . example ( '$0 major --notes "This is new cool version" --run ' , 'Add a custom message to release' )
59
+ . example ( '$0 major' , 'Without "-- run" option it will dry run ' )
60
+ . example ( '$0 --preid alpha --run ' , 'Release same version with pre-release bump. (npm tag `alpha`)' )
61
+ . example ( '$0 0.101.0 --preid rc --tag canary --run ' , 'Release `v0.101.0-rc.0` pre-release version with npm tag `canary`' )
62
+ . command ( 'patch --run ' , 'Release patch' )
63
+ . command ( 'minor --run ' , 'Release minor' )
64
+ . command ( 'major --run ' , 'Release major' )
65
+ . command ( '<version> --run ' , 'Release specific version' )
66
66
. option ( 'preid' , {
67
67
demand : false ,
68
68
describe : 'pre-release identifier' ,
@@ -79,11 +79,10 @@ const yargsConf = yargs
79
79
default : false ,
80
80
describe : 'Publish only documents'
81
81
} )
82
- . option ( 'dry-run' , {
83
- alias : 'n' ,
82
+ . option ( 'run' , {
84
83
demand : false ,
85
84
default : false ,
86
- describe : 'Execute command in dry run mode.\nWill not commit, tag, push, or publish anything.\nUserful for testing .'
85
+ describe : 'Actually execute command .'
87
86
} )
88
87
. option ( 'verbose' , {
89
88
demand : false ,
@@ -98,7 +97,10 @@ const yargsConf = yargs
98
97
99
98
const argv = yargsConf . argv ;
100
99
101
- if ( argv . dryRun ) console . log ( 'DRY RUN' . magenta ) ;
100
+ if ( ! argv . run ) {
101
+ console . log ( 'DRY RUN' . magenta ) ;
102
+ console . log ( 'For actuall running of your command please add "--run" option' . yellow ) ;
103
+ }
102
104
if ( argv . onlyDocs ) console . log ( 'Publish only documents' . magenta ) ;
103
105
104
106
config . silent = ! argv . verbose ;
@@ -132,15 +134,15 @@ function run(command) {
132
134
}
133
135
134
136
function safeRun ( command ) {
135
- if ( argv . dryRun ) {
137
+ if ( ! argv . run ) {
136
138
console . log ( `[${ command } ]` . grey , 'DRY RUN' . magenta ) ;
137
139
} else {
138
140
return run ( command ) ;
139
141
}
140
142
}
141
143
142
144
function safeRm ( ...args ) {
143
- if ( argv . dryRun ) console . log ( `[rm ${ args . join ( ' ' ) } ]` . grey , 'DRY RUN' . magenta ) ;
145
+ if ( ! argv . run ) console . log ( `[rm ${ args . join ( ' ' ) } ]` . grey , 'DRY RUN' . magenta ) ;
144
146
else rm ( args ) ;
145
147
}
146
148
@@ -302,7 +304,7 @@ function release({ type, preid, npmTagName }) {
302
304
console . log ( `GitHub token found ${ githubToken } ` . green ) ;
303
305
console . log ( 'Publishing to GitHub: ' . cyan + vVersion . green ) ;
304
306
305
- if ( argv . dryRun ) {
307
+ if ( ! argv . run ) {
306
308
console . log ( `[publishing to GitHub]` . grey , 'DRY RUN' . magenta ) ;
307
309
} else {
308
310
const [ githubOwner , githubRepo ] = getOwnerAndRepo ( npmjson . repository . url || npmjson . repository ) ;
0 commit comments