From db9034ccf965fc1ab734202f47eb4c3a5b7c5497 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 17 Oct 2023 22:01:00 +0800 Subject: [PATCH] chore: update buf deps --- .github/workflows/extension-test.yml | 10 ++-- .github/workflows/frontend-test.yml | 10 ++-- Dockerfile | 22 ++------- frontend/extension/package.json | 4 +- frontend/extension/pnpm-lock.yaml | 71 ++++++++++++++++++++++++++++ frontend/web/package.json | 4 +- frontend/web/pnpm-lock.yaml | 71 ++++++++++++++++++++++++++++ 7 files changed, 160 insertions(+), 32 deletions(-) diff --git a/.github/workflows/extension-test.yml b/.github/workflows/extension-test.yml index 1e608f3f..b61fc556 100644 --- a/.github/workflows/extension-test.yml +++ b/.github/workflows/extension-test.yml @@ -15,9 +15,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: bufbuild/buf-setup-action@v1 - - run: buf generate - working-directory: proto - uses: pnpm/action-setup@v2.2.4 with: version: 8 @@ -28,6 +25,8 @@ jobs: cache-dependency-path: "frontend/extension/pnpm-lock.yaml" - run: pnpm install working-directory: frontend/extension + - run: pnpm type-gen + working-directory: frontend/extension - name: Run eslint check run: pnpm lint working-directory: frontend/extension @@ -36,9 +35,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: bufbuild/buf-setup-action@v1 - - run: buf generate - working-directory: proto - uses: pnpm/action-setup@v2.2.4 with: version: 8 @@ -49,6 +45,8 @@ jobs: cache-dependency-path: "frontend/extension/pnpm-lock.yaml" - run: pnpm install working-directory: frontend/extension + - run: pnpm type-gen + working-directory: frontend/extension - name: Run extension build run: pnpm build working-directory: frontend/extension diff --git a/.github/workflows/frontend-test.yml b/.github/workflows/frontend-test.yml index a41f009b..415fe93a 100644 --- a/.github/workflows/frontend-test.yml +++ b/.github/workflows/frontend-test.yml @@ -15,9 +15,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: bufbuild/buf-setup-action@v1 - - run: buf generate - working-directory: proto - uses: pnpm/action-setup@v2.2.4 with: version: 8 @@ -28,6 +25,8 @@ jobs: cache-dependency-path: "frontend/web/pnpm-lock.yaml" - run: pnpm install working-directory: frontend/web + - run: pnpm type-gen + working-directory: frontend/web - name: Run eslint check run: pnpm lint working-directory: frontend/web @@ -36,9 +35,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: bufbuild/buf-setup-action@v1 - - run: buf generate - working-directory: proto - uses: pnpm/action-setup@v2.2.4 with: version: 8 @@ -49,6 +45,8 @@ jobs: cache-dependency-path: "frontend/web/pnpm-lock.yaml" - run: pnpm install working-directory: frontend/web + - run: pnpm type-gen + working-directory: frontend/web - name: Run frontend build run: pnpm build working-directory: frontend/web diff --git a/Dockerfile b/Dockerfile index 88cb0dbe..aca1f9db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,12 @@ -# Build protobuf. -FROM golang:1.21-alpine AS protobuf -WORKDIR /protobuf-generate - -COPY . . - -RUN GO111MODULE=on GOBIN=/usr/local/bin go install github.com/bufbuild/buf/cmd/buf@v1.26.1 - -WORKDIR /protobuf-generate/proto - -RUN buf generate - # Build frontend dist. FROM node:18-alpine AS frontend WORKDIR /frontend-build -COPY ./frontend . - -COPY --from=protobuf /protobuf-generate/frontend/web/src/types/proto ./web/src/types/proto +COPY . . -WORKDIR /frontend-build/web +WORKDIR /frontend-build/frontend/web -RUN corepack enable && pnpm i --frozen-lockfile +RUN corepack enable && pnpm i --frozen-lockfile && pnpm type-gen RUN pnpm build @@ -29,7 +15,7 @@ FROM golang:1.21-alpine AS backend WORKDIR /backend-build COPY . . -COPY --from=frontend /frontend-build/web/dist ./server/dist +COPY --from=frontend /frontend-build/frontend/web/dist ./server/dist RUN CGO_ENABLED=0 go build -o slash ./bin/slash/main.go diff --git a/frontend/extension/package.json b/frontend/extension/package.json index ecc4ad83..adf4d053 100644 --- a/frontend/extension/package.json +++ b/frontend/extension/package.json @@ -8,7 +8,8 @@ "build": "plasmo build", "package": "plasmo package", "lint": "eslint --ext .js,.ts,.tsx, src", - "lint-fix": "eslint --ext .js,.ts,.tsx, src --fix" + "lint-fix": "eslint --ext .js,.ts,.tsx, src --fix", + "type-gen": "cd ../../proto && buf generate" }, "dependencies": { "@emotion/react": "^11.11.1", @@ -26,6 +27,7 @@ "zustand": "^4.4.1" }, "devDependencies": { + "@bufbuild/buf": "^1.27.0", "@trivago/prettier-plugin-sort-imports": "4.1.0", "@types/chrome": "0.0.241", "@types/lodash-es": "^4.17.9", diff --git a/frontend/extension/pnpm-lock.yaml b/frontend/extension/pnpm-lock.yaml index 0a5f325f..b49ac046 100644 --- a/frontend/extension/pnpm-lock.yaml +++ b/frontend/extension/pnpm-lock.yaml @@ -46,6 +46,9 @@ dependencies: version: 4.4.1(@types/react@18.2.15)(react@18.2.0) devDependencies: + '@bufbuild/buf': + specifier: ^1.27.0 + version: 1.27.0 '@trivago/prettier-plugin-sort-imports': specifier: 4.1.0 version: 4.1.0(prettier@2.6.2) @@ -345,6 +348,74 @@ packages: '@babel/helper-validator-identifier': 7.22.20 to-fast-properties: 2.0.0 + /@bufbuild/buf-darwin-arm64@1.27.0: + resolution: {integrity: sha512-Bsdo9BkkIlIgBpQJ2jyIXl9ggSqDdSJ12euxgU1y4pbT5iD11mdiUA7eq5/ssxLJilUrUGj2Gk1h1KbYG/JfVA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@bufbuild/buf-darwin-x64@1.27.0: + resolution: {integrity: sha512-aJmSZvO6uNxHST8+kN5cukv7/ZLgDnvklp+r6uyokocg5sk1rgWQVBqiVtGmoDWwPbotpMhb3EuqtwN9hdNrOg==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@bufbuild/buf-linux-aarch64@1.27.0: + resolution: {integrity: sha512-1NPHARYENNVWOK3bQxbnYsMLU09em4/kdyAnCwyGkNhr+pWUlWdCBu3X5tdrRW+mnhjeagIcomTMhgVjxIAS7g==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@bufbuild/buf-linux-x64@1.27.0: + resolution: {integrity: sha512-3LMTSJlwJAeOfjPuB0NBK+1Yfg1Bybadt+c1X/vF8XSXut1u0Ju1/fbRDz75BF4AlMidMQPdGS+vPWmPcb51hA==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@bufbuild/buf-win32-arm64@1.27.0: + resolution: {integrity: sha512-Za5d3obNvSfLZAlQW8IAWtv1Yv0gQTFDVMPyYiOh70rKIfKIxrWZxT4E4nzFLZZ54VQDFoUl81bAjOYLOgaspQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@bufbuild/buf-win32-x64@1.27.0: + resolution: {integrity: sha512-OzVK4Fz162Z6fFHAAZhHPW2GiCXjweCG/hwjOtFt2gza1t3ImYp0CwxJI6ePGY+th3Y9yu8rY0iHiI59ezMa4Q==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@bufbuild/buf@1.27.0: + resolution: {integrity: sha512-vR/ke6gUNgGSC3z7WkHLcbO+ur+zvGTC4ohHsLo2dZqEWysWySjNpcU70SKdIN3G5M4fSS1ki6MkZPes3E+83w==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@bufbuild/buf-darwin-arm64': 1.27.0 + '@bufbuild/buf-darwin-x64': 1.27.0 + '@bufbuild/buf-linux-aarch64': 1.27.0 + '@bufbuild/buf-linux-x64': 1.27.0 + '@bufbuild/buf-win32-arm64': 1.27.0 + '@bufbuild/buf-win32-x64': 1.27.0 + dev: true + /@emotion/babel-plugin@11.11.0: resolution: {integrity: sha512-m4HEDZleaaCH+XgDDsPF15Ht6wTLsgDTeR3WYj9Q/k76JtWhrJjcP4+/XlG8LGT/Rol9qUfOIztXeA84ATpqPQ==} dependencies: diff --git a/frontend/web/package.json b/frontend/web/package.json index 9c6b4515..a4ba49e5 100644 --- a/frontend/web/package.json +++ b/frontend/web/package.json @@ -5,7 +5,8 @@ "build": "tsc && vite build", "serve": "vite preview", "lint": "eslint --ext .js,.ts,.tsx, src", - "lint-fix": "eslint --ext .js,.ts,.tsx, src --fix" + "lint-fix": "eslint --ext .js,.ts,.tsx, src --fix", + "type-gen": "cd ../../proto && buf generate" }, "dependencies": { "@emotion/react": "^11.11.1", @@ -32,6 +33,7 @@ "zustand": "^4.4.1" }, "devDependencies": { + "@bufbuild/buf": "^1.27.0", "@trivago/prettier-plugin-sort-imports": "^4.2.0", "@types/lodash-es": "^4.17.9", "@types/react": "^18.2.23", diff --git a/frontend/web/pnpm-lock.yaml b/frontend/web/pnpm-lock.yaml index 50ea6e79..faf5de5e 100644 --- a/frontend/web/pnpm-lock.yaml +++ b/frontend/web/pnpm-lock.yaml @@ -73,6 +73,9 @@ dependencies: version: 4.4.1(@types/react@18.2.23)(react@18.2.0) devDependencies: + '@bufbuild/buf': + specifier: ^1.27.0 + version: 1.27.0 '@trivago/prettier-plugin-sort-imports': specifier: ^4.2.0 version: 4.2.0(prettier@2.6.2) @@ -264,6 +267,74 @@ packages: '@babel/helper-validator-identifier': 7.22.20 to-fast-properties: 2.0.0 + /@bufbuild/buf-darwin-arm64@1.27.0: + resolution: {integrity: sha512-Bsdo9BkkIlIgBpQJ2jyIXl9ggSqDdSJ12euxgU1y4pbT5iD11mdiUA7eq5/ssxLJilUrUGj2Gk1h1KbYG/JfVA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@bufbuild/buf-darwin-x64@1.27.0: + resolution: {integrity: sha512-aJmSZvO6uNxHST8+kN5cukv7/ZLgDnvklp+r6uyokocg5sk1rgWQVBqiVtGmoDWwPbotpMhb3EuqtwN9hdNrOg==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@bufbuild/buf-linux-aarch64@1.27.0: + resolution: {integrity: sha512-1NPHARYENNVWOK3bQxbnYsMLU09em4/kdyAnCwyGkNhr+pWUlWdCBu3X5tdrRW+mnhjeagIcomTMhgVjxIAS7g==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@bufbuild/buf-linux-x64@1.27.0: + resolution: {integrity: sha512-3LMTSJlwJAeOfjPuB0NBK+1Yfg1Bybadt+c1X/vF8XSXut1u0Ju1/fbRDz75BF4AlMidMQPdGS+vPWmPcb51hA==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@bufbuild/buf-win32-arm64@1.27.0: + resolution: {integrity: sha512-Za5d3obNvSfLZAlQW8IAWtv1Yv0gQTFDVMPyYiOh70rKIfKIxrWZxT4E4nzFLZZ54VQDFoUl81bAjOYLOgaspQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@bufbuild/buf-win32-x64@1.27.0: + resolution: {integrity: sha512-OzVK4Fz162Z6fFHAAZhHPW2GiCXjweCG/hwjOtFt2gza1t3ImYp0CwxJI6ePGY+th3Y9yu8rY0iHiI59ezMa4Q==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@bufbuild/buf@1.27.0: + resolution: {integrity: sha512-vR/ke6gUNgGSC3z7WkHLcbO+ur+zvGTC4ohHsLo2dZqEWysWySjNpcU70SKdIN3G5M4fSS1ki6MkZPes3E+83w==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@bufbuild/buf-darwin-arm64': 1.27.0 + '@bufbuild/buf-darwin-x64': 1.27.0 + '@bufbuild/buf-linux-aarch64': 1.27.0 + '@bufbuild/buf-linux-x64': 1.27.0 + '@bufbuild/buf-win32-arm64': 1.27.0 + '@bufbuild/buf-win32-x64': 1.27.0 + dev: true + /@emotion/babel-plugin@11.11.0: resolution: {integrity: sha512-m4HEDZleaaCH+XgDDsPF15Ht6wTLsgDTeR3WYj9Q/k76JtWhrJjcP4+/XlG8LGT/Rol9qUfOIztXeA84ATpqPQ==} dependencies: