Skip to content

Commit 6bf2348

Browse files
Merge pull request #31 from brownbl1/add-no-verify
add --no-verify switch
2 parents 17e9dee + 185d25e commit 6bf2348

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

bin/bump.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ program
1919
.option("--prompt", "Prompt for type of bump (patch, minor, major, premajor, prerelase, etc.)")
2020
.option("--preid <name>", 'The identifier for prerelease versions (default is "beta")')
2121
.option("--commit [message]", 'Commit changed files to Git (default message is "release vX.X.X")')
22+
.option("--no-verify", "Bypasses the pre-commit and commit-msg hooks")
2223
.option("--tag", "Tag the commit in Git")
2324
.option("--push", "Push the Git commit")
2425
.option("--all", "Commit/tag/push ALL pending files, not just the ones changed by bump")

lib/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ function git (manifests, options) {
192192

193193
// Git Commit
194194
let commitArgs = ["commit"];
195+
if (!options.verify) {
196+
commitArgs.push("--no-verify");
197+
}
195198
commitArgs = commitArgs.concat(options.all ? "-a" : manifests);
196199
let commitMessage = "release v" + newVersion;
197200
if (options.commitMessage) {

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Options:
5858
--prompt Prompt for type of bump (patch, minor, major, premajor, prerelase, etc.)
5959
--preid <name> The identifier for prerelease versions (default is "beta")
6060
--commit [message] Commit changed files to Git (default message is "release vX.X.X")
61+
--no-verify Bypasses the pre-commit and commit-msg hooks
6162
--tag Tag the commit in Git
6263
--push Push the Git commit
6364
--all Commit/tag/push ALL pending files, not just the ones changed by bump

test/specs/commit.spec.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,25 @@ describe("bump --commit", () => {
6868
git[0].cmd.should.equal('git commit -a -m "release v1.1.0"');
6969
});
7070

71+
it("should commit without running pre-commit hooks", () => {
72+
files.create("package.json", { version: "1.0.0" });
73+
74+
let bump = chaiExec("--minor --commit --all --no-verify");
75+
76+
bump.stderr.should.be.empty;
77+
bump.should.have.exitCode(0);
78+
79+
bump.should.have.stdout(
80+
`${check} Updated package.json to 1.1.0\n` +
81+
`${check} Git commit\n`
82+
);
83+
84+
let git = mocks.git();
85+
git.length.should.equal(1);
86+
87+
git[0].cmd.should.equal('git commit --no-verify -a -m "release v1.1.0"');
88+
});
89+
7190
it("should commit the manifest files to git with a message", () => {
7291
files.create("package.json", { version: "1.0.0" });
7392

0 commit comments

Comments
 (0)