Skip to content

Commit

Permalink
Merge branch 'master' into refactoring
Browse files Browse the repository at this point in the history
* master:
  Account for GOAMD64 suffix in directory names in NPM and GEM packages [ci skip]
  Include version into RPM/DEB packages on release [ci skip]
  0.8.0: Skip hooks in merge/rebase, hide summary, NPM installer package
  Split NPM package to two: bundled and installer (#273)
  Include archived binaries in the releases (#189)
  docs: s/agrs/args (#265) [ci skip]
  chore(lint): Fix golangci-lint complains
  docs(usage): Add commitlint example in full_guide (#201)
  Fix unreachable conditional in hook template (#242)
  fix(hook.tmpl): adds cpu arch and os arch to `lefthook`'s filepath (#260)
  Replace deprecated `File.exists?` with `exist?` for Ruby wrapper (#263)
  Fix typo in docs/full_guide.md (#256)
  0.7.7: Fix arguments passing and various NPM-related fixes
  Fix incorrect npx command in git hook script template (#236)
  Update project URLs in NPM package.json (#235)
  Pass all arguments to downstream hooks (#231)
  Allows lefthook to work when node_modules is not in root folder for npx (#224)
  Do not initialize git config on `help` and `version` commands (#209)
  node: fix postinstall: process.cwd is a function and should be called

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>
  • Loading branch information
mrexox committed Jun 9, 2022
2 parents d2c4bd8 + fa2403e commit 466e801
Show file tree
Hide file tree
Showing 23 changed files with 218 additions and 239 deletions.
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

tmp/
dist/
.rubygems/pkg/
.rubygems/libexec/
.npm/bin/
!.npm/bin/*.js
packaging/rubygems/pkg/
packaging/rubygems/libexec/
packaging/npm-bundled/bin/
packaging/npm-*/README.md
package.json
!.npm/package.json
!packaging/npm-*/package.json
node_modules/
yarn.lock
package-lock.json
14 changes: 12 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ archives:
darwin: MacOS
linux: Linux
amd64: x86_64
- id: lefthook-gz
format: gz
files:
- none*
replacements:
windows: Windows
darwin: MacOS
linux: Linux
386: i386
amd64: x86_64
checksum:
name_template: '{{ .ProjectName }}_checksums.txt'
snapshot:
Expand All @@ -49,12 +59,12 @@ snapcrafts:

nfpms:
-
file_name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
file_name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
homepage: https://github.com/evilmartians/lefthook
description: Lefthook a single dependency-free binary to manage all your git hooks that works with any language in any environment, and in all common team workflows
maintainer: Alexander Abroskin <arkweid@evilmartians.com>
license: MIT
vendor: Arkweid
vendor: Evil Martians
formats:
- deb
- rpm
Expand Down
203 changes: 0 additions & 203 deletions .npm/README.md

This file was deleted.

21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

## master (unreleased)

# 0.8.0 (2022-06-07)

- Allow skipping hooks in certain git states: merge and/or rebase ([PR #173](https://github.com/evilmartians/lefthook/pull/173) by @DmitryTsepelev)
- NPM: installer package that downloads the required binaries during installation ([PR #188](https://github.com/evilmartians/lefthook/pull/188) by @aminya, [PR #273](https://github.com/evilmartians/lefthook/pull/273) by @Envek)
- Add ability to skip summary output. Also support a `LEFTHOOK_QUIET` env variable ([PR #187](https://github.com/evilmartians/lefthook/pull/187) by @washtubs)
- Make filename globs case-insensitive ([PR #196](https://github.com/evilmartians/lefthook/pull/196) by @skryukov)
- Fix lefthook binary extension on Windows ([PR #188](https://github.com/evilmartians/lefthook/pull/188) by @aminya)
- Stop building 32-bit binaries for releases due to low usage (@Envek)
- Allow lefthook to work when node_modules is not in root folder for npx ([PR #224](https://github.com/evilmartians/lefthook/pull/224) by @spearmootz)
- Fix unreachable conditional in hook template ([PR #242](https://github.com/evilmartians/lefthook/pull/242) by @dannobytes)
- Add cpu arch and os arch to lefthook's filepath in hook template ([PR #260](https://github.com/evilmartians/lefthook/pull/260) by @rmachado-studocu)

# 0.7.7 (2021-10-02)

- Fix incorrect npx command in git hook script template ([PR #236](https://github.com/evilmartians/lefthook/pull/236)) @PikachuEXE
- Update project URLs in NPM package.json ([PR #235](https://github.com/evilmartians/lefthook/pull/235)) @PikachuEXE
- Pass all arguments to downstream hooks ([PR #231](https://github.com/evilmartians/lefthook/pull/231)) @pablobirukov
- Allows lefthook to work when node_modules is not in root folder for npx ([PR #224](https://github.com/evilmartians/lefthook/pull/224)) @spearmootz
- Do not initialize git config on `help` and `version` commands ([PR #209](https://github.com/evilmartians/lefthook/pull/209)) @pwinckles
- node: fix postinstall: process.cwd is a function and should be called @Envek

# 0.7.6 (2021-06-02)

- Fix lefthook binary extension on Windows. @aminya
Expand Down
50 changes: 42 additions & 8 deletions docs/full_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,30 @@ go get github.com/evilmartians/lefthook

### npm or yarn

```bash
npm i @arkweid/lefthook --save-dev
# or yarn:
yarn add -D @arkweid/lefthook
```
Lefthook is available on NPM in two flavors:

1. [@evilmartians/lefthook](https://www.npmjs.com/package/@evilmartians/lefthook) with pre-bundled binaries for all architectures:

```bash
npm install @evilmartians/lefthook --save-dev
# or yarn:
yarn add -D @evilmartians/lefthook
```

2. [@evilmartians/lefthook-installer](https://www.npmjs.com/package/@evilmartians/lefthook-installer) that wil fetch binary file on installation:

```bash
npm install @evilmartians/lefthook-installer --save-dev
# or yarn:
yarn add -D @evilmartians/lefthook-installer
```

NOTE: if you install it this way you should call it with `npx` or `yarn` for all listed examples below. (for example: `lefthook install` -> `npx lefthook install`)

You can also install lefthook as a global dependency

```bash
npm install -g @arkweid/lefthook
npm install -g @evilmartians/lefthook
```


Expand Down Expand Up @@ -251,6 +263,28 @@ commit-msg:

When you try to commit `git commit -m "haha bad commit text"` script `template_checker` will be executed. Since commit text doesn't match the described pattern the commit process will be interrupted.
## Bash script example with Commitlint
Let's create a bash script to check conventional commit status `.lefthook/commit-msg/commitlint.sh`:

```bash
echo $(head -n1 $1) | npx commitlint --color
```

Now we can ask lefthook to run our bash script by adding this code to
`lefthook.yml` file:

```yml
# lefthook.yml
commit-msg:
scripts:
"commitlint.sh":
runner: bash
```

When you try to commit `git commit -m "haha bad commit text"` script `commitlint.sh` will be executed. Since commit text doesn't match the default config or custom config that you setup for `commitlint`, the process will be interrupted.
## Local config
We can use `lefthook-local.yml` as local config. Options in this file will overwrite options in `lefthook.yml`. (Don't forget to add this file to `.gitignore`)
Expand Down Expand Up @@ -550,11 +584,11 @@ export LEFTHOOK_QUIET="meta,success,summary"

## CI integration

Enable `CI` env variable if it doens't exists on your service by default.
Enable `CI` env variable if it doesn't exists on your service by default.
## Disable colors
By agrs:
By args:
```bash
lefthook --no-colors run pre-commit
```
Expand Down
Loading

0 comments on commit 466e801

Please sign in to comment.