-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/sh | ||
|
||
find_npm_linux() { | ||
export NPM_CMD="npm" | ||
export NPX_CMD="npx" | ||
|
||
if ! (type $NPM_CMD >> /dev/null); then | ||
echo "npm not found, trying to make it available using nvm..." | ||
if type nvm >> /dev/null; then | ||
echo "nvm found, using it to install the latest lts node" | ||
nvm use --lts | ||
else | ||
echo "nvm not found, trying to make it available using the nvm.sh" | ||
# try to make it available based on https://github.com/typicode/husky/issues/912#issuecomment-817522060 | ||
export NVM_DIR="$HOME/.nvm/nvm.sh" | ||
. "$(dirname $NVM_DIR)/nvm.sh" | ||
|
||
export NVM_DIR="$HOME/.nvm" | ||
a=$(nvm ls --no-colors | grep 'node') | ||
v=$(echo "$a" | sed -E 's/.*\(-> ([^ ]+).*/\1/') | ||
|
||
export PATH="$NVM_DIR/versions/node/$v/bin:$PATH" | ||
|
||
if ! (type $NPM_CMD >> /dev/null); then | ||
echo "no variant of npm or nvm found, trying to use the npm.cmd" | ||
export NPM_CMD="npm.cmd" | ||
export NPX_CMD="npx.cmd" | ||
fi | ||
fi | ||
fi | ||
} | ||
|
||
if [ -z "${OSTYPE+x}" ]; then | ||
find_npm_linux | ||
else | ||
case "$OSTYPE" in | ||
msys*) export NPM_CMD="npm.cmd" ; | ||
export NPX_CMD="npx.cmd" ;; | ||
*) find_npm_linux ;; | ||
esac | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; } | ||
git lfs pre-push "$@" | ||
|
||
. .githooks/load-npm.sh | ||
$NPM_CMD run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: lint | ||
on: | ||
push: | ||
pull_request: | ||
types: [opened, synchronize] | ||
branches: [main] | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
run: npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: test | ||
on: | ||
push: | ||
pull_request: | ||
types: [opened, synchronize] | ||
branches: [main] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
.idea | ||
out | ||
.vscode-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters