Skip to content

Commit e7ada20

Browse files
starnayutatypicode
andauthored
docs: update install script to mjs and simplify (#1357)
* docs: update install script to mjs and fix CI checks * revert indent * Update how-to.md --------- Co-authored-by: typicode <typicode@gmail.com>
1 parent 534bfed commit e7ada20

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

docs/how-to.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,23 @@ Modify the `prepare` script to never fail:
6666
"prepare": "husky || true"
6767
```
6868

69-
You'll still get a `command not found` error message in your output which may be confusing. To make it silent, create `.husky/install.js`:
69+
You'll still get a `command not found` error message in your output which may be confusing. To make it silent, create `.husky/install.mjs`:
7070

7171
```js
7272
// Skip Husky install in production and CI
73+
import husky from 'husky'
74+
7375
if (process.env.NODE_ENV === 'production' || process.env.CI === '1') {
7476
process.exit(0)
7577
}
76-
const husky = await import('husky')
77-
husky()
78+
79+
console.log(husky())
7880
```
7981

8082
Then, use it in `prepare`:
8183

8284
```json
83-
"prepare": "node .husky/install.js"
85+
"prepare": "node .husky/install.mjs"
8486
```
8587

8688
## Testing Hooks Without Committing

0 commit comments

Comments
 (0)