@commitlint/prompt 8.3.5 → 8.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [8.3.6](https://github.com/conventional-changelog/commitlint/compare/v8.3.5...v8.3.6) (2021-11-17)
7
+
8
+ **Note:** Version bump only for package @commitlint/prompt
9
+
10
+
11
+
12
+
13
+
6
14
  ## [8.3.5](https://github.com/conventional-changelog/commitlint/compare/v8.3.4...v8.3.5) (2020-01-15)
7
15
 
8
16
  **Note:** Version bump only for package @commitlint/prompt
package/lib/index.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ import inquirer from 'inquirer';
2
+ declare type Commit = (input: string) => void;
3
+ /**
4
+ * Entry point for commitizen
5
+ * @param cz inquirer instance passed by commitizen, unused
6
+ * @param commit callback to execute with complete commit message
7
+ * @return {void}
8
+ */
9
+ export declare function prompter(cz: typeof inquirer, commit: Commit): void;
10
+ export {};
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAGhC,aAAK,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EAAE,EAAE,OAAO,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAIlE"}
package/lib/input.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import type { PromptModule } from 'inquirer';
2
+ /**
3
+ * Get user input by interactive prompt based on
4
+ * conventional-changelog-lint rules.
5
+ * @param prompter
6
+ * @return commit message
7
+ */
8
+ export declare function input(prompter: PromptModule): Promise<string>;
9
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../src/input.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,YAAY,EAAC,MAAM,UAAU,CAAC;AAU7D;;;;;GAKG;AACH,wBAAsB,KAAK,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAkCnE"}
@@ -0,0 +1,28 @@
1
+ /// <reference path="../../src/inquirer/inquirer.d.ts" />
2
+ /// <reference types="node" />
3
+ import inquirer from 'inquirer';
4
+ import InputPrompt from 'inquirer/lib/prompts/input';
5
+ import type { Interface as ReadlineInterface, Key } from 'readline';
6
+ import Answers = inquirer.Answers;
7
+ import InputCustomOptions = inquirer.InputCustomOptions;
8
+ import SuccessfulPromptStateData = inquirer.prompts.SuccessfulPromptStateData;
9
+ interface KeyDescriptor {
10
+ value: string;
11
+ key: Key;
12
+ }
13
+ export default class InputCustomPrompt<TQuestion extends InputCustomOptions = InputCustomOptions> extends InputPrompt<TQuestion> {
14
+ private lineSubscription;
15
+ private readonly tabCompletion;
16
+ constructor(question: TQuestion, readLine: ReadlineInterface, answers: Answers);
17
+ onEnd(state: SuccessfulPromptStateData): void;
18
+ /**
19
+ * @see https://nodejs.org/api/readline.html#readline_rl_write_data_key
20
+ * @see https://nodejs.org/api/readline.html#readline_rl_line
21
+ */
22
+ updateLine(line: string): void;
23
+ onKeyPress2(e: KeyDescriptor): void;
24
+ measureInput(input: string): number;
25
+ render(error?: string): void;
26
+ }
27
+ export {};
28
+ //# sourceMappingURL=InputCustomPrompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InputCustomPrompt.d.ts","sourceRoot":"","sources":["../../src/inquirer/InputCustomPrompt.ts"],"names":[],"mappings":";;AAEA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAErD,OAAO,KAAK,EAAC,SAAS,IAAI,iBAAiB,EAAE,GAAG,EAAC,MAAM,UAAU,CAAC;AAGlE,OAAO,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;AAClC,OAAO,kBAAkB,GAAG,QAAQ,CAAC,kBAAkB,CAAC;AACxD,OAAO,yBAAyB,GAAG,QAAQ,CAAC,OAAO,CAAC,yBAAyB,CAAC;AAE9E,UAAU,aAAa;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,GAAG,CAAC;CACT;AAED,MAAM,CAAC,OAAO,OAAO,iBAAiB,CACrC,SAAS,SAAS,kBAAkB,GAAG,kBAAkB,CACxD,SAAQ,WAAW,CAAC,SAAS,CAAC;IAC/B,OAAO,CAAC,gBAAgB,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAW;gBAGxC,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,OAAO;IAqBjB,KAAK,CAAC,KAAK,EAAE,yBAAyB,GAAG,IAAI;IAK7C;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAM9B,WAAW,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI;IAenC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAOnC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;CAgC5B"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ /// <reference path="./inquirer.d.ts" />
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const input_1 = __importDefault(require("inquirer/lib/prompts/input"));
9
+ const events_1 = __importDefault(require("inquirer/lib/utils/events"));
10
+ class InputCustomPrompt extends input_1.default {
11
+ constructor(question, readLine, answers) {
12
+ super(question, readLine, answers);
13
+ if (this.opt.log) {
14
+ this.rl.write(this.opt.log(answers));
15
+ }
16
+ if (!this.opt.maxLength) {
17
+ this.throwParamError('maxLength');
18
+ }
19
+ const events = (0, events_1.default)(this.rl);
20
+ this.lineSubscription = events.keypress.subscribe(this.onKeyPress2.bind(this));
21
+ this.tabCompletion = (this.opt.tabCompletion || [])
22
+ .map((item) => item.value)
23
+ .sort((a, b) => a.localeCompare(b));
24
+ }
25
+ onEnd(state) {
26
+ this.lineSubscription.unsubscribe();
27
+ super.onEnd(state);
28
+ }
29
+ /**
30
+ * @see https://nodejs.org/api/readline.html#readline_rl_write_data_key
31
+ * @see https://nodejs.org/api/readline.html#readline_rl_line
32
+ */
33
+ updateLine(line) {
34
+ this.rl.write(null, { ctrl: true, name: 'b' });
35
+ this.rl.write(null, { ctrl: true, name: 'd' });
36
+ this.rl.write(line.substr(this.rl.line.length));
37
+ }
38
+ onKeyPress2(e) {
39
+ if (e.key.name === 'tab' && this.tabCompletion.length > 0) {
40
+ let line = this.rl.line.trim();
41
+ if (line.length > 0) {
42
+ for (const item of this.tabCompletion) {
43
+ if (item.startsWith(line) && item !== line) {
44
+ line = item;
45
+ break;
46
+ }
47
+ }
48
+ }
49
+ this.updateLine(line);
50
+ }
51
+ }
52
+ measureInput(input) {
53
+ if (this.opt.filter) {
54
+ return this.opt.filter(input).length;
55
+ }
56
+ return input.length;
57
+ }
58
+ render(error) {
59
+ const answered = this.status === 'answered';
60
+ let message = this.getQuestion();
61
+ const length = this.measureInput(this.rl.line);
62
+ if (answered) {
63
+ message += chalk_1.default.cyan(this.answer);
64
+ }
65
+ else if (this.opt.transformer) {
66
+ message += this.opt.transformer(this.rl.line, this.answers, {});
67
+ }
68
+ let bottomContent = '';
69
+ if (error) {
70
+ bottomContent = chalk_1.default.red('>> ') + error;
71
+ }
72
+ else if (!answered) {
73
+ const maxLength = this.opt.maxLength(this.answers);
74
+ if (maxLength < Infinity) {
75
+ const lengthRemaining = maxLength - length;
76
+ const color = lengthRemaining <= 5
77
+ ? chalk_1.default.red
78
+ : lengthRemaining <= 10
79
+ ? chalk_1.default.yellow
80
+ : chalk_1.default.grey;
81
+ bottomContent = color(`${lengthRemaining} characters left`);
82
+ }
83
+ }
84
+ this.screen.render(message, bottomContent);
85
+ }
86
+ }
87
+ exports.default = InputCustomPrompt;
88
+ //# sourceMappingURL=InputCustomPrompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InputCustomPrompt.js","sourceRoot":"","sources":["../../src/inquirer/InputCustomPrompt.ts"],"names":[],"mappings":";;;;;AAAA,wCAAwC;AACxC,kDAA0B;AAE1B,uEAAqD;AACrD,uEAAgD;AAahD,MAAqB,iBAEnB,SAAQ,eAAsB;IAI/B,YACC,QAAmB,EACnB,QAA2B,EAC3B,OAAgB;QAEhB,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAEnC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;YACjB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;SACrC;QAED,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE;YACxB,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;SAClC;QAED,MAAM,MAAM,GAAG,IAAA,gBAAO,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAChC,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC,SAAS,CAChD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAC3B,CAAC;QACF,IAAI,CAAC,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC;aACjD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;aACzB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,C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AAC,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC5C,CAAC;CACD;AAnGD,oCAmGC"}
@@ -0,0 +1,9 @@
1
+ import type { Result } from './types';
2
+ /**
3
+ * Get formatted commit message
4
+ * @param input object containing structured results
5
+ * @param debug show debug information in commit message
6
+ * @return formatted debug message
7
+ */
8
+ export default function format(input: Result, debug?: boolean): string;
9
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/library/format.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAa,MAAM,SAAS,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,MAAM,CA4BnE"}
@@ -0,0 +1,8 @@
1
+ import type { RuleEntry } from './types';
2
+ /**
3
+ * Get forced case for rule
4
+ * @param rule to parse
5
+ * @return transform function applying the enforced case
6
+ */
7
+ export default function getForcedCaseFn(rule?: RuleEntry): (input: string) => string;
8
+ //# sourceMappingURL=get-forced-case-fn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-forced-case-fn.d.ts","sourceRoot":"","sources":["../../src/library/get-forced-case-fn.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAGvC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACtC,IAAI,CAAC,EAAE,SAAS,GACd,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAc3B"}
@@ -0,0 +1,8 @@
1
+ import type { RuleEntry } from './types';
2
+ /**
3
+ * Get forced leading for rule
4
+ * @param rule to parse
5
+ * @return transform function applying the leading
6
+ */
7
+ export default function getForcedLeadingFn(rule?: RuleEntry): (input: string) => string;
8
+ //# sourceMappingURL=get-forced-leading-fn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-forced-leading-fn.d.ts","sourceRoot":"","sources":["../../src/library/get-forced-leading-fn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAGvC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACzC,IAAI,CAAC,EAAE,SAAS,GACd,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAe3B"}
@@ -0,0 +1,11 @@
1
+ import type { InputCustomOptions } from 'inquirer';
2
+ import type { InputSetting, RuleEntry, Result, ResultPart } from './types';
3
+ /**
4
+ * Get a cli prompt based on rule configuration
5
+ * @param type type of the data to gather
6
+ * @param rules
7
+ * @param settings
8
+ * @return prompt instance
9
+ */
10
+ export default function getPrompt(type: ResultPart, rules?: RuleEntry[], settings?: InputSetting): InputCustomOptions<Result> | null;
11
+ //# sourceMappingURL=get-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-prompt.d.ts","sourceRoot":"","sources":["../../src/library/get-prompt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAEjD,OAAO,KAAK,EAAC,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAC,MAAM,SAAS,CAAC;AAiBzE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAChC,IAAI,EAAE,UAAU,EAChB,KAAK,GAAE,SAAS,EAAO,EACvB,QAAQ,GAAE,YAAiB,GACzB,kBAAkB,CAAC,MAAM,CAAC,GAAG,IAAI,CA2FnC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Get formatted meta hints for configuration
3
+ * @param settings dictionary to parse
4
+ * @return formatted meta information
5
+ */
6
+ export default function meta(settings: Record<string, unknown>): string;
7
+ //# sourceMappingURL=meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/library/meta.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAUtE"}
@@ -0,0 +1,15 @@
1
+ import type { RuleConfigCondition, RuleConfigSeverity } from '@commitlint/types';
2
+ export declare type RuleEntry = [string, Readonly<[RuleConfigSeverity.Disabled]>] | [string, Readonly<[RuleConfigSeverity, RuleConfigCondition]>] | [string, Readonly<[RuleConfigSeverity, RuleConfigCondition, unknown]>];
3
+ export declare type InputSetting = {
4
+ description?: string;
5
+ enumerables?: Record<string, {
6
+ description: string;
7
+ }>;
8
+ multiline?: boolean;
9
+ header?: {
10
+ length?: number;
11
+ };
12
+ };
13
+ export declare type ResultPart = 'type' | 'scope' | 'subject' | 'body' | 'footer';
14
+ export declare type Result = Partial<Record<ResultPart, string | undefined>>;
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/library/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAE/E,oBAAY,SAAS,GAClB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC,GACjD,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAC7D,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AAE1E,oBAAY,YAAY,GAAG;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CACnB,MAAM,EACN;QACC,WAAW,EAAE,MAAM,CAAC;KACpB,CACD,CAAC;IACF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACF,CAAC;AAEF,oBAAY,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1E,oBAAY,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/library/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,54 @@
1
+ import { RuleConfigSeverity } from '@commitlint/types';
2
+ import type { QualifiedRules } from '@commitlint/types';
3
+ import type { RuleEntry } from './types';
4
+ /**
5
+ * Get name for a given rule id
6
+ * @param id of the rule
7
+ * @return name of the rule
8
+ */
9
+ export declare function getRuleName(id: string): string;
10
+ /**
11
+ * Get prefix for a given rule id
12
+ * @param id of the rule
13
+ * @return prefix of the rule
14
+ */
15
+ export declare function getRulePrefix(id: string): string | null;
16
+ /**
17
+ * Get a predicate matching rule definitions with a given name
18
+ */
19
+ export declare function getHasName(name: string): <T extends RuleEntry>(rule: RuleEntry) => rule is Exclude<T, [string, undefined]>;
20
+ /**
21
+ * Check if a rule definition is active
22
+ * @param rule to check
23
+ * @return if the rule definition is active
24
+ */
25
+ export declare function ruleIsActive<T extends RuleEntry>(rule: T): rule is Exclude<T, [string, Readonly<[RuleConfigSeverity.Disabled]>]>;
26
+ /**
27
+ * Check if a rule definition is applicable
28
+ * @param rule to check
29
+ * @return if the rule definition is applicable
30
+ */
31
+ export declare function ruleIsApplicable(rule: RuleEntry): rule is [string, Readonly<[RuleConfigSeverity, 'always']>] | [string, Readonly<[RuleConfigSeverity, 'always', unknown]>];
32
+ /**
33
+ * Check if a rule definition is applicable
34
+ * @param rule to check
35
+ * @return if the rule definition is applicable
36
+ */
37
+ export declare function ruleIsNotApplicable(rule: RuleEntry): rule is [string, Readonly<[RuleConfigSeverity, 'never']>] | [string, Readonly<[RuleConfigSeverity, 'never', unknown]>];
38
+ export declare function enumRuleIsActive(rule: RuleEntry): rule is [
39
+ string,
40
+ Readonly<[
41
+ RuleConfigSeverity.Warning | RuleConfigSeverity.Error,
42
+ 'always',
43
+ string[]
44
+ ]>
45
+ ];
46
+ /**
47
+ * Get rules for a given prefix
48
+ * @param prefix to search in rule names
49
+ * @param rules rules to search in
50
+ * @return rules matching the prefix search
51
+ */
52
+ export declare function getRules(prefix: string, rules: QualifiedRules): RuleEntry[];
53
+ export declare function getMaxLength(rule?: RuleEntry): number;
54
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/library/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAEvC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAG9C;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGvD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,+BAE/B,SAAS,6CAEhB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,SAAS,EAC/C,IAAI,EAAE,CAAC,GACL,IAAI,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAMvE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,SAAS,GACb,IAAI,IACJ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC,CAAC,GAClD,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,kBAAkB,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAM7D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,SAAS,GACb,IAAI,IACJ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,CAAC,GACjD,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,kBAAkB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAM5D;AAED,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,SAAS,GACb,IAAI,IAAI;IACV,MAAM;IACN,QAAQ,CACP;QAAC,kBAAkB,CAAC,OAAO,GAAG,kBAAkB,CAAC,KAAK;QAAE,QAAQ;QAAE,MAAM,EAAE;KAAC,CAC3E;CACD,CAOA;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,SAAS,EAAE,CAI3E;AAED,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,CAUrD"}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMaxLength = exports.getRules = exports.enumRuleIsActive = exports.ruleIsNotApplicable = exports.ruleIsApplicable = exports.ruleIsActive = exports.getHasName = exports.getRulePrefix = exports.getRuleName = void 0;
4
+ const types_1 = require("@commitlint/types");
5
+ /**
6
+ * Get name for a given rule id
7
+ * @param id of the rule
8
+ * @return name of the rule
9
+ */
10
+ function getRuleName(id) {
11
+ const fragments = id.split('-');
12
+ return fragments.length > 1 ? fragments.slice(1).join('-') : fragments[0];
13
+ }
14
+ exports.getRuleName = getRuleName;
15
+ /**
16
+ * Get prefix for a given rule id
17
+ * @param id of the rule
18
+ * @return prefix of the rule
19
+ */
20
+ function getRulePrefix(id) {
21
+ const fragments = id.split('-');
22
+ return fragments.length > 1 ? fragments[0] : null;
23
+ }
24
+ exports.getRulePrefix = getRulePrefix;
25
+ /**
26
+ * Get a predicate matching rule definitions with a given name
27
+ */
28
+ function getHasName(name) {
29
+ return (rule) => getRuleName(rule[0]) === name;
30
+ }
31
+ exports.getHasName = getHasName;
32
+ /**
33
+ * Check if a rule definition is active
34
+ * @param rule to check
35
+ * @return if the rule definition is active
36
+ */
37
+ function ruleIsActive(rule) {
38
+ const [, value] = rule;
39
+ if (value && Array.isArray(value)) {
40
+ return value[0] > types_1.RuleConfigSeverity.Disabled;
41
+ }
42
+ return false;
43
+ }
44
+ exports.ruleIsActive = ruleIsActive;
45
+ /**
46
+ * Check if a rule definition is applicable
47
+ * @param rule to check
48
+ * @return if the rule definition is applicable
49
+ */
50
+ function ruleIsApplicable(rule) {
51
+ const [, value] = rule;
52
+ if (value && Array.isArray(value)) {
53
+ return value[1] === 'always';
54
+ }
55
+ return false;
56
+ }
57
+ exports.ruleIsApplicable = ruleIsApplicable;
58
+ /**
59
+ * Check if a rule definition is applicable
60
+ * @param rule to check
61
+ * @return if the rule definition is applicable
62
+ */
63
+ function ruleIsNotApplicable(rule) {
64
+ const [, value] = rule;
65
+ if (value && Array.isArray(value)) {
66
+ return value[1] === 'never';
67
+ }
68
+ return false;
69
+ }
70
+ exports.ruleIsNotApplicable = ruleIsNotApplicable;
71
+ function enumRuleIsActive(rule) {
72
+ return (ruleIsActive(rule) &&
73
+ ruleIsApplicable(rule) &&
74
+ Array.isArray(rule[1][2]) &&
75
+ rule[1][2].length > 0);
76
+ }
77
+ exports.enumRuleIsActive = enumRuleIsActive;
78
+ /**
79
+ * Get rules for a given prefix
80
+ * @param prefix to search in rule names
81
+ * @param rules rules to search in
82
+ * @return rules matching the prefix search
83
+ */
84
+ function getRules(prefix, rules) {
85
+ return Object.entries(rules).filter((rule) => getRulePrefix(rule[0]) === prefix);
86
+ }
87
+ exports.getRules = getRules;
88
+ function getMaxLength(rule) {
89
+ if (rule &&
90
+ ruleIsActive(rule) &&
91
+ ruleIsApplicable(rule) &&
92
+ typeof rule[1][2] === 'number') {
93
+ return rule[1][2];
94
+ }
95
+ return Infinity;
96
+ }
97
+ exports.getMaxLength = getMaxLength;
98
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/library/utils.ts"],"names":[],"mappings":";;;AAAA,6CAAqD;AAIrD;;;;GAIG;AACH,SAAgB,WAAW,CAAC,EAAU;IACrC,MAAM,SAAS,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3E,CAAC;AAHD,kCAGC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,EAAU;IACvC,MAAM,SAAS,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC;AAHD,sCAGC;AAED;;GAEG;AACH,SAAgB,UAAU,CAAC,IAAY;IACtC,OAAO,CACN,IAAe,EAC2B,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAC7E,CAAC;AAJD,gCAIC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAC3B,IAAO;IAEP,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;I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AC,KAAK,MAAM,CAC9D,CAAC;AACH,CAAC;AAJD,4BAIC;AAED,SAAgB,YAAY,CAAC,IAAgB;IAC5C,IACC,IAAI;QACJ,YAAY,CAAC,IAAI,CAAC;QAClB,gBAAgB,CAAC,IAAI,CAAC;QACtB,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,EAC7B;QACD,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAClB;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC;AAVD,oCAUC"}
@@ -0,0 +1,56 @@
1
+ declare const _default: {
2
+ type: {
3
+ description: string;
4
+ enumerables: {
5
+ feat: {
6
+ description: string;
7
+ };
8
+ fix: {
9
+ description: string;
10
+ };
11
+ chore: {
12
+ description: string;
13
+ };
14
+ docs: {
15
+ description: string;
16
+ };
17
+ style: {
18
+ description: string;
19
+ };
20
+ refactor: {
21
+ description: string;
22
+ };
23
+ perf: {
24
+ description: string;
25
+ };
26
+ test: {
27
+ description: string;
28
+ };
29
+ build: {
30
+ description: string;
31
+ };
32
+ ci: {
33
+ description: string;
34
+ };
35
+ revert: {
36
+ description: string;
37
+ };
38
+ };
39
+ };
40
+ scope: {
41
+ description: string;
42
+ };
43
+ subject: {
44
+ description: string;
45
+ };
46
+ body: {
47
+ description: string;
48
+ multiline: boolean;
49
+ };
50
+ footer: {
51
+ description: string;
52
+ multiline: boolean;
53
+ };
54
+ };
55
+ export default _default;
56
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBAuDE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commitlint/prompt",
3
- "version": "8.3.5",
3
+ "version": "8.3.6",
4
4
  "description": "commitizen prompt using commitlint.config.js",
5
5
  "main": "./lib/index.js",
6
6
  "files": [
@@ -55,7 +55,7 @@
55
55
  },
56
56
  "homepage": "https://github.com/conventional-changelog/commitlint#readme",
57
57
  "devDependencies": {
58
- "@commitlint/utils": "^8.3.4",
58
+ "@commitlint/utils": "^8.3.6",
59
59
  "ava": "0.20.0",
60
60
  "babel-cli": "6.26.0",
61
61
  "babel-preset-commitlint": "^8.2.0",
@@ -65,12 +65,12 @@
65
65
  "cross-env": "6.0.3"
66
66
  },
67
67
  "dependencies": {
68
- "@commitlint/load": "^8.3.5",
68
+ "@commitlint/load": "^8.3.6",
69
69
  "babel-runtime": "^6.23.0",
70
70
  "chalk": "^2.0.0",
71
- "lodash": "4.17.15",
71
+ "lodash": "4.17.21",
72
72
  "throat": "^5.0.0",
73
73
  "vorpal": "^1.12.0"
74
74
  },
75
- "gitHead": "b39e1ade668e1560cdebc94c4fe18a6dba5e5dda"
75
+ "gitHead": "9ef77c205ce9338850b15374fd003f2052211803"
76
76
  }