Skip to content

Commit 902bc4b

Browse files
Added the "--no-verify" option
1 parent 6114d04 commit 902bc4b

5 files changed

Lines changed: 36 additions & 2 deletions

File tree

src/cli/help.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ options:
3333
-p, --push Push the Git commit.
3434
3535
-a, --all Commit/tag/push ALL pending files,
36-
not just the ones changed by bump (git commit -a)
36+
not just the ones that were bumped.
37+
(same as "git commit -a")
38+
39+
--no-verify Bypass Git commit hooks
40+
(same as "git commit --no-verify")
3741
3842
-v, --version Show the version number
3943

src/cli/parse-args.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export function parseArgs(argv: string[]): ParsedArgs {
2323
{ name: "tag", alias: "t", type: String },
2424
{ name: "push", alias: "p", type: Boolean },
2525
{ name: "all", alias: "a", type: Boolean },
26+
{ name: "no-verify", type: Boolean },
2627
{ name: "version", alias: "v", type: Boolean },
2728
{ name: "help", alias: "h", type: Boolean },
2829
{ name: "files", type: String, multiple: true, defaultOption: true },
@@ -39,6 +40,7 @@ export function parseArgs(argv: string[]): ParsedArgs {
3940
tag: args.tag as string | boolean,
4041
push: args.push as boolean,
4142
all: args.all as boolean,
43+
noVerify: args["no-verify"] as boolean,
4244
files: args.files as string[],
4345
}
4446
};

src/options.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export class Options {
2424
};
2525
public push!: boolean;
2626
public all!: boolean;
27+
public noVerify!: boolean;
2728
public files!: string[];
2829
public cwd!: string;
2930
public interface!: Interface;
@@ -44,6 +45,7 @@ export class Options {
4445
let preid = typeof raw.preid === "string" ? raw.preid : "beta";
4546
let push = Boolean(raw.push);
4647
let all = Boolean(raw.all);
48+
let noVerify = Boolean(raw.noVerify);
4749
let cwd = raw.cwd || process.cwd();
4850

4951
let release: Release;
@@ -104,7 +106,7 @@ export class Options {
104106
}
105107

106108
return new Options({
107-
release, preid, commit, tag, push, all, files, cwd, interface: ui
109+
release, preid, commit, tag, push, all, noVerify, files, cwd, interface: ui
108110
});
109111
}
110112
}

src/version-bump-options.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ export interface VersionBumpOptions {
5252
*/
5353
all?: boolean;
5454

55+
/**
56+
* Indicates whether to bypass git commit hooks (`git commit --noverify`).
57+
*
58+
* Defaults to `false`.
59+
*/
60+
noVerify?: boolean;
61+
5562
/**
5663
* The files to be updated. For certain known files ("package.json", "bower.json", etc.)
5764
* `versionBump()` will explicitly update the file's version number. For other files

test/specs/git-commit.spec.js

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

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

0 commit comments

Comments
 (0)