-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: separate cli and defaults from base functionality
The cli code now lives in cli.js, defaults in defaults.json and base functionality in index.js. As a result, standard-version can now be used as a library. See cli.js for usage. Calls to exec and handleExecError have been refactored into a single handledExec function that takes an error and success callback separately.
- Loading branch information
Showing
6 changed files
with
171 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env node | ||
var standardVersion = require('./index') | ||
var defaults = require('./defaults') | ||
|
||
var argv = require('yargs') | ||
.usage('Usage: $0 [options]') | ||
.option('infile', { | ||
alias: 'i', | ||
describe: 'Read the CHANGELOG from this file', | ||
default: defaults.infile, | ||
global: true | ||
}) | ||
.option('message', { | ||
alias: 'm', | ||
describe: 'Commit message, replaces %s with new version', | ||
type: 'string', | ||
default: defaults.message, | ||
global: true | ||
}) | ||
.option('first-release', { | ||
alias: 'f', | ||
describe: 'Is this the first release?', | ||
type: 'boolean', | ||
default: defaults.firstRelease, | ||
global: true | ||
}) | ||
.option('sign', { | ||
alias: 's', | ||
describe: 'Should the git commit and tag be signed?', | ||
type: 'boolean', | ||
default: defaults.sign, | ||
global: true | ||
}) | ||
.option('no-verify', { | ||
alias: 'n', | ||
describe: 'Bypass pre-commit or commit-msg git hooks during the commit phase', | ||
type: 'boolean', | ||
default: defaults.noVerify, | ||
global: true | ||
}) | ||
.help() | ||
.alias('help', 'h') | ||
.example('$0', 'Update changelog and tag release') | ||
.example('$0 -m "%s: see changelog for details"', 'Update changelog and tag release with custom commit message') | ||
.wrap(97) | ||
.argv | ||
|
||
standardVersion(argv, function (err) { | ||
if (err) { | ||
process.exit(1) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"infile": "CHANGELOG.md", | ||
"message": "chore(release): %s", | ||
"firstRelease": false, | ||
"sign": false, | ||
"noVerify": false, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.