@anolilab/commitlint-config 1.0.2 → 1.0.4

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/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## @anolilab/commitlint-config [1.0.4](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/commitlint-config@1.0.3...@anolilab/commitlint-config@1.0.4) (2023-06-29)
2
+
3
+
4
+
5
+ ### Dependencies
6
+
7
+ * **@anolilab/package-json-utils:** upgraded to 1.5.2
8
+
9
+ ## @anolilab/commitlint-config [1.0.3](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/commitlint-config@1.0.2...@anolilab/commitlint-config@1.0.3) (2023-06-28)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * updated lock, updated @anolilab/package-json-utils and removed baseUrl in the tsconfig that was in the wrong place ([cb08fb5](https://github.com/anolilab/javascript-style-guide/commit/cb08fb5f9fa15f0134327f89f1908199fddaa327))
15
+
1
16
  ## @anolilab/commitlint-config [1.0.2](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/commitlint-config@1.0.1...@anolilab/commitlint-config@1.0.2) (2023-06-28)
2
17
 
3
18
 
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Anolilab
3
+ Copyright (c) 2023 Anolilab
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -135,7 +135,7 @@ npx husky add .husky/commit-msg 'pnpm commitlint --edit "${1}"'
135
135
  And for `package.json`:
136
136
 
137
137
  ```bash
138
- pnpm pkg set scripts.prepare="is-ci || husky install"
138
+ pnpm pkg set scripts.prepare="is-ci || husky install || exit 0"
139
139
  ```
140
140
 
141
141
  > For `npm` users, replace `pnpm` with `npm` in the above command.
@@ -207,8 +207,48 @@ To add a `prepare-commit-msg` hook to your project, run the following command:
207
207
  npx husky add .husky/prepare-commit-msg 'exec < /dev/tty && npx cz --hook || true'
208
208
  ```
209
209
 
210
- > Why `exec < /dev/tty?` By default, git hooks are not interactive.
210
+ > Note: This is only a simple example. To support most cases on Linux, Mac and Windows you can use the other example below.
211
+
212
+ ```bash
213
+ # if we hve a cmd that is running npx cz that means finalize and commit
214
+ FILE=commit.cmd
215
+ if test -f "$FILE"; then
216
+ echo "$FILE exists."
217
+ rm commit.cmd
218
+ exit 0;
219
+ fi
220
+ # if on Windows, spawn a cmd that will run npx cz
221
+ case `uname` in
222
+ *CYGWIN*|*MINGW*|*MSYS* )
223
+ # Only run commitizen if no commit message was already provided.
224
+ if [ -z "${2-}" ]; then
225
+ export CZ_TYPE="${CZ_TYPE:-fix}"
226
+ export CZ_MAX_HEADER_WIDTH=$COMMITLINT_MAX_WIDTH
227
+ export CZ_MAX_LINE_WIDTH=$CZ_MAX_HEADER_WIDTH
228
+ echo "npx cz && exit" > commit.cmd
229
+ start commit.cmd
230
+ exit 1;
231
+ fi
232
+
233
+ exit 0;;
234
+ esac
235
+ # Only run commitizen if no commit message was already provided.
236
+ if [ -z "${2-}" ]; then
237
+ export CZ_TYPE="${CZ_TYPE:-fix}"
238
+ export CZ_MAX_HEADER_WIDTH=$COMMITLINT_MAX_WIDTH
239
+ export CZ_MAX_LINE_WIDTH=$CZ_MAX_HEADER_WIDTH
240
+ # By default git hooks are not interactive. exec < /dev/tty allows a users terminal to interact with commitizen.
241
+ exec < /dev/tty && npx cz --hook || true
242
+ fi
243
+ ```
244
+
211
245
  > This command allows the user to use their terminal to interact with Commitizen during the hook.
246
+ >
247
+ > Why `exec < /dev/tty?` By default, git hooks are not interactive.
248
+
249
+ > Note: If you are using `zsh` you may need to use `exec < /dev/tty?` instead of `exec < /dev/tty`.
250
+
251
+ > Note: For pnpm users, replace `npx` with `pnpx` in the above command.
212
252
 
213
253
  Congratulations! Your repo is Commitizen friendly. Time to flaunt it!
214
254
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/postinstall.ts"],"names":["packageIsTypeModule","projectPath","existsSync","writeFile","join","promisify","writeFileAsync","writeCommitLintConfig","commitlintPath","writeCzrc","filePath","error"],"mappings":"AAAA,OAAS,uBAAAA,EAAqB,eAAAC,MAAmB,+BACjD,OAAS,cAAAC,EAAY,aAAAC,MAAiB,KACtC,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,OAEtB,QAAQ,IAAI,IAEZ,QAAQ,KAAK,CAAC,EAGlB,IAAMC,EAAiBD,EAAUF,CAAS,EAE1C,QAAQ,IAAI,0CAA2CF,EAAa;AAAA,CAAI,EAKxE,IAAMM,EAAwB,IAAM,CAChC,IAAMC,EAAiBJ,EAAKH,EAAa,sBAAsB,EAE/D,OAAIC,EAAWM,CAAc,GACzB,QAAQ,KAAK,oDAA0C,EAEhD,QAAQ,QAAQ,GAapBF,EAAeE,EAVN,GAAGR,EAAsB,iBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUb,OAAO,CAC1D,EAKMS,EAAY,IAAM,CACpB,IAAMC,EAAWN,EAAKH,EAAa,OAAO,EAE1C,OAAIC,EAAWQ,CAAQ,GACnB,QAAQ,KAAK,qCAA2B,EAEjC,QAAQ,QAAQ,GASpBJ,EAAeI,EANN;AAAA;AAAA;AAAA;AAAA,EAMyB,OAAO,CACpD,GAGC,SAAY,CACT,GAAI,CACA,MAAMH,EAAsB,EAC5B,MAAME,EAAU,EAEhB,QAAQ,IAAI,4CAAqC,EAGjD,QAAQ,KAAK,CAAC,CAClB,OAASE,EAAP,CACE,QAAQ,IAAI,kCAA2B,EACvC,QAAQ,MAAMA,CAAK,EAGnB,QAAQ,KAAK,CAAC,CAClB,CACJ,GAAG","sourcesContent":["import { packageIsTypeModule, projectPath } from \"@anolilab/package-json-utils\";\nimport { existsSync, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\nconsole.log(\"Configuring @anolilab/commitlint-config\", projectPath, \"\\n\");\n\n/**\n * Writes commitlint.config.js if it doesn't exist. Warns if it exists.\n */\nconst writeCommitLintConfig = () => {\n const commitlintPath = join(projectPath, \"commitlint.config.js\");\n\n if (existsSync(commitlintPath)) {\n console.warn(\"⚠️ commitlint.config.js already exists;\");\n\n return Promise.resolve();\n }\n\n const content = `${packageIsTypeModule ? \"export default\" : \"module.exports =\"} {\n extends: [\"@anolilab/commitlint-config\"],\n rules: {\n // overwrite rules here\n // or extend rules\n },\n};\n\n`;\n\n return writeFileAsync(commitlintPath, content, \"utf-8\");\n};\n\n/**\n * Writes .czrc if it doesn't exist. Warns if it exists.\n */\nconst writeCzrc = () => {\n const filePath = join(projectPath, \".czrc\");\n\n if (existsSync(filePath)) {\n console.warn(\"⚠️ .czrc already exists;\");\n\n return Promise.resolve();\n }\n\n const content = `{\n \"path\": \"cz-conventional-changelog\"\n}\n\n`;\n\n return writeFileAsync(filePath, content, \"utf-8\");\n};\n\n// eslint-disable-next-line unicorn/prefer-top-level-await\n(async () => {\n try {\n await writeCommitLintConfig();\n await writeCzrc();\n\n console.log(\"😎 Everything went well, have fun!\");\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1);\n }\n})();\n"]}
1
+ {"version":3,"sources":["../src/postinstall.ts"],"names":["packageIsTypeModule","projectPath","existsSync","writeFile","join","promisify","writeFileAsync","writeCommitLintConfig","commitlintPath","writeCzrc","filePath","error"],"mappings":"AAAA,OAAS,uBAAAA,EAAqB,eAAAC,MAAmB,+BACjD,OAAS,cAAAC,EAAY,aAAAC,MAAiB,KACtC,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,OAEtB,QAAQ,IAAI,IAEZ,QAAQ,KAAK,CAAC,EAGlB,IAAMC,EAAiBD,EAAUF,CAAS,EAE1C,QAAQ,IAAI,0CAA2CF,EAAa;AAAA,CAAI,EAKxE,IAAMM,EAAwB,IAAM,CAChC,IAAMC,EAAiBJ,EAAKH,EAAa,sBAAsB,EAE/D,OAAIC,EAAWM,CAAc,GACzB,QAAQ,KAAK,oDAA0C,EAEhD,QAAQ,QAAQ,GAapBF,EAAeE,EAVN,GAAGR,EAAsB,iBAAmB,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAU/B,OAAO,CAC1D,EAKMS,EAAY,IAAM,CACpB,IAAMC,EAAWN,EAAKH,EAAa,OAAO,EAE1C,OAAIC,EAAWQ,CAAQ,GACnB,QAAQ,KAAK,qCAA2B,EAEjC,QAAQ,QAAQ,GASpBJ,EAAeI,EANN;AAAA;AAAA;AAAA;AAAA,EAMyB,OAAO,CACpD,GAGC,SAAY,CACT,GAAI,CACA,MAAMH,EAAsB,EAC5B,MAAME,EAAU,EAEhB,QAAQ,IAAI,4CAAqC,EAGjD,QAAQ,KAAK,CAAC,CAClB,OAASE,EAAP,CACE,QAAQ,IAAI,kCAA2B,EACvC,QAAQ,MAAMA,CAAK,EAGnB,QAAQ,KAAK,CAAC,CAClB,CACJ,GAAG","sourcesContent":["import { packageIsTypeModule, projectPath } from \"@anolilab/package-json-utils\";\nimport { existsSync, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\nconsole.log(\"Configuring @anolilab/commitlint-config\", projectPath, \"\\n\");\n\n/**\n * Writes commitlint.config.js if it doesn't exist. Warns if it exists.\n */\nconst writeCommitLintConfig = () => {\n const commitlintPath = join(projectPath, \"commitlint.config.js\");\n\n if (existsSync(commitlintPath)) {\n console.warn(\"⚠️ commitlint.config.js already exists;\");\n\n return Promise.resolve();\n }\n\n const content = `${packageIsTypeModule ? \"export default\" : \"module.exports =\"} {\n extends: [\"@anolilab/commitlint-config\"],\n rules: {\n // overwrite rules here\n // or extend rules\n },\n};\n\n`;\n\n return writeFileAsync(commitlintPath, content, \"utf-8\");\n};\n\n/**\n * Writes .czrc if it doesn't exist. Warns if it exists.\n */\nconst writeCzrc = () => {\n const filePath = join(projectPath, \".czrc\");\n\n if (existsSync(filePath)) {\n console.warn(\"⚠️ .czrc already exists;\");\n\n return Promise.resolve();\n }\n\n const content = `{\n \"path\": \"cz-conventional-changelog\"\n}\n\n`;\n\n return writeFileAsync(filePath, content, \"utf-8\");\n};\n\n// eslint-disable-next-line unicorn/prefer-top-level-await\n(async () => {\n try {\n await writeCommitLintConfig();\n await writeCzrc();\n\n console.log(\"😎 Everything went well, have fun!\");\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1);\n }\n})();\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/postinstall.ts"],"names":["packageIsTypeModule","projectPath","existsSync","writeFile","join","promisify","writeFileAsync","writeCommitLintConfig","commitlintPath","writeCzrc","filePath","error"],"mappings":"AAAA,OAAS,uBAAAA,EAAqB,eAAAC,MAAmB,+BACjD,OAAS,cAAAC,EAAY,aAAAC,MAAiB,KACtC,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,OAEtB,QAAQ,IAAI,IAEZ,QAAQ,KAAK,CAAC,EAGlB,IAAMC,EAAiBD,EAAUF,CAAS,EAE1C,QAAQ,IAAI,0CAA2CF,EAAa;AAAA,CAAI,EAKxE,IAAMM,EAAwB,IAAM,CAChC,IAAMC,EAAiBJ,EAAKH,EAAa,sBAAsB,EAE/D,OAAIC,EAAWM,CAAc,GACzB,QAAQ,KAAK,oDAA0C,EAEhD,QAAQ,QAAQ,GAapBF,EAAeE,EAVN,GAAGR,EAAsB,iBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUb,OAAO,CAC1D,EAKMS,EAAY,IAAM,CACpB,IAAMC,EAAWN,EAAKH,EAAa,OAAO,EAE1C,OAAIC,EAAWQ,CAAQ,GACnB,QAAQ,KAAK,qCAA2B,EAEjC,QAAQ,QAAQ,GASpBJ,EAAeI,EANN;AAAA;AAAA;AAAA;AAAA,EAMyB,OAAO,CACpD,GAGC,SAAY,CACT,GAAI,CACA,MAAMH,EAAsB,EAC5B,MAAME,EAAU,EAEhB,QAAQ,IAAI,4CAAqC,EAGjD,QAAQ,KAAK,CAAC,CAClB,OAASE,EAAP,CACE,QAAQ,IAAI,kCAA2B,EACvC,QAAQ,MAAMA,CAAK,EAGnB,QAAQ,KAAK,CAAC,CAClB,CACJ,GAAG","sourcesContent":["import { packageIsTypeModule, projectPath } from \"@anolilab/package-json-utils\";\nimport { existsSync, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\nconsole.log(\"Configuring @anolilab/commitlint-config\", projectPath, \"\\n\");\n\n/**\n * Writes commitlint.config.js if it doesn't exist. Warns if it exists.\n */\nconst writeCommitLintConfig = () => {\n const commitlintPath = join(projectPath, \"commitlint.config.js\");\n\n if (existsSync(commitlintPath)) {\n console.warn(\"⚠️ commitlint.config.js already exists;\");\n\n return Promise.resolve();\n }\n\n const content = `${packageIsTypeModule ? \"export default\" : \"module.exports =\"} {\n extends: [\"@anolilab/commitlint-config\"],\n rules: {\n // overwrite rules here\n // or extend rules\n },\n};\n\n`;\n\n return writeFileAsync(commitlintPath, content, \"utf-8\");\n};\n\n/**\n * Writes .czrc if it doesn't exist. Warns if it exists.\n */\nconst writeCzrc = () => {\n const filePath = join(projectPath, \".czrc\");\n\n if (existsSync(filePath)) {\n console.warn(\"⚠️ .czrc already exists;\");\n\n return Promise.resolve();\n }\n\n const content = `{\n \"path\": \"cz-conventional-changelog\"\n}\n\n`;\n\n return writeFileAsync(filePath, content, \"utf-8\");\n};\n\n// eslint-disable-next-line unicorn/prefer-top-level-await\n(async () => {\n try {\n await writeCommitLintConfig();\n await writeCzrc();\n\n console.log(\"😎 Everything went well, have fun!\");\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1);\n }\n})();\n"]}
1
+ {"version":3,"sources":["../src/postinstall.ts"],"names":["packageIsTypeModule","projectPath","existsSync","writeFile","join","promisify","writeFileAsync","writeCommitLintConfig","commitlintPath","writeCzrc","filePath","error"],"mappings":"AAAA,OAAS,uBAAAA,EAAqB,eAAAC,MAAmB,+BACjD,OAAS,cAAAC,EAAY,aAAAC,MAAiB,KACtC,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,OAEtB,QAAQ,IAAI,IAEZ,QAAQ,KAAK,CAAC,EAGlB,IAAMC,EAAiBD,EAAUF,CAAS,EAE1C,QAAQ,IAAI,0CAA2CF,EAAa;AAAA,CAAI,EAKxE,IAAMM,EAAwB,IAAM,CAChC,IAAMC,EAAiBJ,EAAKH,EAAa,sBAAsB,EAE/D,OAAIC,EAAWM,CAAc,GACzB,QAAQ,KAAK,oDAA0C,EAEhD,QAAQ,QAAQ,GAapBF,EAAeE,EAVN,GAAGR,EAAsB,iBAAmB,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAU/B,OAAO,CAC1D,EAKMS,EAAY,IAAM,CACpB,IAAMC,EAAWN,EAAKH,EAAa,OAAO,EAE1C,OAAIC,EAAWQ,CAAQ,GACnB,QAAQ,KAAK,qCAA2B,EAEjC,QAAQ,QAAQ,GASpBJ,EAAeI,EANN;AAAA;AAAA;AAAA;AAAA,EAMyB,OAAO,CACpD,GAGC,SAAY,CACT,GAAI,CACA,MAAMH,EAAsB,EAC5B,MAAME,EAAU,EAEhB,QAAQ,IAAI,4CAAqC,EAGjD,QAAQ,KAAK,CAAC,CAClB,OAASE,EAAP,CACE,QAAQ,IAAI,kCAA2B,EACvC,QAAQ,MAAMA,CAAK,EAGnB,QAAQ,KAAK,CAAC,CAClB,CACJ,GAAG","sourcesContent":["import { packageIsTypeModule, projectPath } from \"@anolilab/package-json-utils\";\nimport { existsSync, writeFile } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { promisify } from \"node:util\";\n\nif (process.env[\"CI\"]) {\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n}\n\nconst writeFileAsync = promisify(writeFile);\n\nconsole.log(\"Configuring @anolilab/commitlint-config\", projectPath, \"\\n\");\n\n/**\n * Writes commitlint.config.js if it doesn't exist. Warns if it exists.\n */\nconst writeCommitLintConfig = () => {\n const commitlintPath = join(projectPath, \"commitlint.config.js\");\n\n if (existsSync(commitlintPath)) {\n console.warn(\"⚠️ commitlint.config.js already exists;\");\n\n return Promise.resolve();\n }\n\n const content = `${packageIsTypeModule ? \"export default\" : \"module.exports =\"} {\n extends: [\"@anolilab/commitlint-config\"],\n rules: {\n // overwrite rules here\n // or extend rules\n },\n};\n\n`;\n\n return writeFileAsync(commitlintPath, content, \"utf-8\");\n};\n\n/**\n * Writes .czrc if it doesn't exist. Warns if it exists.\n */\nconst writeCzrc = () => {\n const filePath = join(projectPath, \".czrc\");\n\n if (existsSync(filePath)) {\n console.warn(\"⚠️ .czrc already exists;\");\n\n return Promise.resolve();\n }\n\n const content = `{\n \"path\": \"cz-conventional-changelog\"\n}\n\n`;\n\n return writeFileAsync(filePath, content, \"utf-8\");\n};\n\n// eslint-disable-next-line unicorn/prefer-top-level-await\n(async () => {\n try {\n await writeCommitLintConfig();\n await writeCzrc();\n\n console.log(\"😎 Everything went well, have fun!\");\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(0);\n } catch (error) {\n console.log(\"😬 something went wrong:\");\n console.error(error);\n\n // eslint-disable-next-line unicorn/no-process-exit\n process.exit(1);\n }\n})();\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anolilab/commitlint-config",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Anolilab´s shareable coding standard config for commitlint.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -52,7 +52,7 @@
52
52
  "postinstall": "node ./skip.js || node ./dist/postinstall.js"
53
53
  },
54
54
  "dependencies": {
55
- "@anolilab/package-json-utils": "1.5.1",
55
+ "@anolilab/package-json-utils": "1.5.2",
56
56
  "@commitlint/config-conventional": "^17.6.6",
57
57
  "@commitlint/core": "^17.6.6",
58
58
  "commitizen": "^4.3.0",
@@ -61,6 +61,7 @@
61
61
  },
62
62
  "devDependencies": {
63
63
  "@commitlint/cli": "^17.6.6",
64
+ "rimraf": "^5.0.1",
64
65
  "tsup": "^7.1.0",
65
66
  "vitest": "^0.32.2"
66
67
  },