Add repository scaffolding: .gitignore, README, CONTRIBUTING, MIT license, pre-push quality hook, and documentation covering branching, file conventions, and commit style. Establish the main/develop branching strategy. This is project setup only; no application functionality is included.
29 lines
709 B
Bash
Executable File
29 lines
709 B
Bash
Executable File
#!/usr/bin/env sh
|
|
# pre-push — code quality checks before pushing to the remote.
|
|
#
|
|
# Install (per clone):
|
|
# git config core.hooksPath hooks
|
|
#
|
|
# The hook is a no-op until the application toolchain (package.json)
|
|
# exists. When it does, `lint` and `test` scripts are run if defined.
|
|
|
|
status=0
|
|
|
|
if [ -f package.json ]; then
|
|
if npm run lint --if-present --silent; then
|
|
echo "pre-push: lint passed"
|
|
else
|
|
echo "pre-push: lint FAILED — push aborted" >&2
|
|
status=1
|
|
fi
|
|
|
|
if [ "$status" -eq 0 ] && npm run test --if-present --silent; then
|
|
echo "pre-push: tests passed"
|
|
else
|
|
[ "$status" -eq 0 ] && echo "pre-push: tests FAILED — push aborted" >&2
|
|
status=1
|
|
fi
|
|
fi
|
|
|
|
exit "$status"
|