@anolilab/commitlint-config 1.0.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/CHANGELOG.md +13 -0
- package/LICENSE.md +21 -0
- package/README.md +223 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5 -0
- package/dist/index.mjs.map +1 -0
- package/dist/postinstall.d.ts +2 -0
- package/dist/postinstall.js +19 -0
- package/dist/postinstall.js.map +1 -0
- package/dist/postinstall.mjs +17 -0
- package/dist/postinstall.mjs.map +1 -0
- package/package.json +79 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## @anolilab/commitlint-config 1.0.0 (2023-06-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* create commitlint-config package ([ef83403](https://github.com/anolilab/javascript-style-guide/commit/ef83403ccd4123f5a8fd6967b0c59261377e079c))
|
|
7
|
+
* removed eslint-plugin-optimize-regex, using the unicorn rule for it ([3fea9de](https://github.com/anolilab/javascript-style-guide/commit/3fea9de9fc88713d40dffa66daa8b835210ae3ba))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* **@anolilab/package-json-utils:** upgraded to 1.5.0
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Anolilab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>Shareable Commitlint Configuration</h1>
|
|
3
|
+
|
|
4
|
+
A shareable commitlint configuration for enforcing consistent commit messages in your projects.
|
|
5
|
+
|
|
6
|
+
[![npm-image]][npm-url] [![license-image]][license-url]
|
|
7
|
+
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<div align="center">
|
|
13
|
+
<p>
|
|
14
|
+
<sup>
|
|
15
|
+
Daniel Bannert's open source work is supported by the community on <a href="https://github.com/sponsors/prisis">GitHub Sponsors</a>
|
|
16
|
+
</sup>
|
|
17
|
+
</p>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Purpose
|
|
23
|
+
|
|
24
|
+
- Ensure a cohesive structure for all commits in your project with a comprehensive set of rules.
|
|
25
|
+
- Consistency in commit messages plays a pivotal role in fostering effective project collaboration, enhancing maintainability, and preserving project history.
|
|
26
|
+
- By leveraging commitlint configuration, you can effortlessly enforce a standardized structure for all commits in your project.
|
|
27
|
+
- This valuable tool facilitates better comprehension of the changes made and the reasoning behind them, enabling seamless understanding for your entire team.
|
|
28
|
+
- This configuration also includes a semantic-release configuration, which enables automated GitHub/NPM releases based on your commit messages.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install --dev-save @commitlint/cli @anolilab/commitlint-config
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
yarn add -D @commitlint/cli @anolilab/commitlint-config
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
pnpm add -D @commitlint/cli @anolilab/commitlint-config
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
When installing this package for the first time, the following shareable configuration `commitlint.config.js` is automatically added to your project folder:
|
|
47
|
+
|
|
48
|
+
> Note: If the script detects an existing `commitlint.config.js` file, it will not overwrite it.
|
|
49
|
+
|
|
50
|
+
> Note: It can happen that the postinstall script dont run, then you have to add the `commitlint.config.js` manually.
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
module.exports = {
|
|
54
|
+
extends: ['@anolilab/commitlint-config'],
|
|
55
|
+
rules: {
|
|
56
|
+
// overwrite rules here
|
|
57
|
+
// or extend rules
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
```
|
|
61
|
+
or
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
export default {
|
|
65
|
+
extends: ['@anolilab/commitlint-config'],
|
|
66
|
+
rules: {
|
|
67
|
+
// overwrite rules here
|
|
68
|
+
// or extend rules
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This extends the `@anolilab/commitlint-config` and uses its pre-defined configuration.
|
|
74
|
+
|
|
75
|
+
> Alternatively the configuration can be defined in a `commitlint.config.js`, `.commitlintrc.js`, `.commitlintrc`, `.commitlintrc.json`, `.commitlintrc.yml` file
|
|
76
|
+
|
|
77
|
+
## Commitlint Rules
|
|
78
|
+
|
|
79
|
+
The following customized rules are included in this configuration:
|
|
80
|
+
|
|
81
|
+
- `body-leading-blank`: There must be a blank line between the subject and the body.
|
|
82
|
+
- `body-max-line-length`: The body must not exceed 100 characters per line.
|
|
83
|
+
- `footer-leading-blank`: There must be a blank line between the body and the footer.
|
|
84
|
+
- `footer-max-line-length`: The footer must not exceed 100 characters per line.
|
|
85
|
+
- `header-max-length`: The header must not exceed 100 characters per line.
|
|
86
|
+
- `scope-case`: The scope must be lowercase and use kebab-case.
|
|
87
|
+
- `scope-empty`: The scope is optional.
|
|
88
|
+
- `subject-case`: The subject must start with a capital letter and use sentence case.
|
|
89
|
+
- `subject-empty`: The subject is required.
|
|
90
|
+
- `subject-full-stop`: The subject must not end with a period.
|
|
91
|
+
- `type-case`: The type must be lowercase.
|
|
92
|
+
- `type-empty`: The type is required.
|
|
93
|
+
- `type-enum`: The type must be one of the following:
|
|
94
|
+
- `build`: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
|
95
|
+
- `chore`: Changes to the build process or auxiliary tools and libraries such as documentation generation
|
|
96
|
+
- `ci`: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
|
97
|
+
- `deps`: Changes that add, update, or remove dependencies
|
|
98
|
+
- `docs`: Documentation only changes
|
|
99
|
+
- `feat`: A new feature
|
|
100
|
+
- `fix`: A bug fix
|
|
101
|
+
- `perf`: A code change that improves performance
|
|
102
|
+
- `refactor`: A code change that neither fixes a bug nor adds a feature
|
|
103
|
+
- `revert`: Reverts a previous commit
|
|
104
|
+
- `security`: A code change that improves security
|
|
105
|
+
- `style`: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
|
106
|
+
- `test`: Adding missing tests or correcting existing tests
|
|
107
|
+
- `translation`: Translation changes
|
|
108
|
+
|
|
109
|
+
and all rules from [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional).
|
|
110
|
+
|
|
111
|
+
## Add a Package.json Script
|
|
112
|
+
|
|
113
|
+
To add an NPM script for running `commitlint` use command, which will add the `lint:commits` script to the scripts section of your `package.json`.
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
pnpm pkg set scripts.lint:commits="pnpm commitlint --from HEAD~1 --to HEAD --verbose"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
> For `npm` users, replace `pnpm` with `npm` in the above command.
|
|
120
|
+
|
|
121
|
+
## Husky
|
|
122
|
+
|
|
123
|
+
### Install
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
pnpm add -D husky is-ci
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
To add a `commit-msg` hook to your project, run the following command:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
npx husky add .husky/commit-msg 'pnpm commitlint --edit "${1}"'
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
And for `package.json`:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
pnpm pkg set scripts.prepare="is-ci || husky install"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
> For `npm` users, replace `pnpm` with `npm` in the above command.
|
|
142
|
+
|
|
143
|
+
## Test the configuration
|
|
144
|
+
|
|
145
|
+
For a first simple usage test of commitlint you can do the following:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# using pnpm
|
|
149
|
+
$ pnpm commitlint --from HEAD~1 --to HEAD --verbose
|
|
150
|
+
|
|
151
|
+
# or, using npx
|
|
152
|
+
$ npx commitlint --from HEAD~1 --to HEAD --verbose
|
|
153
|
+
|
|
154
|
+
# or, if script was added
|
|
155
|
+
$ pnpm lint:commits
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
This will check your last commit and return an error if invalid or a positive output if valid.
|
|
159
|
+
|
|
160
|
+
### Test the hook
|
|
161
|
+
|
|
162
|
+
You can test the hook by simply committing. If the commit message is valid, the commit will go through, otherwise you will see an error message.
|
|
163
|
+
|
|
164
|
+
Here's an example of what the error message would look like if your commit message doesn't meet the required format:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
$ git commit -m "foo: this will fail"
|
|
168
|
+
husky > commit-msg (node v10.1.0)
|
|
169
|
+
No staged files match any of provided globs.
|
|
170
|
+
⧗ input: foo: this will fail
|
|
171
|
+
✖ type must be one of [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test] [type-enum]
|
|
172
|
+
|
|
173
|
+
✖ found 1 problems, 0 warnings
|
|
174
|
+
ⓘ Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
|
|
175
|
+
|
|
176
|
+
husky > commit-msg hook failed (add --no-verify to bypass)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
If your commit message meets the required format, you should see a message like this:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
$ git commit -m "feat: add new feature"
|
|
183
|
+
husky > commit-msg (node v10.1.0)
|
|
184
|
+
[master 9d41607] feat: add new feature
|
|
185
|
+
1 file changed, 1 insertion(+)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Supported Node.js Versions
|
|
189
|
+
|
|
190
|
+
Libraries in this ecosystem make the best effort to track
|
|
191
|
+
[Node.js’ release schedule](https://nodejs.org/en/about/releases/). Here’s [a
|
|
192
|
+
post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
|
|
193
|
+
|
|
194
|
+
Contributing
|
|
195
|
+
------------
|
|
196
|
+
|
|
197
|
+
If you would like to help take a look at the [list of issues](https://github.com/anolilab/javascript-style-guide/issues) and check our [Contributing](.github/CONTRIBUTING.md) guild.
|
|
198
|
+
|
|
199
|
+
> **Note:** please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
|
|
200
|
+
|
|
201
|
+
Credits
|
|
202
|
+
-------------
|
|
203
|
+
|
|
204
|
+
- [Daniel Bannert](https://github.com/prisis)
|
|
205
|
+
- [All Contributors](https://github.com/anolilab/javascript-style-guide/graphs/contributors)
|
|
206
|
+
|
|
207
|
+
License
|
|
208
|
+
-------------
|
|
209
|
+
|
|
210
|
+
The anolilab javascript-style-guide is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT)
|
|
211
|
+
|
|
212
|
+
[1]: https://github.com/semantic-release/commit-analyzer
|
|
213
|
+
[2]: https://github.com/semantic-release/release-notes-generator
|
|
214
|
+
[3]: https://github.com/semantic-release/changelog
|
|
215
|
+
[4]: https://github.com/semantic-release/github
|
|
216
|
+
[5]: https://github.com/semantic-release/exec
|
|
217
|
+
[6]: https://github.com/semantic-release/git
|
|
218
|
+
[7]: https://github.com/semantic-release/npm
|
|
219
|
+
|
|
220
|
+
[license-image]: https://img.shields.io/npm/l/@anolilab/semantic-release-preset?color=blueviolet&style=for-the-badge
|
|
221
|
+
[license-url]: LICENSE.md "license"
|
|
222
|
+
[npm-image]: https://img.shields.io/npm/v/@anolilab/semantic-release-preset/latest.svg?style=for-the-badge&logo=npm
|
|
223
|
+
[npm-url]: https://www.npmjs.com/package/@anolilab/semantic-release-preset/v/latest "npm"
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const config: {
|
|
2
|
+
extends: string[];
|
|
3
|
+
ignores: ((commitMessage: string) => boolean)[];
|
|
4
|
+
rules: {
|
|
5
|
+
"body-leading-blank": (string | number)[];
|
|
6
|
+
"body-max-line-length": (string | number)[];
|
|
7
|
+
"footer-leading-blank": (string | number)[];
|
|
8
|
+
"footer-max-line-length": (string | number)[];
|
|
9
|
+
"header-max-length": (string | number)[];
|
|
10
|
+
"scope-case": (string | number)[];
|
|
11
|
+
"subject-case": (string | number | string[])[];
|
|
12
|
+
"subject-empty": (string | number)[];
|
|
13
|
+
"subject-full-stop": (string | number)[];
|
|
14
|
+
"type-case": (string | number)[];
|
|
15
|
+
"type-empty": (string | number)[];
|
|
16
|
+
"type-enum": (string | number | string[])[];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { config as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var a=/^chore\(release\):.*\[skip ci\]/,t={extends:["@commitlint/config-conventional"],ignores:[e=>a.test(e)],rules:{"body-leading-blank":[1,"always"],"body-max-line-length":[2,"always",100],"footer-leading-blank":[1,"always"],"footer-max-line-length":[2,"always",100],"header-max-length":[2,"always",100],"scope-case":[2,"always","lower-case"],"subject-case":[2,"never",["sentence-case","start-case","pascal-case","upper-case"]],"subject-empty":[2,"never"],"subject-full-stop":[2,"never","."],"type-case":[2,"always","lower-case"],"type-empty":[2,"never"],"type-enum":[2,"always",["build","chore","ci","deps","docs","feat","fix","perf","refactor","revert","security","style","test","translation"]]}},s=t;
|
|
4
|
+
|
|
5
|
+
module.exports = s;
|
|
6
|
+
//# sourceMappingURL=out.js.map
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["automaticCommitPattern","config","commitMessage","src_default"],"mappings":"AACA,IAAMA,EAAyB,kCAEzBC,EAAS,CACX,QAAS,CAAC,iCAAiC,EAM3C,QAAS,CAAEC,GAAmCF,EAAuB,KAAKE,CAAa,CAAC,EACxF,MAAO,CACH,qBAAsB,CAAC,EAAG,QAAQ,EAClC,uBAAwB,CAAC,EAAG,SAAU,GAAG,EACzC,uBAAwB,CAAC,EAAG,QAAQ,EACpC,yBAA0B,CAAC,EAAG,SAAU,GAAG,EAC3C,oBAAqB,CAAC,EAAG,SAAU,GAAG,EACtC,aAAc,CAAC,EAAG,SAAU,YAAY,EACxC,eAAgB,CAAC,EAAG,QAAS,CAAC,gBAAiB,aAAc,cAAe,YAAY,CAAC,EACzF,gBAAiB,CAAC,EAAG,OAAO,EAC5B,oBAAqB,CAAC,EAAG,QAAS,GAAG,EACrC,YAAa,CAAC,EAAG,SAAU,YAAY,EACvC,aAAc,CAAC,EAAG,OAAO,EACzB,YAAa,CACT,EACA,SACA,CACI,QACA,QACA,KACA,OACA,OACA,OACA,MACA,OACA,WACA,SACA,WACA,QACA,OACA,aACJ,CACJ,CACJ,CACJ,EAEOC,EAAQF","sourcesContent":["// eslint-disable-next-line unicorn/better-regex\nconst automaticCommitPattern = /^chore\\(release\\):.*\\[skip ci\\]/;\n\nconst config = {\n extends: [\"@commitlint/config-conventional\"],\n /**\n * This resolves a linting conflict between commitlint's body-max-line-length\n * due to @semantic-release/git putting release notes in the commit body\n * https://github.com/semantic-release/git/issues/331\n */\n ignores: [(commitMessage: string): boolean => automaticCommitPattern.test(commitMessage)],\n rules: {\n \"body-leading-blank\": [1, \"always\"],\n \"body-max-line-length\": [2, \"always\", 100],\n \"footer-leading-blank\": [1, \"always\"],\n \"footer-max-line-length\": [2, \"always\", 100],\n \"header-max-length\": [2, \"always\", 100],\n \"scope-case\": [2, \"always\", \"lower-case\"],\n \"subject-case\": [2, \"never\", [\"sentence-case\", \"start-case\", \"pascal-case\", \"upper-case\"]],\n \"subject-empty\": [2, \"never\"],\n \"subject-full-stop\": [2, \"never\", \".\"],\n \"type-case\": [2, \"always\", \"lower-case\"],\n \"type-empty\": [2, \"never\"],\n \"type-enum\": [\n 2,\n \"always\",\n [\n \"build\",\n \"chore\",\n \"ci\",\n \"deps\",\n \"docs\",\n \"feat\",\n \"fix\",\n \"perf\",\n \"refactor\",\n \"revert\",\n \"security\",\n \"style\",\n \"test\",\n \"translation\",\n ],\n ],\n },\n};\n\nexport default config;\n"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var a=/^chore\(release\):.*\[skip ci\]/,t={extends:["@commitlint/config-conventional"],ignores:[e=>a.test(e)],rules:{"body-leading-blank":[1,"always"],"body-max-line-length":[2,"always",100],"footer-leading-blank":[1,"always"],"footer-max-line-length":[2,"always",100],"header-max-length":[2,"always",100],"scope-case":[2,"always","lower-case"],"subject-case":[2,"never",["sentence-case","start-case","pascal-case","upper-case"]],"subject-empty":[2,"never"],"subject-full-stop":[2,"never","."],"type-case":[2,"always","lower-case"],"type-empty":[2,"never"],"type-enum":[2,"always",["build","chore","ci","deps","docs","feat","fix","perf","refactor","revert","security","style","test","translation"]]}},s=t;
|
|
2
|
+
|
|
3
|
+
export { s as default };
|
|
4
|
+
//# sourceMappingURL=out.js.map
|
|
5
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["automaticCommitPattern","config","commitMessage","src_default"],"mappings":"AACA,IAAMA,EAAyB,kCAEzBC,EAAS,CACX,QAAS,CAAC,iCAAiC,EAM3C,QAAS,CAAEC,GAAmCF,EAAuB,KAAKE,CAAa,CAAC,EACxF,MAAO,CACH,qBAAsB,CAAC,EAAG,QAAQ,EAClC,uBAAwB,CAAC,EAAG,SAAU,GAAG,EACzC,uBAAwB,CAAC,EAAG,QAAQ,EACpC,yBAA0B,CAAC,EAAG,SAAU,GAAG,EAC3C,oBAAqB,CAAC,EAAG,SAAU,GAAG,EACtC,aAAc,CAAC,EAAG,SAAU,YAAY,EACxC,eAAgB,CAAC,EAAG,QAAS,CAAC,gBAAiB,aAAc,cAAe,YAAY,CAAC,EACzF,gBAAiB,CAAC,EAAG,OAAO,EAC5B,oBAAqB,CAAC,EAAG,QAAS,GAAG,EACrC,YAAa,CAAC,EAAG,SAAU,YAAY,EACvC,aAAc,CAAC,EAAG,OAAO,EACzB,YAAa,CACT,EACA,SACA,CACI,QACA,QACA,KACA,OACA,OACA,OACA,MACA,OACA,WACA,SACA,WACA,QACA,OACA,aACJ,CACJ,CACJ,CACJ,EAEOC,EAAQF","sourcesContent":["// eslint-disable-next-line unicorn/better-regex\nconst automaticCommitPattern = /^chore\\(release\\):.*\\[skip ci\\]/;\n\nconst config = {\n extends: [\"@commitlint/config-conventional\"],\n /**\n * This resolves a linting conflict between commitlint's body-max-line-length\n * due to @semantic-release/git putting release notes in the commit body\n * https://github.com/semantic-release/git/issues/331\n */\n ignores: [(commitMessage: string): boolean => automaticCommitPattern.test(commitMessage)],\n rules: {\n \"body-leading-blank\": [1, \"always\"],\n \"body-max-line-length\": [2, \"always\", 100],\n \"footer-leading-blank\": [1, \"always\"],\n \"footer-max-line-length\": [2, \"always\", 100],\n \"header-max-length\": [2, \"always\", 100],\n \"scope-case\": [2, \"always\", \"lower-case\"],\n \"subject-case\": [2, \"never\", [\"sentence-case\", \"start-case\", \"pascal-case\", \"upper-case\"]],\n \"subject-empty\": [2, \"never\"],\n \"subject-full-stop\": [2, \"never\", \".\"],\n \"type-case\": [2, \"always\", \"lower-case\"],\n \"type-empty\": [2, \"never\"],\n \"type-enum\": [\n 2,\n \"always\",\n [\n \"build\",\n \"chore\",\n \"ci\",\n \"deps\",\n \"docs\",\n \"feat\",\n \"fix\",\n \"perf\",\n \"refactor\",\n \"revert\",\n \"security\",\n \"style\",\n \"test\",\n \"translation\",\n ],\n ],\n },\n};\n\nexport default config;\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var packageJsonUtils = require('@anolilab/package-json-utils');
|
|
4
|
+
var fs = require('fs');
|
|
5
|
+
var path = require('path');
|
|
6
|
+
var util = require('util');
|
|
7
|
+
|
|
8
|
+
process.env.CI&&process.exit(0);var i=util.promisify(fs.writeFile);console.log("Configuring @anolilab/commitlint-config",packageJsonUtils.projectPath,`
|
|
9
|
+
`);var a=()=>{let o=path.join(packageJsonUtils.projectPath,"commitlint.config.js");return fs.existsSync(o)?(console.warn("\u26A0\uFE0F commitlint.config.js already exists;"),Promise.resolve()):i(o,`${packageJsonUtils.packageIsTypeModule?"export default":"module.exports ="} {
|
|
10
|
+
extends: ["@commitlint/config-conventional"],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
`,"utf-8")},m=()=>{let o=path.join(packageJsonUtils.projectPath,".czrc");return fs.existsSync(o)?(console.warn("\u26A0\uFE0F .czrc already exists;"),Promise.resolve()):i(o,`{
|
|
14
|
+
"path": "cz-conventional-changelog"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
`,"utf-8")};(async()=>{try{await a(),await m(),console.log("\u{1F60E} Everything went well, have fun!"),process.exit(0);}catch(o){console.log("\u{1F62C} something went wrong:"),console.error(o),process.exit(1);}})();
|
|
18
|
+
//# sourceMappingURL=out.js.map
|
|
19
|
+
//# sourceMappingURL=postinstall.js.map
|
|
@@ -0,0 +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,GASpBF,EAAeE,EANN,GAAGR,EAAsB,iBAAmB;AAAA;AAAA;AAAA;AAAA,EAMb,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: [\"@commitlint/config-conventional\"],\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"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { projectPath, packageIsTypeModule } from '@anolilab/package-json-utils';
|
|
2
|
+
import { writeFile, existsSync } from 'fs';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import { promisify } from 'util';
|
|
5
|
+
|
|
6
|
+
process.env.CI&&process.exit(0);var i=promisify(writeFile);console.log("Configuring @anolilab/commitlint-config",projectPath,`
|
|
7
|
+
`);var a=()=>{let o=join(projectPath,"commitlint.config.js");return existsSync(o)?(console.warn("\u26A0\uFE0F commitlint.config.js already exists;"),Promise.resolve()):i(o,`${packageIsTypeModule?"export default":"module.exports ="} {
|
|
8
|
+
extends: ["@commitlint/config-conventional"],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
`,"utf-8")},m=()=>{let o=join(projectPath,".czrc");return existsSync(o)?(console.warn("\u26A0\uFE0F .czrc already exists;"),Promise.resolve()):i(o,`{
|
|
12
|
+
"path": "cz-conventional-changelog"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
`,"utf-8")};(async()=>{try{await a(),await m(),console.log("\u{1F60E} Everything went well, have fun!"),process.exit(0);}catch(o){console.log("\u{1F62C} something went wrong:"),console.error(o),process.exit(1);}})();
|
|
16
|
+
//# sourceMappingURL=out.js.map
|
|
17
|
+
//# sourceMappingURL=postinstall.mjs.map
|
|
@@ -0,0 +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,GASpBF,EAAeE,EANN,GAAGR,EAAsB,iBAAmB;AAAA;AAAA;AAAA;AAAA,EAMb,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: [\"@commitlint/config-conventional\"],\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
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@anolilab/commitlint-config",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Anolilab´s shareable coding standard config for commitlint.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"anolilab",
|
|
7
|
+
"commitlint",
|
|
8
|
+
"commitlint-config"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://anolilab.com/nodejs/packages/commitlint-config",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/anolilab/javascript-style-guide.git",
|
|
14
|
+
"directory": "packages/commitlint-config"
|
|
15
|
+
},
|
|
16
|
+
"funding": [
|
|
17
|
+
{
|
|
18
|
+
"type": "github",
|
|
19
|
+
"url": "https://github.com/sponsors/prisis"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "consulting",
|
|
23
|
+
"url": "https://anolilab.com/support"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"author": {
|
|
28
|
+
"name": "Daniel Bannert",
|
|
29
|
+
"email": "d.bannert@anolilab.de"
|
|
30
|
+
},
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"require": "./dist/index.js",
|
|
35
|
+
"import": "./dist/index.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./package.json": "./package.json"
|
|
38
|
+
},
|
|
39
|
+
"main": "dist/index.js",
|
|
40
|
+
"module": "dist/index.mjs",
|
|
41
|
+
"types": "dist/index.d.ts",
|
|
42
|
+
"files": [
|
|
43
|
+
"dist",
|
|
44
|
+
"README.md",
|
|
45
|
+
"CHANGELOG.md",
|
|
46
|
+
"LICENSE.md"
|
|
47
|
+
],
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "cross-env NODE_ENV=development tsup",
|
|
50
|
+
"build:prod": "cross-env NODE_ENV=production tsup",
|
|
51
|
+
"clean": "rimraf node_modules dist",
|
|
52
|
+
"postinstall": "node ./skip.js || node ./dist/postinstall.js"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@anolilab/package-json-utils": "1.5.0",
|
|
56
|
+
"@commitlint/config-conventional": "^17.6.5",
|
|
57
|
+
"@commitlint/core": "^17.6.5",
|
|
58
|
+
"commitizen": "^4.3.0",
|
|
59
|
+
"conventional-changelog-conventionalcommits": "^6.0.0",
|
|
60
|
+
"cz-conventional-changelog": "^3.3.0"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@commitlint/cli": "^17.6.5"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"@commitlint/cli": "^17.6.5"
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">=16"
|
|
70
|
+
},
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"access": "public",
|
|
73
|
+
"provenance": true
|
|
74
|
+
},
|
|
75
|
+
"sources": [
|
|
76
|
+
"src/index.ts",
|
|
77
|
+
"src/postinstall.ts"
|
|
78
|
+
]
|
|
79
|
+
}
|