Skip to content

Commit

Permalink
chore: migrate to husky 5
Browse files Browse the repository at this point in the history
  • Loading branch information
jdanil committed Feb 6, 2021
1 parent a9f384f commit 6b1a233
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 79 deletions.
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
5 changes: 5 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
. "$(dirname "$0")/common.sh"

yarn commitlint --edit $1
8 changes: 8 additions & 0 deletions .husky/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
command_exists () {
command -v "$1" >/dev/null 2>&1
}

# Windows 10, Git Bash, and Yarn workaround
if command_exists winpty && test -t 1; then
exec < /dev/tty
fi
4 changes: 4 additions & 0 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn install
4 changes: 4 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn install
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
. "$(dirname "$0")/common.sh"

yarn lerna run precommit --concurrency 1 --since master --stream
5 changes: 5 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
. "$(dirname "$0")/common.sh"

yarn lerna run compile --concurrency 1 --since master --stream
9 changes: 0 additions & 9 deletions .huskyrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion docs/configuration/husky.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Pseudocode
- `pre-commit`: `lint-staged`
- `pre-push`: `tsc`

See `.huskyrc.json` for implementation.
See `.husky` for implementation.

## Rationale

Expand Down
10 changes: 3 additions & 7 deletions docs/configuration/lint-staged.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@

## Design

Root `.huskyrc.json`
Root `.husky/pre-commit`

- pre-commit git hook is triggered once from git root
- hook uses `lerna` to spawn "precommit" scripts from packages
- only run on packages changed since branching from `master`
- stream output from the spawned child processes

```json
{
"hooks": {
"pre-commit": "lerna run precommit --concurrency 1 --since master --stream"
}
}
```bash
lerna run precommit --concurrency 1 --since master --stream
```

Package `package.json`
Expand Down
2 changes: 1 addition & 1 deletion docs/decision-log/dependency-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Renovate is much more configurable than dependabot, allowing for more tailored a
##### Auto-Merging

Renovate can be configured to auto-merge changes if status checks pass.
The avoids the need for manual intervention for some changes that may be considered safe.
This avoids the need for manual intervention for some changes that may be considered safe.
Auto-merging can be restricted to particular types of changes (i.e. by any combination of package manager, dependency type, update type, package name pattern, semver, language, data source, target branch, etc.).

##### Deduping
Expand Down
2 changes: 1 addition & 1 deletion docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
- [ ] react-beautiful-dnd (react, react-dom) [issue #1993](https://github.com/atlassian/react-beautiful-dnd/issues/1993)
- [x] react-router-dom (history)
- [ ] react-sweet-state (prop-types, scheduler)
- [ ] react-window-infinite-loader (react, react-dom) [pull #48](https://github.com/bvaughn/react-window-infinite-loader/pull/48)
- [x] react-window-infinite-loader (react, react-dom) [pull #48](https://github.com/bvaughn/react-window-infinite-loader/pull/48)
- [ ] recoil (react) [master](https://github.com/facebookexperimental/recoil)
- [ ] redux-observable (rxjs, tslib) [issue #735](https://github.com/redux-observable/redux-observable/issues/735)
- [x] ts-jest (typescript)
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"lint:all": "lerna run lint:all",
"lint:diff": "lerna run lint:diff",
"lint:lockfile": "lockfile-lint",
"postinstall": "[ -n ${CI:-} ] || husky install",
"release": "lerna publish",
"test": "lerna run test",
"test:ci": "lerna run test",
Expand All @@ -53,7 +54,7 @@
"@package/prettier-config": "0.1.0",
"audit-ci": "3.1.1",
"commitizen": "4.2.3",
"husky": "4.3.8",
"husky": "5.0.8",
"lerna": "3.22.1",
"libyear": "0.6.2",
"lockfile-lint": "4.3.7"
Expand Down
65 changes: 6 additions & 59 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5277,13 +5277,6 @@ __metadata:
languageName: node
linkType: hard

"compare-versions@npm:^3.6.0":
version: 3.6.0
resolution: "compare-versions@npm:3.6.0"
checksum: 09525264502bda1f6667ad2429eaf5520b543d997e79e7a94b66a5896df8921cdc3a97140dfff75af6c9ba1859c872de1921c3cf8a6c48ed807bbf9f582cf093
languageName: node
linkType: hard

"component-emitter@npm:^1.2.1":
version: 1.3.0
resolution: "component-emitter@npm:1.3.0"
Expand Down Expand Up @@ -7938,15 +7931,6 @@ __metadata:
languageName: node
linkType: hard

"find-versions@npm:^4.0.0":
version: 4.0.0
resolution: "find-versions@npm:4.0.0"
dependencies:
semver-regex: ^3.1.2
checksum: 05174128349e522f0746cc343a509f2ce1c8c765e24968ff2ac6f82fda4e4c680f5f71c6a781ce28406d19addc32a205116ac14ee83cb2e336635dd803f56cbd
languageName: node
linkType: hard

"findup-sync@npm:^3.0.0":
version: 3.0.0
resolution: "findup-sync@npm:3.0.0"
Expand Down Expand Up @@ -9123,24 +9107,12 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"husky@npm:4.3.8":
version: 4.3.8
resolution: "husky@npm:4.3.8"
dependencies:
chalk: ^4.0.0
ci-info: ^2.0.0
compare-versions: ^3.6.0
cosmiconfig: ^7.0.0
find-versions: ^4.0.0
opencollective-postinstall: ^2.0.2
pkg-dir: ^5.0.0
please-upgrade-node: ^3.2.0
slash: ^3.0.0
which-pm-runs: ^1.0.0
"husky@npm:5.0.8":
version: 5.0.8
resolution: "husky@npm:5.0.8"
bin:
husky-run: bin/run.js
husky-upgrade: lib/upgrader/bin.js
checksum: 1ac4fb51ffd93547ec861f185d86bdbfbac8ee24ce60417d531dbe5222e33fc754436e87e4e2b37a44dcefdc78c151f9ba4ac57c05773f5c36377cc4eb73732b
husky: lib/bin.js
checksum: cc8a7926a4d6e97d19b9713c0fbbc8553c8717800d7dee6b09ef223ff395c5c51ef9091265b259b06e886d157e9f2701d1370b00a5633ac34b3eaaa8234a736c
languageName: node
linkType: hard

Expand Down Expand Up @@ -12909,15 +12881,6 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"opencollective-postinstall@npm:^2.0.2":
version: 2.0.3
resolution: "opencollective-postinstall@npm:2.0.3"
bin:
opencollective-postinstall: index.js
checksum: d75b06b80eb426aaf099307ca4398f3119c8c86ff3806a95cfe234b979b80c07080040734fe2dc3c51fed5b15bd98dae88340807980bdc74aa1ebf045c74ef06
languageName: node
linkType: hard

"opn@npm:^5.5.0":
version: 5.5.0
resolution: "opn@npm:5.5.0"
Expand Down Expand Up @@ -13526,15 +13489,6 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"pkg-dir@npm:^5.0.0":
version: 5.0.0
resolution: "pkg-dir@npm:5.0.0"
dependencies:
find-up: ^5.0.0
checksum: 86f6ecee1787d8fe1606fd831f823f967c6ea0d760ce714af6afd2fec076ce71fbedcb57b339d93b84edf90ccdd81d4e6e2c10fcde21684ef3ffee5e05fd37dc
languageName: node
linkType: hard

"please-upgrade-node@npm:^3.2.0":
version: 3.2.0
resolution: "please-upgrade-node@npm:3.2.0"
Expand Down Expand Up @@ -14934,7 +14888,7 @@ fsevents@^1.2.7:
"@package/prettier-config": 0.1.0
audit-ci: 3.1.1
commitizen: 4.2.3
husky: 4.3.8
husky: 5.0.8
lerna: 3.22.1
libyear: 0.6.2
lockfile-lint: 4.3.7
Expand Down Expand Up @@ -15162,13 +15116,6 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"semver-regex@npm:^3.1.2":
version: 3.1.2
resolution: "semver-regex@npm:3.1.2"
checksum: 6a83740f3fc24379629be068e677c71c57e0d9df4977eb56d863f26a7830b85f14d9f1af71ca3a84df9ac70fcd9ce8821466064f5652ffa0dc343b50ded86698
languageName: node
linkType: hard

"semver@npm:2 || 3 || 4 || 5, semver@npm:2.x || 3.x || 4 || 5, semver@npm:^5.4.1, semver@npm:^5.5.0, semver@npm:^5.5.1, semver@npm:^5.6.0, semver@npm:^5.7.0, semver@npm:^5.7.1":
version: 5.7.1
resolution: "semver@npm:5.7.1"
Expand Down

0 comments on commit 6b1a233

Please sign in to comment.