File tree Expand file tree Collapse file tree 2 files changed +35
-2
lines changed
Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,18 @@ You can set a custom message for github release via `--notes` CLI option:
170170> release patch --notes "This is a small fix"
171171```
172172
173+ #### If you need ` dry-run ` mode by default
174+
175+ You can setup the ` release-script ` to run in ` dry-run ` mode by default.
176+
177+ It can be done by setting ` "true" ` the ` defaultDryRun ` option in your ` package.json ` :
178+ ``` json
179+ "release-script" : {
180+ "defaultDryRun" : " true"
181+ }
182+ ```
183+ Then to actually run your commands you will have to add ` --run ` .
184+
173185
174186#### This script does the following steps:
175187
Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ const yargsConf = yargs
8383 alias : 'n' ,
8484 describe : 'This option toggles "dry run" mode'
8585 } )
86+ . option ( 'run' , {
87+ describe : 'You need this when "defaultDryRun": "true"'
88+ } )
8689 . option ( 'verbose' , {
8790 describe : 'Increased debug output'
8891 } )
@@ -115,8 +118,26 @@ if (!argv.skipVersionBumping && versionBumpOptions.type === undefined && version
115118
116119let notesForRelease = argv . notes ;
117120
118- const dryRunMode = argv . dryRun ;
119- if ( dryRunMode ) console . log ( 'DRY RUN' . magenta ) ;
121+ const isDefaultDryRunOptionSetTrue =
122+ configOptions . defaultDryRun === true ||
123+ configOptions . defaultDryRun === 'true' ;
124+
125+ let dryRunMode ;
126+ if ( argv . run ) {
127+ dryRunMode = false ;
128+ } else {
129+ dryRunMode = argv . dryRun || isDefaultDryRunOptionSetTrue ;
130+ }
131+
132+ if ( dryRunMode ) {
133+ console . log ( 'DRY RUN' . magenta ) ;
134+
135+ if ( isDefaultDryRunOptionSetTrue ) {
136+ console . log ( '------------------------------------------------------' ) ;
137+ console . log ( 'To actually run your command please add "--run" option' . yellow ) ;
138+ console . log ( '------------------------------------------------------' ) ;
139+ }
140+ }
120141
121142if ( argv . preid ) console . log ( '"--preid" detected. Documents will not be published' . yellow ) ;
122143if ( argv . onlyDocs && ! argv . preid ) console . log ( 'Publish only documents' . yellow ) ;
You can’t perform that action at this time.
0 commit comments