@cenk1cenk2/cz-cc 2.1.5 → 2.2.1
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/dist/index.cjs +190 -0
- package/package.json +12 -12
- package/dist/engine-CrSYYpPU.js +0 -1
- package/dist/engine.js +0 -1
- package/dist/index.js +0 -1
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
let commitizen = require("commitizen");
|
|
29
|
+
let conventional_commit_types = require("conventional-commit-types");
|
|
30
|
+
conventional_commit_types = __toESM(conventional_commit_types);
|
|
31
|
+
let _listr2_prompt_adapter_inquirer = require("@listr2/prompt-adapter-inquirer");
|
|
32
|
+
let find_git_root = require("find-git-root");
|
|
33
|
+
find_git_root = __toESM(find_git_root);
|
|
34
|
+
let fs = require("fs");
|
|
35
|
+
fs = __toESM(fs);
|
|
36
|
+
let listr2 = require("listr2");
|
|
37
|
+
let os = require("os");
|
|
38
|
+
let path = require("path");
|
|
39
|
+
let _inquirer_prompts = require("@inquirer/prompts");
|
|
40
|
+
|
|
41
|
+
//#region src/engine.js
|
|
42
|
+
function engine_default(options) {
|
|
43
|
+
return { prompter(cz, commit) {
|
|
44
|
+
new listr2.Listr([
|
|
45
|
+
{
|
|
46
|
+
enabled: () => {
|
|
47
|
+
const gitRoot = (0, find_git_root.default)(process.cwd());
|
|
48
|
+
const commitMsg = (0, path.join)(gitRoot, "COMMIT_EDITMSG");
|
|
49
|
+
if (gitRoot) try {
|
|
50
|
+
const lastCommit = fs.default.readFileSync(commitMsg, "utf-8");
|
|
51
|
+
if ((/* @__PURE__ */ new RegExp(/^Merge branch/)).test(lastCommit)) return true;
|
|
52
|
+
} catch {}
|
|
53
|
+
},
|
|
54
|
+
task: async (ctx, task) => {
|
|
55
|
+
if (await task.prompt(_listr2_prompt_adapter_inquirer.ListrInquirerPromptAdapter).run(_inquirer_prompts.confirm, {
|
|
56
|
+
message: "Last commit was found as merge commit do you want to skip?",
|
|
57
|
+
default: true
|
|
58
|
+
})) throw new Error("Skipping because of merge commit.");
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{ task: async (ctx, task) => {
|
|
62
|
+
const choices = Object.entries(options.types).map(([key, type]) => {
|
|
63
|
+
return {
|
|
64
|
+
name: key,
|
|
65
|
+
description: type.description,
|
|
66
|
+
value: key
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
ctx.prompts.type = await task.prompt(_listr2_prompt_adapter_inquirer.ListrInquirerPromptAdapter).run(_inquirer_prompts.select, {
|
|
70
|
+
message: "Type of commit:",
|
|
71
|
+
choices,
|
|
72
|
+
default: options.defaultType
|
|
73
|
+
});
|
|
74
|
+
ctx.prompts.subject = await task.prompt(_listr2_prompt_adapter_inquirer.ListrInquirerPromptAdapter).run(_inquirer_prompts.input, {
|
|
75
|
+
message: "Write a short description:",
|
|
76
|
+
default: options.defaultSubject,
|
|
77
|
+
required: true
|
|
78
|
+
});
|
|
79
|
+
ctx.prompts.additional = await task.prompt(_listr2_prompt_adapter_inquirer.ListrInquirerPromptAdapter).run(_inquirer_prompts.checkbox, {
|
|
80
|
+
message: "Please select additional actions.",
|
|
81
|
+
choices: [
|
|
82
|
+
{
|
|
83
|
+
name: "scope",
|
|
84
|
+
value: "scope",
|
|
85
|
+
description: "Add a scope to the commit message."
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "issue",
|
|
89
|
+
value: "issue",
|
|
90
|
+
description: "Resolve Issues by additional comments."
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "breaking-changes",
|
|
94
|
+
value: "breaking-changes",
|
|
95
|
+
description: "Note breaking changes in the commit message."
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "long-description",
|
|
99
|
+
value: "long-description",
|
|
100
|
+
description: "Add a long description to the commit message."
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "skip-ci",
|
|
104
|
+
value: "skip-ci",
|
|
105
|
+
description: "Skip CI/CD setups."
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
});
|
|
109
|
+
} },
|
|
110
|
+
{ task: (ctx, task) => task.newListr([
|
|
111
|
+
{
|
|
112
|
+
skip: (ctx$1) => !ctx$1.prompts.additional.includes("scope"),
|
|
113
|
+
task: async (ctx$1, task$1) => {
|
|
114
|
+
ctx$1.prompts.scope = await task$1.prompt(_listr2_prompt_adapter_inquirer.ListrInquirerPromptAdapter).run(_inquirer_prompts.input, {
|
|
115
|
+
message: "Please state the scope of the change:",
|
|
116
|
+
default: options.defaultScope,
|
|
117
|
+
transformer: (value) => {
|
|
118
|
+
return options.disableScopeLowerCase ? value.trim() : value.trim().toLowerCase();
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
skip: (ctx$1) => !ctx$1.prompts.additional.some((property) => ["long-description"].includes(property)),
|
|
125
|
+
task: async (ctx$1, task$1) => {
|
|
126
|
+
ctx$1.prompts.body = await task$1.prompt(_listr2_prompt_adapter_inquirer.ListrInquirerPromptAdapter).run(_inquirer_prompts.editor, {
|
|
127
|
+
message: "Please give a long description:",
|
|
128
|
+
default: options.defaultBody
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
skip: (ctx$1) => !ctx$1.prompts.additional.includes("issue"),
|
|
134
|
+
task: async (ctx$1, task$1) => {
|
|
135
|
+
ctx$1.prompts.issues = await task$1.prompt(_listr2_prompt_adapter_inquirer.ListrInquirerPromptAdapter).run(_inquirer_prompts.input, {
|
|
136
|
+
message: "Add issue references:",
|
|
137
|
+
default: options.defaultIssues
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
skip: (ctx$1) => !ctx$1.prompts.additional.includes("breaking-changes"),
|
|
143
|
+
task: async (ctx$1, task$1) => {
|
|
144
|
+
ctx$1.prompts.breaking = await task$1.prompt(_listr2_prompt_adapter_inquirer.ListrInquirerPromptAdapter).run(_inquirer_prompts.editor, { message: "Describe the breaking changes:" });
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
]) }
|
|
148
|
+
], {
|
|
149
|
+
rendererOptions: { collapseSubtasks: false },
|
|
150
|
+
fallbackRendererCondition: false,
|
|
151
|
+
ctx: { prompts: {} }
|
|
152
|
+
}).run().then((ctx) => {
|
|
153
|
+
const scope = ctx.prompts.scope ? `(${ctx.prompts.scope})` : "";
|
|
154
|
+
let head = ctx.prompts.type + scope + ": " + ctx.prompts.subject;
|
|
155
|
+
if (ctx.prompts.additional.includes("skip-ci")) head = head + " [skip ci]";
|
|
156
|
+
const body = ctx.prompts.body;
|
|
157
|
+
const breaking = ctx.prompts.breaking ? "BREAKING CHANGE: " + ctx.prompts.breaking.trim().replace(/^BREAKING CHANGE: /, "") : false;
|
|
158
|
+
const issues = ctx.prompts.issues;
|
|
159
|
+
commit([
|
|
160
|
+
head,
|
|
161
|
+
body,
|
|
162
|
+
breaking,
|
|
163
|
+
issues
|
|
164
|
+
].filter(Boolean).join(os.EOL + os.EOL));
|
|
165
|
+
}).catch(() => {
|
|
166
|
+
console.log(listr2.color.yellow("Cancelled. Skipping..."));
|
|
167
|
+
});
|
|
168
|
+
} };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/index.js
|
|
173
|
+
function bootstrap() {
|
|
174
|
+
const config = commitizen.configLoader.load() || {};
|
|
175
|
+
return engine_default({
|
|
176
|
+
types: config.types || conventional_commit_types.default.types,
|
|
177
|
+
defaultType: process.env.CZ_TYPE || config.defaultType || "fix",
|
|
178
|
+
defaultScope: process.env.CZ_SCOPE || config.defaultScope,
|
|
179
|
+
defaultSubject: process.env.CZ_SUBJECT || config.defaultSubject,
|
|
180
|
+
defaultBody: process.env.CZ_BODY || config.defaultBody,
|
|
181
|
+
defaultIssues: process.env.CZ_ISSUES || config.defaultIssues,
|
|
182
|
+
disableScopeLowerCase: process.env.DISABLE_SCOPE_LOWERCASE || config.disableScopeLowerCase,
|
|
183
|
+
maxHeaderWidth: process.env.CZ_MAX_HEADER_WIDTH && Number.parseInt(process.env.CZ_MAX_HEADER_WIDTH, 10) || config.maxHeaderWidth || 100,
|
|
184
|
+
maxLineWidth: process.env.CZ_MAX_LINE_WIDTH && Number.parseInt(process.env.CZ_MAX_LINE_WIDTH, 10) || config.maxLineWidth || 100
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
var src_default = bootstrap();
|
|
188
|
+
|
|
189
|
+
//#endregion
|
|
190
|
+
module.exports = src_default;
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cenk1cenk2/cz-cc",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Commitizen adapter following the conventional-changelog format.",
|
|
5
5
|
"repository": "git@gitlab.kilic.dev:libraries/cz-cc.git",
|
|
6
6
|
"author": "Cenk Kilic <cenk@kilic.dev>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"type": "commonjs",
|
|
9
|
-
"main": "./dist/index.
|
|
9
|
+
"main": "./dist/index.cjs",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "tsdown src/",
|
|
15
|
-
"dev:start": "tsdown --watch src/",
|
|
14
|
+
"build": "tsdown src/index.js",
|
|
15
|
+
"dev:start": "tsdown --watch src/index.js",
|
|
16
16
|
"format": "prettier --log-level warn --write src/ && eslint --fix",
|
|
17
17
|
"lint": "eslint"
|
|
18
18
|
},
|
|
@@ -30,28 +30,28 @@
|
|
|
30
30
|
]
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
|
-
"node": ">=
|
|
33
|
+
"node": ">= 22"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@inquirer/prompts": "^
|
|
36
|
+
"@inquirer/prompts": "^8.1.0",
|
|
37
37
|
"@listr2/prompt-adapter-inquirer": "^3.0.3",
|
|
38
38
|
"commitizen": "^4.3.1",
|
|
39
39
|
"conventional-commit-types": "^3.0.0",
|
|
40
40
|
"find-git-root": "^1.0.4",
|
|
41
|
-
"listr2": "^
|
|
41
|
+
"listr2": "^10.0.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@cenk1cenk2/eslint-config": "^3.1.
|
|
45
|
-
"eslint": "^9.
|
|
44
|
+
"@cenk1cenk2/eslint-config": "^3.1.69",
|
|
45
|
+
"eslint": "^9.35.0",
|
|
46
46
|
"lint-staged": "^16.1.6",
|
|
47
47
|
"prettier": "^3.6.2",
|
|
48
48
|
"simple-git-hooks": "^2.13.1",
|
|
49
|
-
"tsdown": "^0.
|
|
49
|
+
"tsdown": "^0.19.0"
|
|
50
50
|
},
|
|
51
51
|
"config": {
|
|
52
52
|
"commitizen": {
|
|
53
|
-
"path": "./dist/index.
|
|
53
|
+
"path": "./dist/index.cjs"
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
|
-
"packageManager": "pnpm@
|
|
56
|
+
"packageManager": "pnpm@10.28.0"
|
|
57
57
|
}
|
package/dist/engine-CrSYYpPU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=s(require(`@listr2/prompt-adapter-inquirer`)),l=s(require(`find-git-root`)),u=s(require(`fs`)),d=s(require(`listr2`)),f=s(require(`os`)),p=s(require(`path`)),m=s(require(`@inquirer/prompts`));function h(e){return{prompter(t,n){new d.Listr([{enabled:()=>{let e=(0,l.default)(process.cwd()),t=(0,p.join)(e,`COMMIT_EDITMSG`);if(e)try{let e=u.default.readFileSync(t,`utf-8`);if(new RegExp(/^Merge branch/).test(e))return!0}catch{}},task:async(e,t)=>{if(await t.prompt(c.ListrInquirerPromptAdapter).run(m.confirm,{message:`Last commit was found as merge commit do you want to skip?`,default:!0}))throw Error(`Skipping because of merge commit.`)}},{task:async(t,n)=>{let r=Object.entries(e.types).map(([e,t])=>({name:e,description:t.description,value:e}));t.prompts.type=await n.prompt(c.ListrInquirerPromptAdapter).run(m.select,{message:`Type of commit:`,choices:r,default:e.defaultType}),t.prompts.subject=await n.prompt(c.ListrInquirerPromptAdapter).run(m.input,{message:`Write a short description:`,default:e.defaultSubject,required:!0}),t.prompts.additional=await n.prompt(c.ListrInquirerPromptAdapter).run(m.checkbox,{message:`Please select additional actions.`,choices:[{name:`scope`,value:`scope`,description:`Add a scope to the commit message.`},{name:`issue`,value:`issue`,description:`Resolve Issues by additional comments.`},{name:`breaking-changes`,value:`breaking-changes`,description:`Note breaking changes in the commit message.`},{name:`long-description`,value:`long-description`,description:`Add a long description to the commit message.`},{name:`skip-ci`,value:`skip-ci`,description:`Skip CI/CD setups.`}]})}},{task:(t,n)=>n.newListr([{skip:e=>!e.prompts.additional.includes(`scope`),task:async(t,n)=>{t.prompts.scope=await n.prompt(c.ListrInquirerPromptAdapter).run(m.input,{message:`Please state the scope of the change:`,default:e.defaultScope,transformer:t=>e.disableScopeLowerCase?t.trim():t.trim().toLowerCase()})}},{skip:e=>!e.prompts.additional.some(e=>[`long-description`].includes(e)),task:async(t,n)=>{t.prompts.body=await n.prompt(c.ListrInquirerPromptAdapter).run(m.editor,{message:`Please give a long description:`,default:e.defaultBody})}},{skip:e=>!e.prompts.additional.includes(`issue`),task:async(t,n)=>{t.prompts.issues=await n.prompt(c.ListrInquirerPromptAdapter).run(m.input,{message:`Add issue references:`,default:e.defaultIssues})}},{skip:e=>!e.prompts.additional.includes(`breaking-changes`),task:async(e,t)=>{e.prompts.breaking=await t.prompt(c.ListrInquirerPromptAdapter).run(m.editor,{message:`Describe the breaking changes:`})}}])}],{rendererOptions:{collapseSubtasks:!1},fallbackRendererCondition:!1,ctx:{prompts:{}}}).run().then(e=>{let t=e.prompts.scope?`(${e.prompts.scope})`:``,r=e.prompts.type+t+`: `+e.prompts.subject;e.prompts.additional.includes(`skip-ci`)&&(r+=` [skip ci]`);let i=e.prompts.body,a=e.prompts.breaking?`BREAKING CHANGE: `+e.prompts.breaking.trim().replace(/^BREAKING CHANGE: /,``):!1,o=e.prompts.issues;n([r,i,a,o].filter(Boolean).join(f.EOL+f.EOL))}).catch(()=>{console.log(d.color.yellow(`Cancelled. Skipping...`))})}}}Object.defineProperty(exports,`__toESM`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`engine_default`,{enumerable:!0,get:function(){return h}});
|
package/dist/engine.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./engine-CrSYYpPU.js`);module.exports=e.engine_default;
|
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./engine-CrSYYpPU.js`),t=e.__toESM(require(`commitizen`)),n=e.__toESM(require(`conventional-commit-types`));function r(){let r=t.configLoader.load()||{},i={types:r.types||n.default.types,defaultType:process.env.CZ_TYPE||r.defaultType||`fix`,defaultScope:process.env.CZ_SCOPE||r.defaultScope,defaultSubject:process.env.CZ_SUBJECT||r.defaultSubject,defaultBody:process.env.CZ_BODY||r.defaultBody,defaultIssues:process.env.CZ_ISSUES||r.defaultIssues,disableScopeLowerCase:process.env.DISABLE_SCOPE_LOWERCASE||r.disableScopeLowerCase,maxHeaderWidth:process.env.CZ_MAX_HEADER_WIDTH&&Number.parseInt(process.env.CZ_MAX_HEADER_WIDTH,10)||r.maxHeaderWidth||100,maxLineWidth:process.env.CZ_MAX_LINE_WIDTH&&Number.parseInt(process.env.CZ_MAX_LINE_WIDTH,10)||r.maxLineWidth||100};return e.engine_default(i)}var i=r();module.exports=i;
|