diff --git a/.husky/.gitignore b/.husky/.gitignore index 31354ec..e69de29 100644 --- a/.husky/.gitignore +++ b/.husky/.gitignore @@ -1 +0,0 @@ -_ diff --git a/.husky/_/husky.sh b/.husky/_/husky.sh new file mode 100644 index 0000000..ca2720e --- /dev/null +++ b/.husky/_/husky.sh @@ -0,0 +1,30 @@ +#!/bin/sh +if [ -z "$husky_skip_init" ]; then + debug () { + [ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1" + } + + readonly hook_name="$(basename "$0")" + debug "starting $hook_name..." + + if [ "$HUSKY" = "0" ]; then + debug "HUSKY env variable is set to 0, skipping hook" + exit 0 + fi + + if [ -f ~/.huskyrc ]; then + debug "sourcing ~/.huskyrc" + . ~/.huskyrc + fi + + export readonly husky_skip_init=1 + sh -e "$0" "$@" + exitCode="$?" + + if [ $exitCode != 0 ]; then + echo "husky - $hook_name hook exited with code $exitCode (error)" + exit $exitCode + fi + + exit 0 +fi diff --git a/Husky_installation.txt b/Husky_installation.txt new file mode 100644 index 0000000..599629f --- /dev/null +++ b/Husky_installation.txt @@ -0,0 +1,29 @@ +1.Initialize a Git repository + git init + +2.Install Husky as a development dependency: +npm install husky --save-dev + +3.Enable Husky in your project: +npx husky install + +4.Add the following script to your package.json to automatically install Husky hooks after installing dependencies: + +{ + "scripts": { + "prepare": "husky install" + } +} + +5.Add a pre-commit hook: +npx husky add .husky/pre-commit "npm test" + +Pre-commit file +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm test + +6.Customize pre-commit + +7.Customize package.json \ No newline at end of file diff --git a/application/controllers/Welcome.php b/application/controllers/Welcome.php index 6d7090f..bf454e8 100644 --- a/application/controllers/Welcome.php +++ b/application/controllers/Welcome.php @@ -1,6 +1,6 @@