From 95535be7b4f5d545e7bb6d661c6b15564f46f6f0 Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Thu, 19 Aug 2021 16:55:54 +0200 Subject: [PATCH 1/4] add precommit hook and test error --- package.json | 6 ++++++ packages/builder/src/components/start/UpdateAppModal.svelte | 2 +- yarn.lock | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 5532cf87a9..ca4d109a0e 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "eslint": "^7.28.0", "eslint-plugin-cypress": "^2.11.3", "eslint-plugin-svelte3": "^3.2.0", + "husky": "^7.0.1", "kill-port": "^1.6.1", "lerna": "3.14.1", "prettier": "^2.3.1", @@ -46,5 +47,10 @@ "build:docker:develop": "node scripts/pinVersions && lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh develop && cd -", "multi:enable": "lerna run multi:enable", "multi:disable": "lerna run multi:disable" + }, + "husky": { + "hooks": { + "pre-commit": "yarn run lint:fix" + } } } diff --git a/packages/builder/src/components/start/UpdateAppModal.svelte b/packages/builder/src/components/start/UpdateAppModal.svelte index dbbc000d1f..28af6d71ff 100644 --- a/packages/builder/src/components/start/UpdateAppModal.svelte +++ b/packages/builder/src/components/start/UpdateAppModal.svelte @@ -74,7 +74,7 @@ } export const show = () => { - modal.show() + modal.show(); } export const hide = () => { modal.hide() diff --git a/yarn.lock b/yarn.lock index 553702ffcb..00422fa638 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2448,6 +2448,11 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" +husky@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/husky/-/husky-7.0.1.tgz#579f4180b5da4520263e8713cc832942b48e1f1c" + integrity sha512-gceRaITVZ+cJH9sNHqx5tFwbzlLCVxtVZcusME8JYQ8Edy5mpGDOqD8QBCdMhpyo9a+JXddnujQ4rpY2Ff9SJA== + iconv-lite@^0.4.24, iconv-lite@~0.4.13: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" From 2c0e6ff1a86171de210e54d60d03219d2aa0b75b Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Thu, 19 Aug 2021 16:57:23 +0200 Subject: [PATCH 2/4] add prepare script for husky --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ca4d109a0e..86e042e139 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "build:docker": "lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh && cd -", "build:docker:develop": "node scripts/pinVersions && lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh develop && cd -", "multi:enable": "lerna run multi:enable", - "multi:disable": "lerna run multi:disable" + "multi:disable": "lerna run multi:disable", + "prepare": "husky install" }, "husky": { "hooks": { From 780d9ea1c05d48e473d37c9c535317d6f38f2c66 Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Thu, 19 Aug 2021 17:01:48 +0200 Subject: [PATCH 3/4] add git hook --- .husky/pre-commit | 4 ++++ package.json | 7 +------ 2 files changed, 5 insertions(+), 6 deletions(-) create mode 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000000..04225e10ae --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +yarn run lint:fix diff --git a/package.json b/package.json index 86e042e139..76f6a49d4a 100644 --- a/package.json +++ b/package.json @@ -47,11 +47,6 @@ "build:docker:develop": "node scripts/pinVersions && lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh develop && cd -", "multi:enable": "lerna run multi:enable", "multi:disable": "lerna run multi:disable", - "prepare": "husky install" - }, - "husky": { - "hooks": { - "pre-commit": "yarn run lint:fix" - } + "postinstall": "husky install" } } From e0d39c61791fa2e97d03abab7110d925b730e65e Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Thu, 19 Aug 2021 17:04:41 +0200 Subject: [PATCH 4/4] run 'yarn run lint' before each commit --- .husky/pre-commit | 2 +- packages/builder/src/components/start/UpdateAppModal.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 04225e10ae..3b614330e0 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -yarn run lint:fix +yarn run lint diff --git a/packages/builder/src/components/start/UpdateAppModal.svelte b/packages/builder/src/components/start/UpdateAppModal.svelte index 28af6d71ff..dbbc000d1f 100644 --- a/packages/builder/src/components/start/UpdateAppModal.svelte +++ b/packages/builder/src/components/start/UpdateAppModal.svelte @@ -74,7 +74,7 @@ } export const show = () => { - modal.show(); + modal.show() } export const hide = () => { modal.hide()