Skip to content

Commit

Permalink
refactor(changelog-generator): print banner sooner
Browse files Browse the repository at this point in the history
So that in the `--dry-run` without `--version` use case, you won't see
the "phony version" message before the banner:

```
Using phony version changelog-generator/v0.0.0-placeholder during --dry-run
 ____________________
(_)                  `
  |                  |
  |   changelog.js   |
  |   ============   |
  |                  |
  |   Reporting      |
  |   for duty!      |
  |                  |
  |__________________|
  (_)_________________)

Fetching remote tags: run with --no-update-tags to skip
```

Note that this does mean that we're showing the banner in some
situations where we didn't show it before, but I think that's ok.
Example:

```
changelog-generator ❯ bin/liferay-changelog-generator.js --invalid-option
 ____________________
(_)                  `
  |                  |
  |   changelog.js   |
  |   ============   |
  |                  |
  |   Reporting      |
  |   for duty!      |
  |                  |
  |__________________|
  (_)_________________)

error: Unrecognized argument --invalid-option; see --help for available options
error: Missing required option: --version; see --help for usage
zsh: exit 1     bin/liferay-changelog-generator.js --invalid-option
```
  • Loading branch information
wincent committed Oct 5, 2020
1 parent 65a37c4 commit e9ad08b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions projects/npm-tools/packages/changelog-generator/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,6 @@ async function getVersionTagPrefix() {
}

async function main(_node, _script, ...args) {
const options = await parseArgs(args);

if (!options) {
process.exit(1);
}
const {outfile, to, updateTags} = options;

printBanner(`
changelog.js
============
Expand All @@ -717,6 +710,14 @@ async function main(_node, _script, ...args) {
for duty!
`);

const options = await parseArgs(args);

if (!options) {
process.exit(1);
}

const {outfile, to, updateTags} = options;

if (updateTags) {
try {
info('Fetching remote tags: run with --no-update-tags to skip');
Expand Down

0 comments on commit e9ad08b

Please sign in to comment.