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:
170
170
> release patch --notes "This is a small fix"
171
171
```
172
172
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
+
173
185
174
186
#### This script does the following steps:
175
187
Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ const yargsConf = yargs
83
83
alias : 'n' ,
84
84
describe : 'This option toggles "dry run" mode'
85
85
} )
86
+ . option ( 'run' , {
87
+ describe : 'You need this when "defaultDryRun": "true"'
88
+ } )
86
89
. option ( 'verbose' , {
87
90
describe : 'Increased debug output'
88
91
} )
@@ -115,8 +118,26 @@ if (!argv.skipVersionBumping && versionBumpOptions.type === undefined && version
115
118
116
119
let notesForRelease = argv . notes ;
117
120
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
+ }
120
141
121
142
if ( argv . preid ) console . log ( '"--preid" detected. Documents will not be published' . yellow ) ;
122
143
if ( argv . onlyDocs && ! argv . preid ) console . log ( 'Publish only documents' . yellow ) ;
You can’t perform that action at this time.
0 commit comments