Skip to content

Commit

Permalink
wording
Browse files Browse the repository at this point in the history
  • Loading branch information
typicode committed Jul 17, 2024
1 parent 21223af commit 8ec1275
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions docs/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,22 @@ git commit -m "Keep calm and commit"
# test script will run every time you commit
```

## A few words
## A few words...

### Scripting

While most of the time, you'll just run a few `npm run` or `npx` commands in your hooks, you can also script hooks using POSIX shell for custom workflows.
While most of the time, you'll just run a few `npm run` or `npx` commands in your hooks, you can also script them using POSIX shell for custom workflows.

For example, here's how you can lint your staged files on each commit with only two lines of shell code:
For example, here's how you can lint your staged files on each commit with only two lines of shell code and no external dependency:

```shell
# .husky/pre-commit
prettier $(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') --write --ignore-unknown
git update-index --again
```

See also [lint-staged](https://github.com/lint-staged/lint-staged) if you need more.
_This is a basic but workinkg example, check [lint-staged](https://github.com/lint-staged/lint-staged) if you need more._

### Disabling hooks

Husky doesn't force Git hooks and can be globally disabled if wished. They can be made opt-in as well.

_For manual setup and more information, see the [How To](how-to) section._

Husky doesn't force Git hooks. It can be globally disabled (`HUSKY=0`) or be opt-in if wanted. See the [How To](how-to) section for manual setup and more information.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ export default (d = '.husky') => {
w(_('.gitignore'), '*')
f.copyFileSync(new URL('husky', import.meta.url), _('h'))
l.forEach(h => w(_(h), `#!/usr/bin/env sh\n. "\${0%/*}/h"`, { mode: 0o755 }))
w(_('husky.sh'), 'echo "husky - `#!/usr/bin/env sh` and `. "$(dirname -- "$0")/_/husky.sh"` lines in hooks are DEPRECATED and won\'t be supported in v10. You can remove these two lines safely for even simpler scripts"')
w(_('husky.sh'), 'echo "husky - `#!/usr/bin/env sh` and `. "$(dirname -- "$0")/_/husky.sh"` lines in hooks are DEPRECATED and won\'t be supported in v10. You can remove these two lines for even simpler scripts"')
return ''
}

0 comments on commit 8ec1275

Please sign in to comment.