@cenk1cenk2/cz-cc
Advanced tools
Comparing version 1.5.2 to 1.5.3
@@ -1,11 +0,11 @@ | ||
var M=Object.create;var l=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var g=e=>l(e,"__esModule",{value:!0});var O=(e,t)=>{for(var i in t)l(e,i,{get:t[i],enumerable:!0})},y=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Z(t))!P.call(e,o)&&(i||o!=="default")&&l(e,o,{get:()=>t[o],enumerable:!(n=R(t,o))||n.enumerable});return e},m=(e,t)=>y(g(l(e!=null?M(B(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),G=(e=>(t,i)=>e&&e.get(t)||(i=y(g({}),t,1),e&&e.set(t,i),i))(typeof WeakMap!="undefined"?new WeakMap:0);var $={};O($,{default:()=>X});var H=require("commitizen"),W=m(require("conventional-commit-types"));var E=m(require("colorette")),b=m(require("enquirer")),x=m(require("find-git-root")),_=m(require("fs")),I=require("listr2"),L=m(require("lodash.map")),A=require("path"),u=m(require("word-wrap"));var w=require("enquirer"),S=require("external-editor"),h=class extends w.Prompt{constructor(t={}){super(t);this.value=this.state.initial||""}async suffix(t=""){let i=this.state.cancelled?" \u2014 Aborted":this.state.submitted?" \u2014 Received":" \u2014 Press <Enter> to launch "+t;return this.styles.dim(i)}async submit(){return this.value=(0,S.edit)(this.value),super.submit()}async render(){let t=await this.prefix()+" ",i=await this.message(),n=await this.error(),o=n?await this.suffix("the editor again"):await this.suffix("an editor");this.clear(this.state.size),this.cursorHide(),this.write(this.style.bold(t)+i+o),n&&this.write(` | ||
var D=Object.create;var d=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var P=(e,s)=>{for(var r in s)d(e,r,{get:s[r],enumerable:!0})},g=(e,s,r,n)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of R(s))!B.call(e,o)&&o!==r&&d(e,o,{get:()=>s[o],enumerable:!(n=M(s,o))||n.enumerable});return e};var m=(e,s,r)=>(r=e!=null?D(Z(e)):{},g(s||!e||!e.__esModule?d(r,"default",{value:e,enumerable:!0}):r,e)),O=e=>g(d({},"__esModule",{value:!0}),e);var X={};P(X,{default:()=>q});module.exports=O(X);var v=require("commitizen"),H=m(require("conventional-commit-types"));var C=m(require("colorette")),b=m(require("enquirer")),x=m(require("find-git-root")),E=m(require("fs")),_=require("listr2"),I=m(require("lodash.map")),L=require("path"),f=m(require("word-wrap"));var y=require("enquirer"),w=require("external-editor"),u=class extends y.Prompt{constructor(s={}){super(s),this.value=this.state.initial||""}async suffix(s=""){let r=this.state.cancelled?" \u2014 Aborted":this.state.submitted?" \u2014 Received":" \u2014 Press <Enter> to launch "+s;return this.styles.dim(r)}async submit(){return this.value=(0,w.edit)(this.value),super.submit()}async render(){let s=await this.prefix()+" ",r=await this.message(),n=await this.error(),o=n?await this.suffix("the editor again"):await this.suffix("an editor");this.clear(this.state.size),this.cursorHide(),this.write(this.style.bold(s)+r+o),n&&this.write(` | ||
`+n.split(` | ||
`).join(""))}};function N(e){return e.type.length+2+(e.scope?e.scope.length+2:0)}function k(e,t){return e.maxHeaderWidth-N(t)}function C(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 v(e){let t=e.types,i=(0,L.default)(t,function(o,c){return{name:c,hint:o.description,value:c}}),n=new b.default;return n=n.register("editor",h),{prompter(o,c){new I.Listr([{enabled:()=>{let r=(0,x.default)(process.cwd()),p=(0,A.join)(r,"COMMIT_EDITMSG");if(r)try{let s=_.default.readFileSync(p,"utf-8");if(new RegExp(/^Merge branch/).test(s))return!0}catch{}},task:async(r,p)=>{if(await p.prompt({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(r,p)=>r.prompts=await p.prompt([{type:"AutoComplete",name:"type",message:"Type of commit:",choices:i,initial:i.findIndex(s=>s.value===e.defaultType)},{type:"Input",name:"subject",message:s=>`Write a short description (max ${k(e,s)} chars): | ||
`,initial:e.defaultSubject,required:!0,validate:s=>{let a=C(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:(r,p)=>p.newListr([{skip:s=>!s.prompts.additional.includes("scope"),task:async(s,a)=>{s.prompts.scope=await a.prompt({type:"Input",message:`Please state the scope of the change: | ||
`,initial:e.defaultScope,format:d=>e.disableScopeLowerCase?d.trim():d.trim().toLowerCase()})}},{skip:s=>!s.prompts.additional.some(a=>["long-description"].includes(a)),task:async(s,a)=>{s.prompts.body=await a.prompt([{type:"editor",name:"default",message:`Please give a long description: | ||
`,initial:e.defaultBody}])}},{skip:s=>!s.prompts.additional.includes("issue"),task:async(s,a)=>{s.prompts.issues=await a.prompt({type:"Input",message:`Add issue references: | ||
`,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({type:"editor",message:`Describe the breaking changes: | ||
`})}}])}],{rendererOptions:{collapse:!1},rendererFallback:!1,injectWrapper:{enquirer:n}}).run().then(r=>{let p={trim:!0,cut:!1,newline:` | ||
`,indent:"",width:e.maxLineWidth},s=r.prompts.scope?`(${r.prompts.scope})`:"",a=r.prompts.type+s+": "+r.prompts.subject;r.prompts.additional.includes("skip-ci")&&(a=a+" [skip ci]");let d=r.prompts.body?(0,u.default)(r.prompts.body,p):!1,T=r.prompts.breaking?(0,u.default)("BREAKING CHANGE: "+r.prompts.breaking.trim().replace(/^BREAKING CHANGE: /,""),p):!1,D=r.prompts.issues?(0,u.default)(r.prompts.issues,p):!1;c([a,d,T,D].filter(Boolean).join(` | ||
`).join(""))}};function G(e){return e.type.length+2+(e.scope?e.scope.length+2:0)}function S(e,s){return e.maxHeaderWidth-G(s)}function k(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 A(e){let s=e.types,r=(0,I.default)(s,function(o,c){return{name:c,hint:o.description,value:c}}),n=new b.default;return n=n.register("editor",u),{prompter(o,c){new _.Listr([{enabled:()=>{let i=(0,x.default)(process.cwd()),p=(0,L.join)(i,"COMMIT_EDITMSG");if(i)try{let t=E.default.readFileSync(p,"utf-8");if(new RegExp(/^Merge branch/).test(t))return!0}catch{}},task:async(i,p)=>{if(await p.prompt({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(i,p)=>i.prompts=await p.prompt([{type:"AutoComplete",name:"type",message:"Type of commit:",choices:r,initial:r.findIndex(t=>t.value===e.defaultType)},{type:"Input",name:"subject",message:t=>`Write a short description (max ${S(e,t)} chars): | ||
`,initial:e.defaultSubject,required:!0,validate:t=>{let a=k(t);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:(i,p)=>p.newListr([{skip:t=>!t.prompts.additional.includes("scope"),task:async(t,a)=>{t.prompts.scope=await a.prompt({type:"Input",message:`Please state the scope of the change: | ||
`,initial:e.defaultScope,format:l=>e.disableScopeLowerCase?l.trim():l.trim().toLowerCase()})}},{skip:t=>!t.prompts.additional.some(a=>["long-description"].includes(a)),task:async(t,a)=>{t.prompts.body=await a.prompt([{type:"editor",name:"default",message:`Please give a long description: | ||
`,initial:e.defaultBody}])}},{skip:t=>!t.prompts.additional.includes("issue"),task:async(t,a)=>{t.prompts.issues=await a.prompt({type:"Input",message:`Add issue references: | ||
`,hint:"fix #123, re #124",initial:e.defaultIssues})}},{skip:t=>!t.prompts.additional.includes("breaking-changes"),task:async(t,a)=>{t.prompts.breaking=await a.prompt({type:"editor",message:`Describe the breaking changes: | ||
`})}}])}],{rendererOptions:{collapse:!1},rendererFallback:!1,injectWrapper:{enquirer:n}}).run().then(i=>{let p={trim:!0,cut:!1,newline:` | ||
`,indent:"",width:e.maxLineWidth},t=i.prompts.scope?`(${i.prompts.scope})`:"",a=i.prompts.type+t+": "+i.prompts.subject;i.prompts.additional.includes("skip-ci")&&(a=a+" [skip ci]");let l=i.prompts.body?(0,f.default)(i.prompts.body,p):!1,W=i.prompts.breaking?(0,f.default)("BREAKING CHANGE: "+i.prompts.breaking.trim().replace(/^BREAKING CHANGE: /,""),p):!1,T=i.prompts.issues?(0,f.default)(i.prompts.issues,p):!1;c([a,l,W,T].filter(Boolean).join(` | ||
`))}).catch(()=>{console.log(E.default.yellow("Cancelled. Skipping..."))})}}}function q(){let e=H.configLoader.load()||{},t={types:e.types||W.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(n){if(n.rules){let o=n.rules["header-max-length"];typeof o=="object"&&o.length>=3&&!process.env.CZ_MAX_HEADER_WIDTH&&!e.maxHeaderWidth&&(t.maxHeaderWidth=o[2])}})}catch{}return v(t)}var X=q();module.exports=G($);0&&(module.exports={}); | ||
`))}).catch(()=>{console.log(C.default.yellow("Cancelled. Skipping..."))})}}}function N(){let e=v.configLoader.load()||{},s={types:e.types||H.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(n){if(n.rules){let o=n.rules["header-max-length"];typeof o=="object"&&o.length>=3&&!process.env.CZ_MAX_HEADER_WIDTH&&!e.maxHeaderWidth&&(s.maxHeaderWidth=o[2])}})}catch{}return A(s)}var q=N();0&&(module.exports={}); |
{ | ||
"name": "@cenk1cenk2/cz-cc", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"description": "Commitizen adapter following the conventional-changelog format.", | ||
"repository": "https://github.com/cenk1cenk2/cz-cc", | ||
"repository": "git@gitlab.kilic.dev:libraries/cz-cc.git", | ||
"author": "Cenk Kilic <cenk@kilic.dev>", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"dev:start": "tsup-node --watch", | ||
"lint": "prettier --write src/ && eslint --ext .ts,.js,.tsx,.jsx --fix src/", | ||
"lint": "prettier --loglevel warn --write src/ && eslint --ext .ts,.js,.tsx,.jsx --fix src/", | ||
"lint:check": "eslint --ext .ts,.js,.tsx,.jsx src/" | ||
@@ -49,14 +49,14 @@ }, | ||
"@babel/cli": "^7.17.6", | ||
"@babel/core": "^7.17.5", | ||
"@babel/core": "^7.17.9", | ||
"@babel/preset-env": "^7.16.11", | ||
"@cenk1cenk2/eslint-config": "^2.5.7", | ||
"eslint": "^8.9.0", | ||
"@cenk1cenk2/eslint-config": "^2.5.8", | ||
"eslint": "^8.12.0", | ||
"external-editor": "^3.1.0", | ||
"lint-staged": "^11", | ||
"prettier": "^2.5.1", | ||
"prettier": "^2.6.2", | ||
"simple-git-hooks": "^2.7.0", | ||
"tsup": "^5.12.0" | ||
"tsup": "^5.12.5" | ||
}, | ||
"optionalDependencies": { | ||
"@commitlint/load": "^16.1.0" | ||
"@commitlint/load": "^16.2.3" | ||
}, | ||
@@ -63,0 +63,0 @@ "config": { |
# @cenk1cenk2/cz-cc | ||
[![Build Status](https://drone.kilic.dev/api/badges/cenk1cenk2/cz-cc/status.svg)](https://drone.kilic.dev/cenk1cenk2/cz-cc) [![Version](https://img.shields.io/npm/v/@cenk1cenk2/cz-cc.svg)](https://npmjs.org/package/@cenk1cenk2/cz-cc) [![Downloads/week](https://img.shields.io/npm/dw/@cenk1cenk2/cz-cc.svg)](https://npmjs.org/package/@cenk1cenk2/cz-cc) [![Dependencies](https://img.shields.io/librariesio/release/npm/@cenk1cenk2/cz-cc)](https://npmjs.org/package/@cenk1cenk2/cz-cc) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
[![pipeline status](https://gitlab.kilic.dev/libraries/cz-cc/badges/master/pipeline.svg)](https://gitlab.kilic.dev/libraries/cz-cc/-/commits/master) [![Version](https://img.shields.io/npm/v/@cenk1cenk2/cz-cc.svg)](https://npmjs.org/package/@cenk1cenk2/cz-cc) [![Downloads/week](https://img.shields.io/npm/dw/@cenk1cenk2/cz-cc.svg)](https://npmjs.org/package/@cenk1cenk2/cz-cc) [![Dependencies](https://img.shields.io/librariesio/release/npm/@cenk1cenk2/cz-cc)](https://npmjs.org/package/@cenk1cenk2/cz-cc) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
@@ -13,12 +13,12 @@ ![Demo](./demo/demo.gif) | ||
- [package.json](#packagejson) | ||
- [Environment variables](#environment-variables) | ||
- [Commitlint](#commitlint) | ||
- [Environment Variables](#environment-variables) | ||
- [Commitlint](#commitlint) | ||
<!-- tocstop --> | ||
# Description | ||
## Description | ||
This is a direct fork of [cz-conventional-changelog](https://github.com/commitizen/cz-conventional-changelog), while it swaps `inquirer` for `enquirer` for speed and adds auto compelete to commit types as well as reducing overal questions and making many optional. | ||
This is a direct fork of [cz-conventional-changelog](https://github.com/commitizen/cz-conventional-changelog), while it swaps `inquirer` for `enquirer` for speed and adds autocomplete to commit types as well as reducing overall questions and making many optional. | ||
# Usage | ||
## Usage | ||
@@ -34,3 +34,3 @@ - Install commitizen. Either globally or in the project. | ||
- Initiate this adapter in a project. If already initiated you can add `--force` flag to swap this adapter with the older one. | ||
- Initiate this adapter in a project. If already initiated you can add the `--force` flag to swap this adapter with the older one. | ||
- Currently has a bit of problems with yarn workspaces do to `commitizen`. | ||
@@ -57,3 +57,3 @@ | ||
# Configuration | ||
## Configuration | ||
@@ -64,3 +64,3 @@ Install the adapter by utilizing global commitizen installation. | ||
## package.json | ||
### package.json | ||
@@ -96,3 +96,3 @@ Like commitizen, you specify the configuration of cz-conventional-changelog through the package.json's `config.commitizen` key. | ||
## Environment variables | ||
### Environment Variables | ||
@@ -110,2 +110,2 @@ The following environment varibles can be used to override any default configuration or package.json based configuration. | ||
If using the [commitlint](https://github.com/conventional-changelog/commitlint) js library, the "maxHeaderWidth" configuration property will default to the configuration of the "header-max-length" rule instead of the hard coded value of 100. This can be ovewritten by setting the 'maxHeaderWidth' configuration in package.json or the CZ_MAX_HEADER_WIDTH environment variable. | ||
If using the [commitlint](https://github.com/conventional-changelog/commitlint) js library, the "maxHeaderWidth" configuration property will default to the configuration of the "header-max-length" rule instead of the hard coded value of 100. This can be overwritten by setting the 'maxHeaderWidth' configuration in package.json or the CZ_MAX_HEADER_WIDTH environment variable. |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
11974
4
26