diff --git a/.husky/_/husky.sh b/.husky/_/husky.sh new file mode 100644 index 0000000..6809ccc --- /dev/null +++ b/.husky/_/husky.sh @@ -0,0 +1,31 @@ +#!/bin/sh +if [ -z "$husky_skip_init" ]; then + debug () { + if [ "$HUSKY_DEBUG" = "1" ]; then + echo "husky (debug) - $1" + fi + } + + 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)" + fi + + exit $exitCode +fi diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..b4b0378 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,5 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +node_modules/pretty-quick/bin/pretty-quick.js --staged + diff --git a/front/.prettierrc b/.prettierrc similarity index 100% rename from front/.prettierrc rename to .prettierrc diff --git a/front/package.json b/front/package.json index 82658d5..21ddd04 100644 --- a/front/package.json +++ b/front/package.json @@ -13,9 +13,7 @@ "type-check:watch": "npm run type-check -- --watch", "test": "jest -c ./config/test/jest.js --verbose", "test:watch": "npm run test -- --watchAll -i --no-cache", - "clean": "rimraf dist", - "prettier": "prettier {config,src}/**/*{.js,.jsx,.ts,.tsx}", - "prettier:fix": "npm run prettier -- --fix" + "clean": "rimraf dist" }, "repository": { "type": "git" @@ -72,8 +70,6 @@ "lint-staged": "^9.5.0", "mini-css-extract-plugin": "^0.8.0", "npm-run-all": "^4.1.5", - "prettier": "^1.19.1", - "pretty-quick": "^2.0.1", "react-test-renderer": "^16.12.0", "rimraf": "^3.0.0", "style-loader": "^1.0.1", diff --git a/package.json b/package.json new file mode 100644 index 0000000..f1b1e5f --- /dev/null +++ b/package.json @@ -0,0 +1,14 @@ +{ + "name": "code-paster", + "scripts": { + "install": "run-p -l backend:install frontend:install", + "backend:install": "cd back && npm install", + "frontend:install": "cd front && npm install" + }, + "devDependencies": { + "husky": "^7.0.0", + "npm-run-all": "^4.1.5", + "prettier": "^2.5.1", + "pretty-quick": "^3.1.3" + } +}