@cenk1cenk2/cz-cc 1.6.7 → 1.7.0
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.js +1 -1
- package/package.json +9 -11
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var v=Object.create;var d=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var R=(e,r)=>{for(var i in r)d(e,i,{get:r[i],enumerable:!0})},g=(e,r,i,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of W(r))!D.call(e,t)&&t!==i&&d(e,t,{get:()=>r[t],enumerable:!(o=H(r,t))||o.enumerable});return e};var l=(e,r,i)=>(i=e!=null?v(T(e)):{},g(r||!e||!e.__esModule?d(i,"default",{value:e,enumerable:!0}):i,e)),M=e=>g(d({},"__esModule",{value:!0}),e);var P={};R(P,{default:()=>O});module.exports=M(P);var _=require("commitizen"),I=l(require("conventional-commit-types"));var m=require("@listr2/prompt-adapter-enquirer"),k=l(require("enquirer")),b=l(require("find-git-root")),x=l(require("fs")),f=require("listr2"),p=require("os"),C=require("path");var y=require("enquirer"),S=require("external-editor"),h=require("os"),u=class extends y.Prompt{constructor(r={}){super(r),this.value=this.state.initial||""}async suffix(r=""){let i=this.state.cancelled?" \u2014 Aborted":this.state.submitted?" \u2014 Received":" \u2014 Press <Enter> to launch "+r;return this.styles.dim(i)}async submit(){return this.value=(0,S.edit)(this.value),super.submit()}async render(){let r=await this.prefix()+" ",i=await this.message(),o=await this.error(),t=o?await this.suffix("the editor again"):await this.suffix("an editor");this.clear(this.state.size),this.cursorHide(),this.write(this.style.bold(r)+i+t),o&&this.write(h.EOL+o.split(h.EOL).join(""))}};function Z(e){return e.type.length+2+(e.scope?e.scope.length+2:0)}function w(e,r){return e.maxHeaderWidth-Z(r)}function E(e){for(e=e.trim(),e.charAt(0).toLowerCase()!==e.charAt(0)&&(e=e.charAt(0).toLowerCase()+e.slice(1,e.length));e.endsWith(".");)e=e.slice(0,e.length-1);return e}function L(e){let r=Object.entries(e.types).map(([i,o])=>({name:i,hint:o.description,value:i}));return{prompter(i,o){new f.Listr([{enabled:()=>{let t=(0,b.default)(process.cwd()),n=(0,C.join)(t,"COMMIT_EDITMSG");if(t)try{let s=x.default.readFileSync(n,"utf-8");if(new RegExp(/^Merge branch/).test(s))return!0}catch{}},task:async(t,n)=>{if(await n.prompt(m.ListrEnquirerPromptAdapter).run({type:"Toggle",message:"Last commit was found as merge commit do you want to skip?",initial:!0}))throw new Error("Skipping because of merge commit.")}},{task:async(t,n)=>t.prompts=await n.prompt(m.ListrEnquirerPromptAdapter).run([{type:"autocomplete",name:"type",message:"Type of commit:",choices:r,initial:r.findIndex(s=>s.value===e.defaultType)},{type:"Input",name:"subject",message:s=>`Write a short description (max ${w(e,s)} chars):`+p.EOL,initial:e.defaultSubject,required:!0,validate:s=>{let a=E(s);return a.length<=e.maxHeaderWidth&&a.length>0?!0:`Subject length must be less than or equal to ${e.maxHeaderWidth} characters. Current length is ${a.length} characters.`}},{type:"MultiSelect",name:"additional",message:"Please select additional actions.",choices:[{name:"scope",message:"add a scope"},{name:"issue",message:"resolves issues"},{name:"breaking-changes",message:"introduces breaking changes"},{name:"long-description",message:"add a long description"},{name:"skip-ci",message:"skip ci/cd setups"}]}])},{task:(t,n)=>n.newListr([{skip:s=>!s.prompts.additional.includes("scope"),task:async(s,a)=>{s.prompts.scope=await a.prompt(m.ListrEnquirerPromptAdapter).run({type:"Input",message:"Please state the scope of the change:"+p.EOL,initial:e.defaultScope,format:c=>e.disableScopeLowerCase?c.trim():c.trim().toLowerCase()})}},{skip:s=>!s.prompts.additional.some(a=>["long-description"].includes(a)),task:async(s,a)=>{let c=new k.default().register("editor",u);s.prompts.body=await a.prompt(m.ListrEnquirerPromptAdapter).run([{type:"editor",name:"default",message:"Please give a long description:"+p.EOL,initial:e.defaultBody}],{enquirer:c})}},{skip:s=>!s.prompts.additional.includes("issue"),task:async(s,a)=>{s.prompts.issues=await a.prompt(m.ListrEnquirerPromptAdapter).run({type:"input",message:"Add issue references:"+p.EOL,hint:"fix #123, re #124",initial:e.defaultIssues})}},{skip:s=>!s.prompts.additional.includes("breaking-changes"),task:async(s,a)=>{s.prompts.breaking=await a.prompt(m.ListrEnquirerPromptAdapter).run({type:"editor",message:"Describe the breaking changes:"+p.EOL})}}])}],{rendererOptions:{collapseSubtasks:!1},fallbackRendererCondition:!1}).run().then(t=>{let n=t.prompts.scope?`(${t.prompts.scope})`:"",s=t.prompts.type+n+": "+t.prompts.subject;t.prompts.additional.includes("skip-ci")&&(s=s+" [skip ci]");let a=t.prompts.body,c=t.prompts.breaking?"BREAKING CHANGE: "+t.prompts.breaking.trim().replace(/^BREAKING CHANGE: /,""):!1,A=t.prompts.issues;o([s,a,c,A].filter(Boolean).join(p.EOL+p.EOL))}).catch(()=>{console.log(f.color.yellow("Cancelled. Skipping..."))})}}}function B(){let e=_.configLoader.load()||{},r={types:e.types||I.default.types,defaultType:process.env.CZ_TYPE||e.defaultType||"fix",defaultScope:process.env.CZ_SCOPE||e.defaultScope,defaultSubject:process.env.CZ_SUBJECT||e.defaultSubject,defaultBody:process.env.CZ_BODY||e.defaultBody,defaultIssues:process.env.CZ_ISSUES||e.defaultIssues,disableScopeLowerCase:process.env.DISABLE_SCOPE_LOWERCASE||e.disableScopeLowerCase,maxHeaderWidth:process.env.CZ_MAX_HEADER_WIDTH&&parseInt(process.env.CZ_MAX_HEADER_WIDTH,10)||e.maxHeaderWidth||100,maxLineWidth:process.env.CZ_MAX_LINE_WIDTH&&parseInt(process.env.CZ_MAX_LINE_WIDTH,10)||e.maxLineWidth||100};try{require("@commitlint/load").default().then(function(o){if(o.rules){let t=o.rules["header-max-length"];typeof t=="object"&&t.length>=3&&!process.env.CZ_MAX_HEADER_WIDTH&&!e.maxHeaderWidth&&(r.maxHeaderWidth=t[2])}})}catch{}return L(r)}var O=B();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cenk1cenk2/cz-cc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
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>",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"lint": "eslint --ext .ts,.js,.tsx,.jsx src/"
|
|
18
18
|
},
|
|
19
19
|
"simple-git-hooks": {
|
|
20
|
-
"pre-commit": "pnpm exec lint-staged",
|
|
20
|
+
"pre-commit": "[ -n \"$SKIP_GIT_HOOKS\" ] && true || pnpm exec lint-staged",
|
|
21
21
|
"prepare-commit-msg": "[ -t 1 ] && exec < /dev/tty && git cz --hook || true"
|
|
22
22
|
},
|
|
23
23
|
"lint-staged": {
|
|
@@ -33,23 +33,21 @@
|
|
|
33
33
|
"node": ">= 16"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
+
"@listr2/prompt-adapter-enquirer": "^1.0.0",
|
|
36
37
|
"commitizen": "^4.3.0",
|
|
37
38
|
"conventional-commit-types": "^3.0.0",
|
|
38
39
|
"enquirer": "^2.4.1",
|
|
39
40
|
"external-editor": "^3.1.0",
|
|
40
41
|
"find-git-root": "^1.0.4",
|
|
41
|
-
"listr2": "^
|
|
42
|
+
"listr2": "^7.0.1"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
|
-
"@
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"eslint": "^8.45.0",
|
|
49
|
-
"lint-staged": "^13.2.3",
|
|
50
|
-
"prettier": "^2.8.8",
|
|
45
|
+
"@cenk1cenk2/eslint-config": "^2.7.20",
|
|
46
|
+
"eslint": "^8.49.0",
|
|
47
|
+
"lint-staged": "^14.0.1",
|
|
48
|
+
"prettier": "^3.0.3",
|
|
51
49
|
"simple-git-hooks": "^2.9.0",
|
|
52
|
-
"tsup": "^7.
|
|
50
|
+
"tsup": "^7.2.0"
|
|
53
51
|
},
|
|
54
52
|
"optionalDependencies": {
|
|
55
53
|
"@commitlint/load": "^17.5.0"
|