Skip to content

Commit

Permalink
fix: add types for cli flags (#551)
Browse files Browse the repository at this point in the history
  • Loading branch information
tommywo committed Nov 12, 2019
1 parent f96b25c commit bf1d64a
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 42 deletions.
42 changes: 28 additions & 14 deletions packages/conventional-changelog-cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,45 +50,59 @@ var cli = meow(`
-t, --tag-prefix Tag prefix to consider when reading the tags
--commit-path Generate a changelog scoped to a specific directory
`, {
booleanDefault: undefined,
flags: {
infile: {
alias: `i`
alias: 'i',
type: 'string'
},
outfile: {
alias: `o`
alias: 'o',
type: 'string'
},
'same-file': {
alias: `s`
alias: 's',
type: 'boolean'
},
preset: {
alias: `p`
alias: 'p',
type: 'string'
},
pkg: {
alias: `k`
alias: 'k',
type: 'string'
},
append: {
alias: `a`
alias: 'a',
type: 'boolean'
},
'release-count': {
alias: `r`
alias: 'r',
type: 'number'
},
'output-unreleased': {
alias: `u`
alias: 'u',
type: 'boolean'
},
verbose: {
alias: `v`
alias: 'v',
type: 'boolean'
},
config: {
alias: `n`
alias: 'n',
type: 'string'
},
context: {
alias: `c`
alias: 'c',
type: 'string'
},
'lerna-package': {
alias: `l`
alias: 'l',
type: 'string'
},
'tag-prefix': {
alias: `t`
alias: 't',
type: 'string'
}
}
})
Expand All @@ -112,7 +126,7 @@ if (infile && infile === outfile) {
}
}

var options = _.omit({
var options = _.omitBy({
preset: flags.preset,
pkg: {
path: flags.pkg
Expand Down
2 changes: 1 addition & 1 deletion packages/conventional-changelog-cli/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ describe('cli', function () {
})

it('should ignore `infile` if `releaseCount` is `0` (file)', function (done) {
var cp = spawn(cliPath, ['-i', path.join(__dirname, 'fixtures/_CHANGELOG.md'), '--releaseCount', 0, '-s'], {
var cp = spawn(cliPath, ['-i', path.join(__dirname, 'fixtures/_CHANGELOG.md'), '--release-count', 0, '-s'], {
stdio: [process.stdin, null, null]
})

Expand Down
6 changes: 4 additions & 2 deletions packages/conventional-changelog-writer/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ var cli = meow(`
`, {
flags: {
context: {
alias: `c`
alias: 'c',
type: 'string'
},
options: {
alias: `o`
alias: 'o',
type: 'string'
}
}
})
Expand Down
27 changes: 20 additions & 7 deletions packages/conventional-commits-parser/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,38 @@ var cli = meow(`
`, {
flags: {
'header-pattern': {
alias: `p`
alias: 'p',
type: 'string'
},
'header-correspondence': {
alias: `c`
alias: 'c',
type: 'string'
},
'reference-actions': {
alias: `r`
alias: 'r',
type: 'string'
},
'issue-prefixes': {
alias: `i`
alias: 'i',
type: 'string'
},
'note-keywords': {
alias: `n`
alias: 'n',
type: 'string'
},
'field-pattern': {
alias: `f`
alias: 'f',
type: 'string'
},
'revert-pattern': {
type: 'string'
},
'revert-correspondence': {
type: 'string'
},
verbose: {
alias: `v`
alias: 'v',
type: 'boolean'
}
}
})
Expand Down
20 changes: 18 additions & 2 deletions packages/git-semver-tags/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,24 @@ var args = meow(`
--cwd path to git repository to be searched
--lerna parse lerna style git tags
--package <name> when listing lerna style tags, filter by a package
--tagPrefix <prefix> prefix to remove from the tags during their processing`
)
--tagPrefix <prefix> prefix to remove from the tags during their processing`,
{
booleanDefault: undefined,
flags: {
cwd: {
type: 'string'
},
lerna: {
type: 'boolean'
},
package: {
type: 'string'
},
tagPrefix: {
type: 'string'
}
}
})

gitSemverTags({
lernaTags: args.flags.lerna,
Expand Down
42 changes: 26 additions & 16 deletions packages/standard-changelog/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,46 +29,56 @@ var cli = meow(`
-l, --lerna-package Generate a changelog for a specific lerna package (:pkg-name@1.0.0)
--commit-path Generate a changelog scoped to a specific directory
`, {
booleanDefault: undefined,
flags: {
'infile': {
alias: `i`,
default: `CHANGELOG.md`,
type: `string`
alias: 'i',
default: 'CHANGELOG.md',
type: 'string'
},
'help': {
alias: `h`
alias: 'h'
},
'outfile': {
alias: `o`
alias: 'o',
type: 'string'
},
'same-file': {
alias: `s`,
alias: 's',
default: true,
type: `boolean`
type: 'boolean'
},
'preset': {
alias: `p`
alias: 'p',
type: 'string'
},
'pkg': {
alias: `k`
alias: 'k',
type: 'string'
},
'append': {
alias: `a`
alias: 'a',
type: 'boolean'
},
'release-count': {
alias: `r`
alias: 'r',
type: 'number'
},
'verbose': {
alias: `v`
alias: 'v',
type: 'boolean'
},
'context': {
alias: `c`
alias: 'c',
type: 'string'
},
'first-release': {
alias: `f`
alias: `f`,
type: 'boolean'
},
'lerna-package': {
alias: `l`
alias: 'l',
type: 'string'
}
}
})
Expand All @@ -80,7 +90,7 @@ var outfile = sameFile ? (flags.outfile || infile) : flags.outfile
var append = flags.append
var releaseCount = flags.firstRelease ? 0 : flags.releaseCount

var options = _.omit({
var options = _.omitBy({
preset: flags.preset,
pkg: {
path: flags.pkg
Expand Down

0 comments on commit bf1d64a

Please sign in to comment.