From 39be8c6dc3dd5b22505a3f5294ca04be92d63d14 Mon Sep 17 00:00:00 2001 From: estrella Date: Sun, 11 Jun 2023 11:08:35 +0800 Subject: [PATCH 01/10] =?UTF-8?q?change:=20update=20ci,=20allow=20push=20t?= =?UTF-8?q?o=20targger=20it.=E2=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 65c52bf1..d2c8f423 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,12 +3,6 @@ name: Build Docker on: pull_request: push: - tags: - - '\d+\.\d+\.\d+' - - '\d+\.\d+' - - '\d+\.\d+\.\d+-beta\d+' - - '\d+\.\d+-beta\d+' - - '\d+\.\d+-alpha\d+' jobs: test: @@ -32,6 +26,9 @@ jobs: build-webui: runs-on: ubuntu-latest + if: > + ${{ github.event_name == 'pull_request' && github.event.pull_request.merged == true }} + || ${{ github.event_name == 'push' && contains(github.ref, 'tags') }} needs: [test] steps: - name: Checkout @@ -63,7 +60,7 @@ jobs: build-docker: runs-on: ubuntu-latest - needs: [test, build-webui] + needs: [build-webui] steps: - name: Checkout uses: actions/checkout@v3 From d3d98c816605ff1212cadab205b5e82e3619eaa8 Mon Sep 17 00:00:00 2001 From: estrella Date: Sun, 11 Jun 2023 11:15:50 +0800 Subject: [PATCH 02/10] =?UTF-8?q?change:=20update=20ci,=20allow=20push=20t?= =?UTF-8?q?o=20trigger=20it.=E2=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d2c8f423..edd975a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,8 +27,8 @@ jobs: build-webui: runs-on: ubuntu-latest if: > - ${{ github.event_name == 'pull_request' && github.event.pull_request.merged == true }} - || ${{ github.event_name == 'push' && contains(github.ref, 'tags') }} + ${{ github.event_name == 'pull_request' }} || + ${{ github.event_name == 'push' && github.ref_type == 'tag' && (contains(github.ref, 'alpha') || contains(github.ref, 'beta')) }} needs: [test] steps: - name: Checkout From b5b632ef2918758a4d2584ffdb309103f18c317c Mon Sep 17 00:00:00 2001 From: 100gle Date: Sun, 11 Jun 2023 20:27:49 +0800 Subject: [PATCH 03/10] feat: use husky to add git hooks before commiting code --- webui/.husky/pre-commit | 4 ++++ webui/package.json | 2 ++ webui/pnpm-lock.yaml | 15 ++++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 webui/.husky/pre-commit diff --git a/webui/.husky/pre-commit b/webui/.husky/pre-commit new file mode 100644 index 00000000..9c2a7dd9 --- /dev/null +++ b/webui/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +cd ./webui && pnpm run lint:fix && pnpm run format diff --git a/webui/package.json b/webui/package.json index b2b1258a..78b9a5d5 100644 --- a/webui/package.json +++ b/webui/package.json @@ -4,6 +4,7 @@ "version": "0.0.0", "private": true, "scripts": { + "prepare": "cd .. && husky install ./webui/.husky", "build": "vue-tsc --noEmit && vite build", "dev": "vite", "format": "prettier --write .", @@ -43,6 +44,7 @@ "eslint": "^8.41.0", "eslint-config-prettier": "^8.8.0", "eslint-plugin-storybook": "^0.6.12", + "husky": "^8.0.3", "prettier": "^2.8.8", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/webui/pnpm-lock.yaml b/webui/pnpm-lock.yaml index fc0eb5d5..85333c53 100644 --- a/webui/pnpm-lock.yaml +++ b/webui/pnpm-lock.yaml @@ -1,4 +1,8 @@ -lockfileVersion: '6.0' +lockfileVersion: '6.1' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false dependencies: '@headlessui/vue': @@ -78,6 +82,9 @@ devDependencies: eslint-plugin-storybook: specifier: ^0.6.12 version: 0.6.12(eslint@8.41.0)(typescript@4.9.5) + husky: + specifier: ^8.0.3 + version: 8.0.3 prettier: specifier: ^2.8.8 version: 2.8.8 @@ -6078,6 +6085,12 @@ packages: engines: {node: '>=10.17.0'} dev: true + /husky@8.0.3: + resolution: {integrity: sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==} + engines: {node: '>=14'} + hasBin: true + dev: true + /iconv-lite@0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} From 605f40559e1f8a62f1a569c51afd6524079e60df Mon Sep 17 00:00:00 2001 From: 100gle Date: Sun, 11 Jun 2023 20:31:28 +0800 Subject: [PATCH 04/10] ci: lint and format codes --- webui/src/components/ab-edit-rule.vue | 4 ++-- webui/src/components/layout/ab-topbar.vue | 2 +- webui/src/components/setting/config-notification.vue | 7 ++++++- webui/types/api.ts | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/webui/src/components/ab-edit-rule.vue b/webui/src/components/ab-edit-rule.vue index 2cfbdac5..bdb5e6fe 100644 --- a/webui/src/components/ab-edit-rule.vue +++ b/webui/src/components/ab-edit-rule.vue @@ -29,10 +29,10 @@ watch(show, (val) => { } }); -const showDeleteFileDialog = (type: 'disable' | 'delete') => { +function showDeleteFileDialog(type: 'disable' | 'delete') { deleteFileDialog.show = true; deleteFileDialog.type = type; -}; +} const close = () => (show.value = false); diff --git a/webui/src/components/layout/ab-topbar.vue b/webui/src/components/layout/ab-topbar.vue index 2a2b8352..724b473d 100644 --- a/webui/src/components/layout/ab-topbar.vue +++ b/webui/src/components/layout/ab-topbar.vue @@ -1,11 +1,11 @@