Skip to content

Commit 7a3d472

Browse files
authored
chore: update husky to v9 (#3875)
* chore: update dependency husky to v9 * docs: update local-setup instructions - update setup instructions for husky@v9 - move release operation instructions inside CONTRIBUTING
1 parent b6a0564 commit 7a3d472

File tree

7 files changed

+225
-190
lines changed

7 files changed

+225
-190
lines changed

.github/CONTRIBUTING.md

+90
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,93 @@ To make your life easier commitlint is commitizen-friendly and provides the npm
6060
- present tense
6161
- maximum of 100 characters
6262
- message format of `$type($scope): $message`
63+
64+
## Testing
65+
66+
From the project root directory, use the following commands to run the test suite
67+
68+
```sh
69+
yarn clean
70+
yarn install
71+
yarn build
72+
yarn test
73+
```
74+
75+
## Package dependency overview
76+
77+
![commitlint-dependencies](https://user-images.githubusercontent.com/4248851/58385093-34b79780-7feb-11e9-8f27-bffc4aca3eba.png)
78+
79+
(Partly outdated)
80+
81+
## Publishing a release
82+
83+
```sh
84+
npm login
85+
nvm use (if you have nvm installed)
86+
```
87+
88+
- [nvm](https://github.com/nvm-sh/nvm)
89+
- [asdf](https://asdf-vm.com/) is supported as well
90+
91+
```sh
92+
yarn clean
93+
yarn install
94+
yarn build
95+
yarn test
96+
yarn run publish --otp <one-time password>
97+
```
98+
99+
If something in between fails (like a new package was added and needs to be published for the
100+
first time but you forgot) you can use `lerna publish from-package` to publish anything that
101+
has not been published yet.
102+
103+
### Create GitHub release
104+
105+
1. Copy changelog entry for the new version
106+
1. Create release for the new tag: https://github.com/conventional-changelog/commitlint/releases
107+
1. Post in the [commitlint Slack-channel][12]
108+
109+
### Publish a `next` release (or i.e. patch release)
110+
111+
```sh
112+
npm login
113+
nvm use (if you have nvm installed)
114+
```
115+
116+
```sh
117+
yarn clean
118+
yarn install
119+
yarn build
120+
yarn test
121+
npx lerna publish --conventional-commits --dist-tag [`next` | `[PATCH_RELEASE_VERSION]`] --otp <one-time password>
122+
```
123+
124+
If for some reason this stops in between, you can manually publish missing packages like this:
125+
126+
```sh
127+
npm publish <package-name> --tag [`next` | `[PATCH_RELEASE_VERSION]`] --otp <one-time password>
128+
```
129+
130+
#### Publishing (new) packages for the first time
131+
132+
```sh
133+
npm publish [PACKAGE_NAME] --access public
134+
```
135+
136+
From within the folder first i.e. `cd @commitlint/new-packages`.
137+
138+
#### Move `next` to `latest`
139+
140+
```sh
141+
npm login
142+
```
143+
144+
```sh
145+
npx lerna exec --no-bail --no-private --no-sort --stream -- '[ -n "$(npm v . dist-tags.next)" ] && npm dist-tag add ${LERNA_PACKAGE_NAME}@$(npm v . dist-tags.next) latest --otp <one-time password>'
146+
```
147+
148+
Remove next:
149+
150+
```sh
151+
npx lerna exec --no-bail --no-private --no-sort --stream -- '[ -n "$(npm v . dist-tags.next)" ] && npm dist-tag rm ${LERNA_PACKAGE_NAME} next --otp <one-time password>'
152+
```

.husky/commit-msg

100755100644
+1-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
3-
4-
node @commitlint/cli/lib/cli.js --edit $1
1+
node @commitlint/cli/lib/cli.js --edit $1

.husky/pre-commit

100755100644
+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
1+
yarn lint-staged
32

4-
yarn lint-staged
3+
# be sure to build with up to date source
4+
# before running pre-commit hook which is using `@commitlint/cli/lib/cli.js`
5+
yarn build

README.md

+21-153
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,24 @@
1818

1919
## Contents
2020

21-
- [What is commitlint](#what-is-commitlint)
22-
- [Benefits of using commitlint](#benefits-using-commitlint)
23-
- [Getting started](#getting-started)
24-
- [CLI](#cli)
25-
- [Config](#config)
26-
- [Shared configuration](#shared-configuration)
27-
- [API](#api)
28-
- [Tools](#tools)
29-
- [Version Support and Releases](#version-support-and-releases)
30-
- [Related projects](#related-projects)
31-
- [License](#license)
32-
- [Development](#development)
33-
- [Install and run](#install-and-run)
34-
- [Testing](#testing)
35-
- [Publishing a release](#publishing-a-release)
21+
- [Get Started | Website](#get-started--website)
22+
- [Contents](#contents)
23+
- [What is commitlint](#what-is-commitlint)
24+
- [Benefits of using commitlint](#benefits-of-using-commitlint)
25+
- [Getting started](#getting-started)
26+
- [CLI](#cli)
27+
- [Config](#config)
28+
- [Shared configuration](#shared-configuration)
29+
- [Documentation](#documentation)
30+
- [API](#api)
31+
- [Tools](#tools)
32+
- [Roadmap](#roadmap)
33+
- [Version Support and Releases](#version-support-and-releases)
34+
- [Releases](#releases)
35+
- [Related projects](#related-projects)
36+
- [License](#license)
37+
- [Development](#development)
38+
- [Install and run](#install-and-run)
3639

3740
---
3841

@@ -48,15 +51,15 @@ type(scope?): subject #scope is optional; multiple scopes are supported (curren
4851

4952
Real world examples can look like this:
5053

51-
```
54+
```text
5255
chore: run tests on travis ci
5356
```
5457

55-
```
58+
```text
5659
fix(server): send cors headers
5760
```
5861

59-
```
62+
```text
6063
feat(blog): add comment section
6164
```
6265

@@ -83,51 +86,6 @@ These can be modified by [your own configuration](#config).
8386

8487
## Getting started
8588

86-
```sh
87-
# Install commitlint cli and conventional config
88-
npm install --save-dev @commitlint/{config-conventional,cli}
89-
# For Windows:
90-
npm install --save-dev @commitlint/config-conventional @commitlint/cli
91-
92-
# Configure commitlint to use conventional config
93-
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
94-
```
95-
96-
To lint commits before they are created you can use Husky's `commit-msg` hook:
97-
98-
```sh
99-
# Install Husky v6
100-
npm install husky --save-dev
101-
# or
102-
yarn add husky --dev
103-
104-
# Activate hooks
105-
npx husky install
106-
# or
107-
yarn husky install
108-
```
109-
110-
### Add hook
111-
112-
> [!WARNING]
113-
> It's necessary that you use **commit-msg** as the name for hook file.
114-
> Read Git hooks [documentation](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) for more info.
115-
116-
```
117-
npx husky add .husky/commit-msg 'npx --no -- commitlint --edit ${1}'
118-
```
119-
120-
**Or use installed package instead**
121-
122-
```
123-
npm pkg set scripts.commitlint="commitlint --edit"
124-
npx husky add .husky/commit-msg 'npm run commitlint ${1}'
125-
```
126-
127-
Check the [husky documentation](https://typicode.github.io/husky/#/?id=manual) on how you can automatically have Git hooks enabled after install for different `yarn` versions.
128-
129-
**Detailed Setup instructions**
130-
13189
- [Local setup](https://conventional-changelog.github.io/commitlint/#/guides-local-setup) - Lint messages on commit with husky
13290
- [CI setup](https://conventional-changelog.github.io/commitlint/#/guides-ci-setup) - Lint messages during CI builds
13391

@@ -255,96 +213,6 @@ yarn run commitlint # run CLI
255213

256214
For more information on how to contribute please take a look at our [contribution guide](./.github/CONTRIBUTING.md).
257215

258-
### Testing
259-
260-
From the project root directory, use the following commands to run the test suite
261-
262-
```sh
263-
yarn clean
264-
yarn install
265-
yarn build
266-
yarn test
267-
```
268-
269-
### Package dependency overview
270-
271-
![commitlint-dependencies](https://user-images.githubusercontent.com/4248851/58385093-34b79780-7feb-11e9-8f27-bffc4aca3eba.png)
272-
273-
(Partly outdated)
274-
275-
### Publishing a release
276-
277-
```sh
278-
npm login
279-
nvm use (if you have nvm installed)
280-
```
281-
282-
- [nvm](https://github.com/nvm-sh/nvm)
283-
- [asdf](https://asdf-vm.com/) is supported as well
284-
285-
```sh
286-
yarn clean
287-
yarn install
288-
yarn build
289-
yarn test
290-
yarn run publish --otp <one-time password>
291-
```
292-
293-
If something in between fails (like a new package was added and needs to be published for the
294-
first time but you forgot) you can use `lerna publish from-package` to publish anything that
295-
has not been published yet.
296-
297-
#### Create GitHub release
298-
299-
1. Copy changelog entry for the new version
300-
1. Create release for the new tag: https://github.com/conventional-changelog/commitlint/releases
301-
1. Post in the [commitlint Slack-channel][12]
302-
303-
#### Publish a `next` release (or i.e. patch release)
304-
305-
```sh
306-
npm login
307-
nvm use (if you have nvm installed)
308-
```
309-
310-
```sh
311-
yarn clean
312-
yarn install
313-
yarn build
314-
yarn test
315-
npx lerna publish --conventional-commits --dist-tag [`next` | `[PATCH_RELEASE_VERSION]`] --otp <one-time password>
316-
```
317-
318-
If for some reason this stops in between, you can manually publish missing packages like this:
319-
320-
```sh
321-
npm publish <package-name> --tag [`next` | `[PATCH_RELEASE_VERSION]`] --otp <one-time password>
322-
```
323-
324-
##### Publishing (new) packages for the first time
325-
326-
```sh
327-
npm publish [PACKAGE_NAME] --access public
328-
```
329-
330-
From within the folder first i.e. `cd @commitlint/new-packages`.
331-
332-
##### Move `next` to `latest`
333-
334-
```sh
335-
npm login
336-
```
337-
338-
```sh
339-
npx lerna exec --no-bail --no-private --no-sort --stream -- '[ -n "$(npm v . dist-tags.next)" ] && npm dist-tag add ${LERNA_PACKAGE_NAME}@$(npm v . dist-tags.next) latest --otp <one-time password>'
340-
```
341-
342-
Remove next:
343-
344-
```sh
345-
npx lerna exec --no-bail --no-private --no-sort --stream -- '[ -n "$(npm v . dist-tags.next)" ] && npm dist-tag rm ${LERNA_PACKAGE_NAME} next --otp <one-time password>'
346-
```
347-
348216
[0]: https://img.shields.io/badge/stability-stable-green.svg?style=flat-square
349217
[1]: https://nodejs.org/api/documentation.html#documentation_stability_index
350218
[2]: https://img.shields.io/npm/v/@commitlint/cli.svg?style=flat-square

0 commit comments

Comments
 (0)