Skip to content

Commit

Permalink
Merge pull request #31 from brownbl1/add-no-verify
Browse files Browse the repository at this point in the history
add --no-verify switch
  • Loading branch information
JamesMessinger authored Feb 26, 2019
2 parents 17e9dee + 185d25e commit 6bf2348
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions bin/bump.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ program
.option("--prompt", "Prompt for type of bump (patch, minor, major, premajor, prerelase, etc.)")
.option("--preid <name>", 'The identifier for prerelease versions (default is "beta")')
.option("--commit [message]", 'Commit changed files to Git (default message is "release vX.X.X")')
.option("--no-verify", "Bypasses the pre-commit and commit-msg hooks")
.option("--tag", "Tag the commit in Git")
.option("--push", "Push the Git commit")
.option("--all", "Commit/tag/push ALL pending files, not just the ones changed by bump")
Expand Down
3 changes: 3 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ function git (manifests, options) {

// Git Commit
let commitArgs = ["commit"];
if (!options.verify) {
commitArgs.push("--no-verify");
}
commitArgs = commitArgs.concat(options.all ? "-a" : manifests);
let commitMessage = "release v" + newVersion;
if (options.commitMessage) {
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Options:
--prompt Prompt for type of bump (patch, minor, major, premajor, prerelase, etc.)
--preid <name> The identifier for prerelease versions (default is "beta")
--commit [message] Commit changed files to Git (default message is "release vX.X.X")
--no-verify Bypasses the pre-commit and commit-msg hooks
--tag Tag the commit in Git
--push Push the Git commit
--all Commit/tag/push ALL pending files, not just the ones changed by bump
Expand Down
19 changes: 19 additions & 0 deletions test/specs/commit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,25 @@ describe("bump --commit", () => {
git[0].cmd.should.equal('git commit -a -m "release v1.1.0"');
});

it("should commit without running pre-commit hooks", () => {
files.create("package.json", { version: "1.0.0" });

let bump = chaiExec("--minor --commit --all --no-verify");

bump.stderr.should.be.empty;
bump.should.have.exitCode(0);

bump.should.have.stdout(
`${check} Updated package.json to 1.1.0\n` +
`${check} Git commit\n`
);

let git = mocks.git();
git.length.should.equal(1);

git[0].cmd.should.equal('git commit --no-verify -a -m "release v1.1.0"');
});

it("should commit the manifest files to git with a message", () => {
files.create("package.json", { version: "1.0.0" });

Expand Down

0 comments on commit 6bf2348

Please sign in to comment.