Comparing version 1.0.2 to 1.0.3
@@ -5,2 +5,13 @@ # Changelog | ||
### [1.0.3](https://github.com/Zhengqbbb/cz-git/compare/v1.0.2...v1.0.3) (2022-02-19) | ||
### ⚠ BREAKING CHANGES | ||
* **cz-git:** e.g: { value: "cz-git", name: "cz-git: core control" } | ||
### Features | ||
* **cz-git:** scopes config support value to add descrition for selector ([980f163](https://github.com/Zhengqbbb/cz-git/commit/980f1631d00a68a9a328319c0f8d3523c5e3e0e2)), closes [#1](https://github.com/Zhengqbbb/cz-git/issues/1) | ||
### [1.0.2](https://github.com/Zhengqbbb/cz-git/compare/v1.0.1...v1.0.2) (2022-02-18) | ||
@@ -7,0 +18,0 @@ |
@@ -6,2 +6,3 @@ /** | ||
*/ | ||
import { Option } from "./share"; | ||
import type { Answers, CommitizenGitOptions } from "./share"; | ||
@@ -21,5 +22,3 @@ export declare const generateOptions: (clConfig: any) => CommitizenGitOptions; | ||
message: string | undefined; | ||
source: (answer: Answers, input: string) => { | ||
name: string; | ||
}[]; | ||
source: (answer: Answers, input: string) => Option[]; | ||
default?: undefined; | ||
@@ -26,0 +25,0 @@ transformer?: undefined; |
@@ -66,6 +66,6 @@ "use strict"; | ||
if (options.scopeOverrides && answer.type && options.scopeOverrides[answer.type]) { | ||
scopes = scopes.concat(options.scopeOverrides[answer.type]); | ||
scopes = scopes.concat((0, until_1.handleScopes)(options.scopeOverrides[answer.type])); | ||
} | ||
else if (Array.isArray(options.scopes)) { | ||
scopes = scopes.concat(options.scopes); | ||
scopes = scopes.concat((0, until_1.handleScopes)(options.scopes)); | ||
} | ||
@@ -78,4 +78,4 @@ if (options.allowCustomScopes || scopes.length === 0) { | ||
// TODO: option | ||
{ name: "empty", value: false }, | ||
{ name: "custom", value: "custom" } | ||
{ value: false, name: "empty" }, | ||
{ value: "custom", name: "custom" } | ||
]); | ||
@@ -189,3 +189,3 @@ } | ||
return answers.footerPrefixsSelect === "custom"; | ||
}, | ||
} | ||
}, | ||
@@ -192,0 +192,0 @@ { |
@@ -13,3 +13,3 @@ /** | ||
export declare type Config = Omit<Partial<typeof defaultConfig>, "scopes"> & { | ||
scopes: TypesOption[]; | ||
scopes: ScopesType; | ||
disableScopeLowerCase?: boolean; | ||
@@ -66,2 +66,6 @@ disableSubjectLowerCase?: boolean; | ||
}; | ||
export declare type ScopesType = string[] | Array<{ | ||
name: string; | ||
value?: string; | ||
}>; | ||
export interface CommitizenType { | ||
@@ -71,3 +75,3 @@ registerPrompt: (type: string, plugin: unknown) => void; | ||
} | ||
interface Option { | ||
export interface Option { | ||
/** | ||
@@ -107,5 +111,3 @@ * @description: show prompt name | ||
*/ | ||
scopes?: Array<{ | ||
name: string; | ||
}>; | ||
scopes?: ScopesType; | ||
/** | ||
@@ -116,5 +118,3 @@ * @description: Provides an overriding select of prompt to select module scopes under specific typs | ||
scopeOverrides?: { | ||
[type: string]: Array<{ | ||
name: string; | ||
}>; | ||
[type: string]: ScopesType; | ||
}; | ||
@@ -185,2 +185,1 @@ /** | ||
export declare const defaultConfig: Readonly<CommitizenGitOptions>; | ||
export {}; |
@@ -33,3 +33,3 @@ "use strict"; | ||
useEmoji: false, | ||
scopes: [{ name: 'READEME' }, { name: 'theme' }, { name: 'module' }, { name: 'plugin' }], | ||
scopes: [], | ||
allowCustomScopes: true, | ||
@@ -36,0 +36,0 @@ allowBreakingChanges: ['feat', 'fix'], |
@@ -5,3 +5,3 @@ /** | ||
import { RuleConfigCondition, RuleConfigSeverity } from "@commitlint/types"; | ||
import { Answers, CommitizenGitOptions } from "./share"; | ||
import { Answers, CommitizenGitOptions, Option, ScopesType } from "./share"; | ||
export declare type Rule = Readonly<[RuleConfigSeverity.Disabled]> | Readonly<[RuleConfigSeverity, RuleConfigCondition]> | Readonly<[RuleConfigSeverity, RuleConfigCondition, unknown]>; | ||
@@ -29,3 +29,9 @@ /** | ||
export declare const getMaxSubjectLength: (type: Answers["type"], scope: Answers["scope"], options: CommitizenGitOptions) => number; | ||
/** | ||
* @description: handle scope configuration option into standard options | ||
* @param {ScopesType} | ||
* @returns {Option[]} | ||
*/ | ||
export declare const handleScopes: (scopes: ScopesType) => Option[]; | ||
export declare const buildCommit: (answers: Answers, options: CommitizenGitOptions, color?: boolean) => string; | ||
export declare const editCommit: (answers: Answers, options: CommitizenGitOptions, cb: (message: string) => void) => void; |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __read = (this && this.__read) || function (o, n) { | ||
@@ -22,3 +33,3 @@ var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.editCommit = exports.buildCommit = exports.getMaxSubjectLength = exports.getProcessSubject = exports.getPreparedCommit = exports.log = exports.getMinLength = exports.getMaxLength = exports.ruleIsApplicable = exports.ruleIsActive = void 0; | ||
exports.editCommit = exports.buildCommit = exports.handleScopes = exports.getMaxSubjectLength = exports.getProcessSubject = exports.getPreparedCommit = exports.log = exports.getMinLength = exports.getMaxLength = exports.ruleIsApplicable = exports.ruleIsActive = void 0; | ||
/** | ||
@@ -122,2 +133,16 @@ * @from: @commitlint/cz-commitlint/src/utils/rules.ts | ||
exports.getMaxSubjectLength = getMaxSubjectLength; | ||
/** | ||
* @description: handle scope configuration option into standard options | ||
* @param {ScopesType} | ||
* @returns {Option[]} | ||
*/ | ||
var handleScopes = function (scopes) { | ||
return scopes.map(function (scope) { | ||
return typeof scope === "string" | ||
? { name: scope, value: scope } | ||
: !scope.value | ||
? __assign({ value: scope.name }, scope) : { value: scope.value, name: scope.name }; | ||
}); | ||
}; | ||
exports.handleScopes = handleScopes; | ||
var addType = function (type, options, color) { | ||
@@ -124,0 +149,0 @@ var _a; |
{ | ||
"name": "cz-git", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A better customizable and git support commitizen adapter", | ||
"keywords": [ | ||
"commitizen-adapter", | ||
"cli", | ||
"cz-cli", | ||
"cz-git", | ||
@@ -11,3 +13,2 @@ "cz-gitee", | ||
"customizable", | ||
"cz-cli", | ||
"cz-customizable" | ||
@@ -35,3 +36,4 @@ ], | ||
"prepare": "husky install", | ||
"release": "standard-version", | ||
"prerelease": "yarn lint", | ||
"release": "standard-version --release-as patch", | ||
"release-as": "standard-version --release-as" | ||
@@ -38,0 +40,0 @@ }, |
43312
839