Skip to content
Snippets Groups Projects
Commit 7fdf3f2c authored by Diego Rodrigo da Silva's avatar Diego Rodrigo da Silva Committed by Chris Wells
Browse files

Issue #3282338 by diegors, narendrar: Use git hooks to prevent push if yarn build was not run

parent 96223a14
No related branches found
No related tags found
No related merge requests found
...@@ -8,3 +8,5 @@ testlogger ...@@ -8,3 +8,5 @@ testlogger
kanopi kanopi
tabwise tabwise
sophron sophron
BOLDRED
NOCHANGES
#!/bin/sh
# colors
RED='\e[31m'
BOLDRED='\033[1m'
NORMAL='\e[0m'
cd sveltejs; yarn run rollup -c
git diff --quiet; NOCHANGES=$?
if [ "$NOCHANGES" -ne 0 ]; then
echo "";
echo "${RED}##################################${NORMAL}"
echo "${RED} PUSH ABORTED!!! ${NORMAL}"
echo "${RED}Please, run ${BOLDRED}yarn build${NORMAL}${RED} before push ${NORMAL}"
echo "${RED}################################## ${NORMAL}"
echo "";
exit 1;
fi
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"dev": "yarn yarncheck && rollup -c -w", "dev": "yarn yarncheck && rollup -c -w",
"start": "sirv public --no-clear", "start": "sirv public --no-clear",
"preinstall": "yarn yarncheck", "preinstall": "yarn yarncheck",
"postinstall": "scripts/setup-git-hooks.sh",
"yarncheck": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('Application requires Yarn. Do not use NPM or other package managers')\"", "yarncheck": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('Application requires Yarn. Do not use NPM or other package managers')\"",
"lint:svelte": "node ./node_modules/eslint/bin/eslint.js . --ext .svelte && yarn prettier:svelte-check", "lint:svelte": "node ./node_modules/eslint/bin/eslint.js . --ext .svelte && yarn prettier:svelte-check",
"prettier:svelte": "prettier --write \"src/**/*.svelte\"", "prettier:svelte": "prettier --write \"src/**/*.svelte\"",
......
#!/bin/sh
if [ ! $CI ] # don't run in CI environment
then
echo "Setting git-hooks/ as the project git hooksPath..."
git config core.hooksPath git-hooks
echo "Installed git hooks"
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment