Skip to content

Commit 319b214

Browse files
committed
Make misc text fixes and removing some superfluous code.
1 parent 4862716 commit 319b214

File tree

1 file changed

+24
-35
lines changed

1 file changed

+24
-35
lines changed

src/release.js

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -54,63 +54,48 @@ const defaultDryRun = configOptions.defaultDryRun !== 'false';
5454
//------------------------------------------------------------------------------
5555
// command line options
5656
const yargsConf = yargs
57-
.usage('Usage: $0 <version> --run [--preid <identifier>]\nor\nUsage: $0 --only-docs --run')
58-
.example('$0 minor --preid beta --run', 'Release with minor version bump with pre-release tag. (npm tag `beta`)')
59-
.example('$0 major --run', 'Release with major version bump')
60-
.example('$0 major --notes "This is new cool version" --run', 'Add a custom message to release')
61-
.example('$0 major', 'Without "--run" option it will dry run')
62-
.example('$0 --preid alpha --run', 'Release same version with pre-release bump. (npm tag `alpha`)')
63-
.example('$0 0.101.0 --preid rc --tag canary --run', 'Release `v0.101.0-rc.0` pre-release version with npm tag `canary`')
64-
.example('$0 ... --skip-test(s)', 'Use this flag in case you need to skip `npm run test` step.')
65-
.command('patch --run', 'Release patch')
66-
.command('minor --run', 'Release minor')
67-
.command('major --run', 'Release major')
68-
.command('<version> --run', 'Release specific version')
57+
.usage('Usage: $0 <version> [--preid <identifier>]\nor\nUsage: $0 --only-docs')
58+
.example('$0 minor --preid beta', 'Release with a minor version bump and a pre-release tag. (npm tag `beta`)')
59+
.example('$0 major', 'Release with a major version bump')
60+
.example('$0 major --notes "a custom message text"', 'Add a custom message to the release')
61+
.example('$0 --preid alpha', 'Release the same version with a pre-release tag. (npm tag `alpha`)')
62+
.example('$0 0.101.0 --preid rc --tag canary', 'Release pre-release version `v0.101.0-rc.0` with npm tag `canary`')
63+
.example('$0 ... --skip-test(s)', 'Use this flag if you need to skip `npm run test` step.')
64+
.command('patch', 'Release patch')
65+
.command('minor', 'Release minor')
66+
.command('major', 'Release major')
67+
.command('<version>', 'Release arbitrary version number')
6968
.option('preid', {
70-
demand: false,
7169
describe: 'pre-release identifier',
7270
type: 'string'
7371
})
7472
.option('tag', {
75-
demand: false,
76-
describe: 'Npm tag name for the pre-release version.\nIf it is not provided, then `preid` value is used',
73+
describe: 'Npm tag name for pre-release version.\nIf it is not provided, then `preid` value is used',
7774
type: 'string'
7875
})
7976
.option('only-docs', {
8077
alias: 'docs',
81-
demand: false,
82-
default: false,
8378
describe: 'Publish only documents'
8479
})
8580
.option('run', {
86-
demand: false,
87-
default: false,
88-
describe: 'Actually execute command.'
81+
describe: 'Actually execute command'
8982
})
9083
.option('dry-run', {
9184
alias: 'n',
92-
demand: false,
93-
default: false,
94-
describe: 'With "defaultDryRun" option set this toggles "dry run" mode.'
85+
describe: 'With "defaultDryRun" option set this toggles "dry run" mode'
9586
})
9687
.option('verbose', {
97-
demand: false,
98-
default: false,
9988
describe: 'Increased debug output'
10089
})
10190
.option('skip-tests', {
10291
alias: 'skip-test',
103-
demand: false,
104-
default: false,
10592
describe: 'Skip `npm run test` step'
10693
})
10794
.option('skip-version-bumping', {
10895
describe: 'Skip version bumping step'
10996
})
11097
.option('notes', {
111-
demand: false,
112-
default: false,
113-
describe: 'A custom message for release.\nOverrides [rf|mt]changelog message'
98+
describe: 'A custom message for the release.\nOverrides [rf|mt]changelog message'
11499
});
115100

116101
const argv = yargsConf.argv;
@@ -137,7 +122,11 @@ if (argv.run) {
137122
}
138123
if (dryRunMode) {
139124
console.log('DRY RUN'.magenta);
140-
if (defaultDryRun) console.log('For actual running of your command please add "--run" option'.yellow);
125+
if (defaultDryRun) {
126+
console.log('------------------------------------------------------');
127+
console.log('To actually run your command please add "--run" option'.yellow);
128+
console.log('------------------------------------------------------');
129+
}
141130
}
142131

143132
if (argv.preid) console.log('"--preid" detected. Documents will not be published'.yellow);
@@ -314,7 +303,7 @@ function release({ type, preid, npmTagName }) {
314303
safeRun(`git add -A ${changelogAlpha}`);
315304
}
316305

317-
console.log('Generated Changelog'.cyan);
306+
console.log('The changelog has been generated'.cyan);
318307
}
319308

320309
safeRun(`git commit -m "Release ${vVersion}"`);
@@ -360,10 +349,10 @@ function release({ type, preid, npmTagName }) {
360349
if (err) {
361350
console.log('API request to GitHub, error has occured:'.red);
362351
console.log(err);
363-
console.log('Skip GitHub releasing'.yellow);
352+
console.log('Skipping GitHub releasing'.yellow);
364353
} else if (res.statusMessage === 'Unauthorized') {
365354
console.log(`GitHub token ${githubToken} is wrong`.red);
366-
console.log('Skip GitHub releasing'.yellow);
355+
console.log('Skipping GitHub releasing'.yellow);
367356
} else {
368357
console.log(`Published at ${body.html_url}`.green);
369358
}
@@ -409,7 +398,7 @@ function release({ type, preid, npmTagName }) {
409398
releaseAdRepo(bowerRepo, bowerRoot, tmpBowerRepo, vVersion);
410399
console.log('Released: '.cyan + 'bower package'.green);
411400
} else {
412-
console.log('The "bowerRepo" is not set in package.json. Not publishing bower.'.yellow);
401+
console.log('The "bowerRepo" is not set in package.json. Skipping Bower package publishing.'.yellow);
413402
}
414403
}
415404

0 commit comments

Comments
 (0)