Skip to content

Commit

Permalink
docs: fix example (#1363)
Browse files Browse the repository at this point in the history
* docs: fix example

* add log
  • Loading branch information
typicode committed Jan 26, 2024
1 parent c1bbd9b commit 800fbf1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions docs/how-to.md
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())

This comment has been minimized.

Copy link
@jerome-benoit

jerome-benoit Jan 26, 2024

@typicode: Why using console.log() on the husky() function return?

This comment has been minimized.

Copy link
@typicode

typicode Jan 27, 2024

Author Owner

husky() returns a string which may contain warnings.
console.log() is used to view them.

```

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

0 comments on commit 800fbf1

Please sign in to comment.