From b2c3b33ee27a84f509079022b7ba852250836478 Mon Sep 17 00:00:00 2001 From: ortiztena Date: Mon, 14 Mar 2022 13:47:29 +0100 Subject: [PATCH 1/6] Keep calm and commit --- .husky/pre-commit | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..449fcde --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm test From 11c0e10699a853717489b48242ea45f5d6582853 Mon Sep 17 00:00:00 2001 From: ortiztena Date: Mon, 14 Mar 2022 14:47:13 +0100 Subject: [PATCH 2/6] Keep calm and commit --- package.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..82d52f8 --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "code-paster", + "scripts": { + "install": "run-p -l backend:install frontend:install", + "backend:install": "cd back && npm install", + "frontend:install": "cd front && npm install", + "test": "run-p -l backend:test frontend:test", + "backend:test": "cd back && npm run test", + "frontend:test": "cd front && npm run test", + "prepare": "husky install" + }, + "devDependencies": { + "husky": "^7.0.0", + "npm-run-all": "^4.1.5", + "prettier": "^2.5.1", + "pretty-quick": "^3.1.3" + } +} From 23153f2e363ab7868b6a20d2ea2a27750b4f36fe Mon Sep 17 00:00:00 2001 From: ortiztena Date: Tue, 15 Mar 2022 11:48:01 +0100 Subject: [PATCH 3/6] test --- .husky/_/husky.sh | 31 +++++++++++++++++++++++++++++++ front/src/common/global-window.ts | 2 +- package.json | 1 - 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 .husky/_/husky.sh 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/front/src/common/global-window.ts b/front/src/common/global-window.ts index 78f99f9..1287454 100644 --- a/front/src/common/global-window.ts +++ b/front/src/common/global-window.ts @@ -1,2 +1,2 @@ export const getHostBaseUrl = () => - `${window.location.origin}${window.location.pathname}`; + `${window.location.origin}${window.location.pathname}` \ No newline at end of file diff --git a/package.json b/package.json index 82d52f8..383109c 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "test": "run-p -l backend:test frontend:test", "backend:test": "cd back && npm run test", "frontend:test": "cd front && npm run test", - "prepare": "husky install" }, "devDependencies": { "husky": "^7.0.0", From 59fa4e69b6da483130972950f634b778f74146a8 Mon Sep 17 00:00:00 2001 From: ortiztena Date: Tue, 15 Mar 2022 12:03:10 +0100 Subject: [PATCH 4/6] test 2 --- .husky/pre-commit | 2 +- front/.prettierrc => .prettierrc | 0 front/package.json | 6 +----- package.json | 5 +---- 4 files changed, 3 insertions(+), 10 deletions(-) rename front/.prettierrc => .prettierrc (100%) diff --git a/.husky/pre-commit b/.husky/pre-commit index 449fcde..35d6918 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -npm test +npx pretty-quick --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 index 383109c..f1b1e5f 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,7 @@ "scripts": { "install": "run-p -l backend:install frontend:install", "backend:install": "cd back && npm install", - "frontend:install": "cd front && npm install", - "test": "run-p -l backend:test frontend:test", - "backend:test": "cd back && npm run test", - "frontend:test": "cd front && npm run test", + "frontend:install": "cd front && npm install" }, "devDependencies": { "husky": "^7.0.0", From ba4563d1a9f433127865a05cfe2bf19c7a08f76e Mon Sep 17 00:00:00 2001 From: ortiztena Date: Tue, 15 Mar 2022 12:06:41 +0100 Subject: [PATCH 5/6] test prettier --- .husky/pre-commit | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 35d6918..b4b0378 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,5 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -npx pretty-quick --staged +node_modules/pretty-quick/bin/pretty-quick.js --staged + From b0e0bcaaae3cbc304db2e248d0ee799c88a66c3d Mon Sep 17 00:00:00 2001 From: ortiztena Date: Wed, 16 Mar 2022 11:15:40 +0100 Subject: [PATCH 6/6] testing husky --- front/src/common/global-window.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/src/common/global-window.ts b/front/src/common/global-window.ts index 1287454..78f99f9 100644 --- a/front/src/common/global-window.ts +++ b/front/src/common/global-window.ts @@ -1,2 +1,2 @@ export const getHostBaseUrl = () => - `${window.location.origin}${window.location.pathname}` \ No newline at end of file + `${window.location.origin}${window.location.pathname}`;