Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix example #1363

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions docs/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,13 @@ Modify the `prepare` script to never fail:

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`:

<!-- Since husky may not be installed, it must be imported dynamically after prod/CI check -->
```js
// Skip Husky install in production and CI
import husky from 'husky'

if (process.env.NODE_ENV === 'production' || process.env.CI === '1') {
if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') {
process.exit(0)
}

const husky = (await import('husky')).default
console.log(husky())
```

Expand Down Expand Up @@ -190,7 +189,7 @@ Alternatively, if your shell startup file is fast and lightweight, source it dir

## Manual setup

Git needs to be configured and husky needs to setup files in `.husky/`.
Git needs to be configured and husky needs to setup files in `.husky/`.

Run the `husky` command once in your repo. Ideally, include it in the `prepare` script in `package.json` for automatic execution after each install (recommended).

Expand Down
Loading