Skip to content

Commit

Permalink
Update dependencies and remove support for node 4 (#50)
Browse files Browse the repository at this point in the history
Migrate from deprecated optimist to yargs
  • Loading branch information
piuccio authored Dec 27, 2018
1 parent 5302740 commit a4a5a79
Show file tree
Hide file tree
Showing 5 changed files with 3,543 additions and 2,290 deletions.
10 changes: 2 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
language: node_js

node_js:
- 4
- 6
- 8
- 9
- 10

cache:
directories:
- node_modules
- $(npm config get prefix)/bin
- $(npm config get prefix)/lib/node_modules
- $HOME/.npm
cache: npm
103 changes: 53 additions & 50 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,57 @@
#!/usr/bin/env node
var argv = require("optimist").usage("git-release-notes [<options>] <since>..<until> <template>")
.options("f", {
"alias": "file"
})
.options("p", {
"alias": "path",
"default": process.cwd()
})
.options("t", {
"alias": "title",
"default": "(.*)"
})
.boolean("i")
.alias("i", "ignore-case")
.options("m", {
"alias": "meaning",
"default": ['type']
})
.options("b", {
"alias": "branch",
"default": "master"
})
.options("s", {
"alias": "script"
})
.options("o", {
"alias": "gitlog-option",
"default" : []
})
.boolean("c")
.alias("c", "merge-commits")
.describe({
"f": "Configuration file",
"p": "Git project path",
"t": "Commit title regular expression",
"i": "Ignore case of title's regular expression",
"m": "Meaning of capturing block in title's regular expression",
"b": "Git branch, defaults to master",
"s": "External script to rewrite the commit history",
"c": "Only use merge commits",
"o": "Additional git log options AND ignore 'c' option"
})
.boolean("version")
.check(function (argv) {
if (argv._.length == 2) {
return true;
}
throw "Invalid parameters, please specify an interval and the template";
})
.argv;
var argv = require('yargs')
.usage('git-release-notes [<options>] <since>..<until> <template>')
.demandCommand(2)
.example(
'git-release-notes -t "(feat|bug): (.*)" -m type -m title v1.0.0..v2.0.0 markdown',
'Match all commits with starting with either `feat:` or `bug` between the tags `v1.0.0` and `v2.0.0`'
)
.wrap(null)
.option('f', {
alias: 'file',
describe: 'Configuration file. Use it instead of passing command line options'
})
.option('p', {
alias: 'path',
describe: 'Git project path. Defaults to the current path',
default: process.cwd(),
})
.option('t', {
alias: 'title',
describe: 'Commit title regular expression',
default: '(.*)',
})
.option('i', {
alias: 'ignore-case',
describe: 'Ignore case of title\'s regular expression',
type: 'boolean',
})
.option('m', {
alias: 'meaning',
describe: 'Meaning of capturing block in title\'s regular expression',
default: ['type'],
})
.option('b', {
alias: 'branch',
describe: 'Git branch, defaults to master',
default: 'master',
type: 'string',
})
.option('s', {
alias: 'script',
describe: 'External script to rewrite the commit history',
})
.option('o', {
alias: 'gitlog-option',
describe: 'Additional git log options AND ignore \'c\' option',
default: [],
})
.option('c', {
alias: 'merge-commits',
describe: 'Only use merge commits',
type: 'boolean',
})
.argv;

const index = require('./index');
index(argv, argv._[0], argv._[1])
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var git = require("./lib/git");
var ejs = require("ejs");
var debug = require("debug")("release-notes:cli");
var git = require('./lib/git');
var ejs = require('ejs');
var debug = require('debug')('release-notes:cli');
var fileSystem = require('./lib/file-system');
var processCommits = require('./lib/process').processCommits;
var dateFnsFormat = require('date-fns/format');
Expand Down
Loading

0 comments on commit a4a5a79

Please sign in to comment.