ccommit 1.1.0 → 1.1.2

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.
Files changed (3) hide show
  1. package/README.md +1 -3
  2. package/index.js +6 -6
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -164,11 +164,9 @@ By providing configuration options for your project.
164
164
 
165
165
  ## Roadmap
166
166
 
167
- This was meant to sunset `@jeromefitz/git-cz` as a year-end personal hackathon. This will keep up with `gitmoji` and ideally some tenets of ‘best of both worlds’ could make it to `gitmoji-cli` some day. (There are a few closed issues on ‘boring’ versions already.)
167
+ This was meant to sunset `@jeromefitz/git-cz` as a year-end personal hackathon. This will keep up with `gitmoji` and ideally some tenets of ‘best of both worlds’ could make it to `gitmoji-cli` some day. (There are a few closed issues on ‘boring’ versions already, and with this using `enquirer` probably less and less of a chance.)
168
168
 
169
169
  As a result it is a mash-up of both and I have tried to add references where applicable:
170
170
 
171
171
  - 🔗 [`gitmoji-cli`](https://github.com/carloscuesta/gitmoji-cli)
172
- - This repo started from scratch, but then reworked to be more close to above for potential future feature addition
173
- - 📄 Additional MIT LICENSE provided as `LICENSE-gitmoji-cli`
174
172
  - 🔗 [`@jeromefitz/git-cz`](https://github.com/jeromefitz/packages)
package/index.js CHANGED
@@ -6,8 +6,8 @@ import Ce from 'enquirer';
6
6
  import Y from 'node:fs';
7
7
  import { execa } from 'execa';
8
8
  import d from 'ansi-colors';
9
- import { execSync } from 'child_process';
10
- import { join } from 'path';
9
+ import { execSync } from 'node:child_process';
10
+ import { join } from 'node:path';
11
11
 
12
12
  var C={COMMIT:"commit",HOOK:"hook",LIST:"list"},l={CONVENTIONAL:"conventional",CONVENTIONAL_NO_EMOJI:"conventional-no-emoji",GITMOJI:"gitmoji"},L={CLIENT:"client",HOOK:"hook"},T={EMOJI:"emoji",TYPE:"type"},n=Object.freeze({BREAKING:"breaking",COMMIT:"commit",DRYRUN:"dryrun",EMOJI:"emoji",HELP:"help",HOOK:"hook",LIST:"list",SKIP:"skip",VERSION:"version"}),D={[l.CONVENTIONAL]:"{type}{scope}{breaking}: {emoji}{title}",[l.CONVENTIONAL_NO_EMOJI]:"{type}{scope}{breaking}: {title}",[l.GITMOJI]:"{emoji}{breaking}{scope}{title}"},m={TYPES:{ERROR:"error",INFO:"info",SUCCESS:"success",WARNING:"warning"},MESSAGES:{COMMAND_LINE_WITHOUT_REQUIRED:"\u276F Command line option requires both: --title, --type",COMMIT_FAIL:`\u276F
13
13
 
@@ -21,10 +21,10 @@ var C={COMMIT:"commit",HOOK:"hook",LIST:"list"},l={CONVENTIONAL:"conventional",C
21
21
  ${r}
22
22
  `,e===m.TYPES.ERROR?d.magenta.bold(r):e===m.TYPES.INFO?d.blue.bold(r):e===m.TYPES.WARNING?d.yellow.bold(r):d.green.bold(r)},_=(e,t,i)=>{let r=i?t.replace(/\{REPLACE\}/g,i):t;return e===m.TYPES.ERROR?d.red.bold(r):e===m.TYPES.INFO?d.white.bold(r):e===m.TYPES.WARNING?d.yellow.bold(r):d.green.bold(r)};var U=e=>{let t=e.length,i=t.toString(),r=m.TYPES.SUCCESS;return t<a.MIN||t>a.MAX?r=m.TYPES.ERROR:(t<a.MIN_SWAG||t>a.MAX_SWAG)&&(r=m.TYPES.WARNING),_(r,m.MESSAGES.REPLACE,i)};var x=()=>{let e=process.platform==="win32"?" nul":"/dev/null";return execSync("git rev-parse --show-toplevel 2>"+e).toString().trim()};var I=()=>{let e="",t;t=execSync("git rev-parse --abbrev-ref HEAD"),t=t.toString().trim().split("/");let i=t[0],c=(t[1]?t[1]:i).split("-"),p=c[0],h=c[1]?c[1]:p,te=`${p}-${h}`;return !isNaN(parseFloat(h))&&isFinite(parseFloat(h))&&(e=te),e};var P=()=>!!execSync("git diff --name-only --staged").toString().trim();var j=e=>{console.log(d.magenta.bold(`\u276F dry-run mode: ${e}
23
23
  `));};var k=()=>{M.on("SIGINT",()=>{console.log(d.magenta.bold("\u276F [ccommit] interrupted")),M.exit(0);});};var de=()=>f.map(({description:e,emoji:t,emojiLength:i,type:r})=>({emoji:t,emojiLength:i,description:e,type:r})),H=(e,t)=>{let r=`Character Count (${U(e)}/${t})`;return `${d.dim.cyan("\u203A")} ${d.dim.bold(r)}`},pe=e=>e.submitted?e.cancelled?d.magenta("\u2716"):d.green("\u2714"):d.cyan("?"),le=[{type:"confirm",name:"breaking",message:"Is there a breaking change?",initial:!1,default:"(y/N)",prefix(){return pe(this.state)},styles:{primary:d.white},format(e){let t=e?"yes":"no";return this.state.submitted?d.green(t):d.dim(t)}},{name:"messageBreaking",type:"input",message:"Please share breaking change info",skip(){return !this.state.answers.breaking},result(e){return e?`BREAKING CHANGE: ${e.trim()}`:""},footer(){return H(this.state.input,a.MAX)},validate(e){let t=(e==null?void 0:e.length)||0;return this.state.answers.breaking?t<15?"Must have at least 15 characters":t>a.MAX?`Cannot exceed ${a.MAX} characters`:!0:!0}},{type:"autocomplete",name:"gitmoji",message:"Please choose a commit type",choices:de().map(({description:e,emoji:t,emojiLength:i,type:r})=>{let c=t;return {name:` ${A({emoji:t,emojiLength:i})} ${O(r)} ${e}`,value:c}}),limit:18,footer(){return `${d.dim.cyan("\u203A")} ${d.dim.bold("scroll up and down to reveal more \u2195")}`},highlight(e){return d.cyanBright(e)}},{name:"scope",type:"input",message:"Please share the scope (if any)",format(){return this.state.submitted?d.green(this.value):this.value},footer(){return H(this.state.input,y.MAX)},validate(e){let t=e.length;return t===0?!0:t<y.MIN?`Must have at least ${y.MIN} characters`:t>y.MAX?`Cannot exceed ${y.MAX} characters`:!0}},{name:"title",type:"input",message:"Please enter the commit title",initial:I()?`${I()} `:"",hint(){return this.state.initial?"\u2026 tab to use initial value":""},footer(){return H(this.state.input,a.MAX)},validate(e){let t=e.length;return t<a.MIN?`Must have at least ${a.MIN} characters`:t>a.MAX?`Cannot exceed ${a.MAX} characters`:!0}},{name:"message",type:"input",message:"Please share a more detailed commit message (if applicable)",multiline:!0,footer(){return `${d.dim.cyan("\u203A")} ${d.dim("Return twice to submit/skip: \u2B91 \u2B91")}`},result(e){return e===`
24
- `?"":e}}],X=le;var ue=async(e,t)=>{try{let i=e==null?void 0:e.subject,r=e==null?void 0:e.message,c=e==null?void 0:e.messageBreaking,p=["commit","-m",i];r&&p.push("-m",r),c&&p.push("-m",c),t!=null&&t.dryrun?j(["git",...p].join(" ")):await execa("git",p,{buffer:!1,stdio:"inherit"});}catch(i){console.error(g(m.TYPES.ERROR,m.MESSAGES.COMMIT_FAIL,i.escapedCommand)),M.exit(1);}},z=ue;var ye=join(x(),".git","COMMIT_EDITMSG"),Te=(e,t)=>{try{let i=e==null?void 0:e.subject;(e==null?void 0:e.message)&&(e==null?void 0:e.message)!==`
24
+ `?"":e}}],X=le;var ue=async(e,t)=>{try{let i=e==null?void 0:e.subject,r=e==null?void 0:e.message,c=e==null?void 0:e.messageBreaking,p=["commit","-m",i];r&&p.push("-m",r),c&&p.push("-m",c),t!=null&&t.dryrun?j(["git",...p].join(" ")):await execa("git",p,{buffer:!1,stdio:"inherit"});}catch(i){console.error(g(m.TYPES.ERROR,m.MESSAGES.COMMIT_FAIL,i.escapedCommand)),M.exit(1);}},z=ue;var ye=join(x(),".git","COMMIT_EDITMSG"),Te=(e,t)=>{try{let i=e==null?void 0:e.subject;e!=null&&e.message&&(e==null?void 0:e.message)!==`
25
25
  `&&(i+=`
26
26
 
27
- ${e.message}`),(e==null?void 0:e.messageBreaking)&&(e==null?void 0:e.messageBreaking)!==`
27
+ ${e.message}`),e!=null&&e.messageBreaking&&(e==null?void 0:e.messageBreaking)!==`
28
28
  `&&(i+=`
29
29
 
30
30
  ${e.messageBreaking}`),t!=null&&t.dryrun?j(i):Y.writeFileSync(ye,i);}catch(i){console.error(i),M.exit(1);}finally{M.exit(0);}},Q=Te;var{prompt:Ee}=Ce,Z=async e=>{let t={};return e.skip?(t=e,t.gitmoji=E(t.type,T.TYPE,T.EMOJI),t.gitmoji||(console.log(g(m.TYPES.ERROR,m.MESSAGES.TYPE_INCORRECT,t.type)),M.exit(2))):await Ee(X).then(i=>(i.type=E(i.gitmoji,T.EMOJI,T.TYPE),i)).then(i=>{t=i;}).catch(console.error),t.subject=t?b(e,t):"",e.mode===L.HOOK?Q(t,e):z(t,e)},Ae=e=>e.mode===L.HOOK?(k(),v().then(()=>Z(e))):Z(e),w=Ae;var S=w;var Oe=()=>R(f),ee=Oe;var F=ee;var G=import.meta.url;G.startsWith("file://")||(G=new URL(`file://${import.meta.url}`).toString());var Me=Se(`
@@ -53,8 +53,8 @@ ${e.messageBreaking}`),t!=null&&t.dryrun?j(i):Y.writeFileSync(ye,i);}catch(i){co
53
53
  - Branch Name detection is enabled to pre-populate Issue Tracker information in prompt
54
54
  `,{importMeta:{url:G},flags:{[n.BREAKING]:{type:"boolean",alias:"b",default:!1},[n.COMMIT]:{type:"boolean",alias:"c"},[n.DRYRUN]:{type:"boolean",alias:"n"},[n.EMOJI]:{type:"boolean",alias:"e",default:!0},[n.HELP]:{type:"boolean",alias:"h"},[n.HOOK]:{type:"boolean",alias:"u"},[n.LIST]:{type:"boolean",alias:"l"},[n.SKIP]:{type:"boolean",default:!1},[n.VERSION]:{type:"boolean",alias:"v"},[s.FORMAT]:{type:"string",default:l.GITMOJI},[s.MESSAGE]:{type:"string"},[s.SCOPE]:{type:"string"},[s.TITLE]:{type:"string"},[s.TYPE]:{type:"string"}}}),ve={[C.COMMIT]:e=>S(e),[C.HOOK]:e=>S(e),[C.LIST]:()=>F()};N(Me,ve);
55
55
  /*!
56
- * For license information please see index.js.LICENSE.txt
56
+ * reference: https://github.com/carloscuesta/gitmoji-cli
57
57
  */
58
58
  /*!
59
- * reference: https://github.com/carloscuesta/gitmoji-cli
59
+ * For license information please see index.js.LICENSE.txt
60
60
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "license": "MIT",
4
- "version": "1.1.0",
4
+ "version": "1.1.2",
5
5
  "name": "ccommit",
6
6
  "description": "😜 ➕ 👔 🟰 ccommit \n Conventional Commit Generator that interprets commit types from gitmoji and conventional",
7
7
  "author": {
@@ -48,12 +48,12 @@
48
48
  "dependencies": {
49
49
  "ansi-colors": "4.1.3",
50
50
  "enquirer": "2.3.6",
51
- "execa": "6.1.0",
51
+ "execa": "7.1.1",
52
52
  "fuse.js": "6.6.2",
53
53
  "meow": "11.0.0"
54
54
  },
55
55
  "devDependencies": {
56
- "pkg": "5.8.0"
56
+ "pkg": "5.8.1"
57
57
  },
58
58
  "peerDependencies": {},
59
59
  "bin": {