-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
- Loading branch information
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
root = true | ||
[*] | ||
end_of_line = lf | ||
indent_style = tab | ||
insert_final_newline = false |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
lib | ||
node_modules | ||
husky-*.tgz | ||
tsconfig.tsbuildinfo | ||
*.log | ||
docs/.vitepress/cache | ||
docs/.vitepress/dist | ||
docs/.env | ||
docs/sponsorkit/.cache.json | ||
docs/sponsorkit/sponsors.json | ||
docs/sponsorkit/sponsors.png |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm test | ||
./test.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.* | ||
test* | ||
docs |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
disable=SC1090,SC2164 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1 @@ | ||
# husky | ||
|
||
> Modern native Git hooks made easy | ||
Husky improves your commits and more 🐶 *woof!* | ||
|
||
# Install | ||
|
||
``` | ||
npm install husky --save-dev | ||
``` | ||
|
||
# Usage | ||
|
||
Edit `package.json > prepare` script and run it once: | ||
|
||
```sh | ||
npm pkg set scripts.prepare="husky install" | ||
npm run prepare | ||
``` | ||
|
||
Add a hook: | ||
|
||
```sh | ||
npx husky add .husky/pre-commit "npm test" | ||
git add .husky/pre-commit | ||
``` | ||
|
||
Make a commit: | ||
|
||
```sh | ||
git commit -m "Keep calm and commit" | ||
# `npm test` will run | ||
``` | ||
|
||
# Documentation | ||
|
||
https://typicode.github.io/husky |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env node | ||
import f, { writeFileSync as w } from 'fs' | ||
import i from './index.js' | ||
|
||
let a = process.argv[2] | ||
|
||
if (a == 'init') { | ||
let p = process.env.npm_package_json | ||
let d = JSON.parse(f.readFileSync(p)) | ||
d.scripts.prepare = 'husky' | ||
w('package.json', JSON.stringify(d, null, /\t/.test() ? '\t' : 2)) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
glensc
Contributor
|
||
process.stdout.write(i()) | ||
w('.husky/pre-commit', process.env.npm_config_user_agent.split('/')[0] + ' test') | ||
process.exit() | ||
} | ||
|
||
let d = c => console.error(`${c} command is deprecated`) | ||
if (['add', 'set', 'uninstall'].includes(a)) { d(a); process.exit(1) } | ||
if (a == 'install') d(a) | ||
|
||
process.stdout.write(i(a == 'install' ? undefined : a)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { defineConfig } from 'vitepress' | ||
|
||
// https://vitepress.dev/reference/site-config | ||
export default defineConfig({ | ||
title: "Husky", | ||
description: "Git hooks made easy", | ||
base: '/husky/', | ||
themeConfig: { | ||
// outline: [2, 3], | ||
socialLinks: [ | ||
{ icon: 'github', link: 'https://github.com/typicode/husky' }, | ||
], | ||
carbonAds: { | ||
code: 'CWYDP53L', | ||
placement: 'typicodegithubio', | ||
}, | ||
sidebar: [ | ||
{ text: 'Introduction', link: '/' }, | ||
{ text: 'Get Started', link: '/get-started' }, | ||
{ text: 'How To', link: '/how-to' }, | ||
{ text: 'Troubleshoot', link: '/troubleshoot' }, | ||
{ text: 'Migrate from v4', link: '/migrate-from-v4' }, | ||
], | ||
} | ||
}) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Get started | ||
|
||
## Install | ||
|
||
::: code-group | ||
|
||
```shell [npm] | ||
npm install --save-dev husky | ||
``` | ||
|
||
```shell [pnpm] | ||
pnpm add --save-dev husky | ||
``` | ||
|
||
```shell [yarn] | ||
yarn add --dev husky | ||
# Add pinst ONLY if your package is not private | ||
yarn add --dev pinst | ||
``` | ||
|
||
```shell [bun] | ||
bun add --dev husky | ||
``` | ||
|
||
::: | ||
|
||
## `husky init` (recommended) | ||
|
||
The `init` command simplifies setting up husky in a project. It creates a `pre-commit` script in `.husky/` and updates the `prepare` script in `package.json`. Modifications can be made later to suit your workflow. | ||
|
||
::: code-group | ||
|
||
```shell [npm] | ||
npx husky init | ||
``` | ||
|
||
```shell [pnpm] | ||
pnpm exec husky init | ||
``` | ||
|
||
```shell [yarn] | ||
# Due to specific caveats and differences with other package managers, | ||
# refer to the How To section. | ||
``` | ||
|
||
```shell [bun] | ||
bunx husky init | ||
``` | ||
|
||
::: | ||
|
||
|
||
## Try it | ||
|
||
Congratulations! You've successfully set up your first Git hook with just one command 🎉. Let's test it: | ||
|
||
```shell | ||
git commit -m "Keep calm and commit" | ||
# test script will run every time you commit | ||
``` | ||
|
||
_For manual setup and more information, see the [How To](how-to) section._ | ||
|
/\t/.test()
is never true?I think you wanted to run
/\t/.test(d)
here?