From 31845728b26cc22af7a0b3c2244972e06f17cedc Mon Sep 17 00:00:00 2001 From: Pugma Date: Sun, 23 Jun 2024 13:01:32 +0900 Subject: [PATCH 1/2] =?UTF-8?q?API=E5=AE=9A=E7=BE=A9=E3=81=8B=E3=82=89?= =?UTF-8?q?=E3=81=AE=E8=87=AA=E5=8B=95=E7=94=9F=E6=88=90=E5=91=A8=E3=82=8A?= =?UTF-8?q?=E3=82=92=E4=B8=80=E6=8B=AC=E3=81=A7=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 13 ++----------- .github/workflows/release.yaml | 1 + .github/workflows/staging.yml | 1 + Dockerfile | 2 +- package.json | 3 +-- scripts/generateApi.js | 5 ----- 6 files changed, 6 insertions(+), 19 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4c8e338b..9a25be70 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,8 +17,6 @@ jobs: node-version-file: .node-version cache: npm - run: npm ci - env: - SKIP_GENAPI: 1 genApi: name: Generate APIs runs-on: ubuntu-latest @@ -29,6 +27,7 @@ jobs: node-version-file: .node-version cache: npm - run: npm ci + - run: npm run gen-api - uses: actions/upload-artifact@v4 with: name: apis @@ -46,8 +45,6 @@ jobs: node-version-file: .node-version cache: npm - run: npm ci - env: - SKIP_GENAPI: 1 - uses: actions/download-artifact@v4 with: name: apis @@ -68,8 +65,6 @@ jobs: node-version-file: .node-version cache: npm - run: npm ci - env: - SKIP_GENAPI: 1 - uses: actions/download-artifact@v4 with: name: apis @@ -88,8 +83,6 @@ jobs: node-version-file: .node-version cache: npm - run: npm ci - env: - SKIP_GENAPI: 1 - uses: actions/download-artifact@v4 with: name: apis @@ -108,8 +101,6 @@ jobs: node-version-file: .node-version cache: npm - run: npm ci - env: - SKIP_GENAPI: 1 - uses: actions/download-artifact@v4 with: name: apis @@ -127,7 +118,7 @@ jobs: with: node-version-file: .node-version cache: npm - - run: SKIP_GENAPI=1 npm ci + - run: npm ci - uses: actions/download-artifact@v4 with: name: apis diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1b5b19ee..63f31a66 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -23,6 +23,7 @@ jobs: node-version-file: .node-version cache: npm - run: npm ci + - run: npm run gen-api - uses: actions/upload-artifact@v4 with: name: apis diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index e81d10c3..6ff027a3 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -20,6 +20,7 @@ jobs: node-version-file: .node-version cache: npm - run: npm ci + - run: npm run gen-api - uses: actions/upload-artifact@v4 with: name: apis diff --git a/Dockerfile b/Dockerfile index 8384073d..06275826 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ WORKDIR /app RUN apk update -ENV NODE_ENV=production SKIP_GENAPI=1 +ENV NODE_ENV=production COPY package.json package-lock.json ./ COPY scripts/ ./scripts/ diff --git a/package.json b/package.json index 50fbf593..881af7b2 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,7 @@ "type-check": "vue-tsc --noEmit", "test": "vitest --passWithNoTests", "gen-api": "node scripts/generateApi.js", - "start-mock": "prism mock -p 4010 -d https://raw.githubusercontent.com/traPtitech/traPortfolio/main/docs/swagger/traPortfolio.v1.yaml", - "postinstall": "npm run gen-api" + "start-mock": "prism mock -p 4010 -d https://raw.githubusercontent.com/traPtitech/traPortfolio/main/docs/swagger/traPortfolio.v1.yaml" }, "dependencies": { "@iconify/iconify": "^3.1.1", diff --git a/scripts/generateApi.js b/scripts/generateApi.js index 7ef35eef..289fe3c8 100644 --- a/scripts/generateApi.js +++ b/scripts/generateApi.js @@ -24,11 +24,6 @@ const generateCmd = [ `/local/${GENERATED_DIR}` ] -if (process.env.SKIP_GENAPI) { - // eslint-disable-next-line no-console - console.log('Skipped generating apis.') -} - ;(async () => { await fs.mkdir(path.resolve(__dirname, '../', GENERATED_DIR), { recursive: true From d78524235b0939c077182872e18d6d1df9add10c Mon Sep 17 00:00:00 2001 From: Pugma Date: Sun, 23 Jun 2024 13:04:07 +0900 Subject: [PATCH 2/2] =?UTF-8?q?script=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=82=92=E8=BC=89=E3=81=9B=E3=81=AA=E3=81=84=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 3 ++- Dockerfile | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index 3c15c357..81426744 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,4 +4,5 @@ node_modules .DS_Store -/dist +dist +scripts diff --git a/Dockerfile b/Dockerfile index 06275826..854b7449 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,6 @@ RUN apk update ENV NODE_ENV=production COPY package.json package-lock.json ./ -COPY scripts/ ./scripts/ RUN npm ci COPY . . RUN npm run build