UNPKG

489 BPlain TextView Raw
1#!/bin/sh
2#
3# pre-commit: script to run checks on a working copy before commit
4#
5# To use, symlink it into .git/hooks:
6# ln -s ../../git-hooks/pre-commit .git/hooks
7#
8
9set -e
10
11# create a temp dir
12tmpdir=`mktemp -d`
13trap 'rm -rf "$tmpdir"' EXIT
14
15# get a copy of the index
16git checkout-index --prefix="$tmpdir/" -a
17
18# keep node_modules/.bin on the path
19rootdir=`git rev-parse --show-toplevel`
20export PATH="$rootdir/node_modules/.bin:$PATH"
21
22# now run our checks
23cd "$tmpdir"
24npm run lint