Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,18 @@ You can set a custom message for github release via `--notes` CLI option:
> release patch --notes "This is a small fix"
```

#### If you need `dry-run` mode by default

You can setup the `release-script` to run in `dry-run` mode by default.

It can be done by setting `"true"` the `defaultDryRun` option in your `package.json`:
```json
"release-script": {
"defaultDryRun": "true"
}
```
Then to actually run your commands you will have to add `--run`.


#### This script does the following steps:

Expand Down
25 changes: 23 additions & 2 deletions src/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ const yargsConf = yargs
alias: 'n',
describe: 'This option toggles "dry run" mode'
})
.option('run', {
describe: 'You need this when "defaultDryRun": "true"'
})
.option('verbose', {
describe: 'Increased debug output'
})
Expand Down Expand Up @@ -115,8 +118,26 @@ if (!argv.skipVersionBumping && versionBumpOptions.type === undefined && version

let notesForRelease = argv.notes;

const dryRunMode = argv.dryRun;
if (dryRunMode) console.log('DRY RUN'.magenta);
const isDefaultDryRunOptionSetTrue =
configOptions.defaultDryRun === true ||
configOptions.defaultDryRun === 'true';

let dryRunMode;
if (argv.run) {
dryRunMode = false;
} else {
dryRunMode = argv.dryRun || isDefaultDryRunOptionSetTrue;
}

if (dryRunMode) {
console.log('DRY RUN'.magenta);

if (isDefaultDryRunOptionSetTrue) {
console.log('------------------------------------------------------');
console.log('To actually run your command please add "--run" option'.yellow);
console.log('------------------------------------------------------');
}
}

if (argv.preid) console.log('"--preid" detected. Documents will not be published'.yellow);
if (argv.onlyDocs && !argv.preid) console.log('Publish only documents'.yellow);
Expand Down