From 5925bba4938b4239b74d5ae98f32de0b457f9179 Mon Sep 17 00:00:00 2001 From: Pugma Date: Thu, 18 Jan 2024 16:22:47 +0900 Subject: [PATCH 1/4] =?UTF-8?q?API=E3=81=AE=E5=8F=82=E7=85=A7=E5=85=88?= =?UTF-8?q?=E3=82=92=E3=83=AD=E3=83=BC=E3=82=AB=E3=83=AB=E3=81=8B=E3=82=89?= =?UTF-8?q?GitHub=E4=B8=8A=E3=81=AE=E5=85=AC=E9=96=8B=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E3=81=AB=E5=A4=89=E6=9B=B4=20=E5=85=B7?= =?UTF-8?q?=E4=BD=93=E7=9A=84=E3=81=AB=E3=81=AF=E3=80=81=E3=83=90=E3=83=83?= =?UTF-8?q?=E3=82=AF=E3=82=A8=E3=83=B3=E3=83=89main=E3=83=AA=E3=83=9D?= =?UTF-8?q?=E3=82=B8=E3=83=88=E3=83=AA=E3=81=AEapi=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E3=81=A8=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/generateApi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generateApi.js b/scripts/generateApi.js index bba7a69a..ba233e6b 100644 --- a/scripts/generateApi.js +++ b/scripts/generateApi.js @@ -7,7 +7,7 @@ const { promisify } = require('util') const execPromise = promisify(exec) const addApis = require('./addApis') -const SWAGGER_PATH = 'scripts/traPortfolio.v1.yaml' +const SWAGGER_PATH = 'https://raw.githubusercontent.com/traPtitech/traPortfolio/main/docs/swagger/traPortfolio.v1.yaml' const GENERATED_DIR = 'src/lib/apis/generated' const npx = process.platform === 'win32' ? 'npx.cmd' : 'npx' From 2a65c4235c13760aa1705bb200793dad7bb502cf Mon Sep 17 00:00:00 2001 From: Pugma Date: Sun, 21 Jan 2024 13:26:41 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fetchApi=E3=81=AE=E5=89=8A=E9=99=A4=20/=20v?= =?UTF-8?q?3=E3=81=8B=E3=82=89v4=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 21 ++++++++++----------- package.json | 6 ++---- scripts/fetchOpenapi.js | 21 --------------------- 3 files changed, 12 insertions(+), 36 deletions(-) delete mode 100644 scripts/fetchOpenapi.js diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index af32ca5b..e2055d23 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ jobs: name: Packages runs-on: ubuntu-latest steps: - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 20.x - uses: actions/checkout@v4 @@ -20,13 +20,12 @@ jobs: name: Generate APIs runs-on: ubuntu-latest steps: - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 20.x - uses: actions/checkout@v4 - - run: SKIP_GENAPI=1 npm ci - - run: npm run postinstall - - uses: actions/upload-artifact@v3 + - run: npm ci + - uses: actions/upload-artifact@v4 with: name: apis path: ./src/lib/apis/generated @@ -35,12 +34,12 @@ jobs: runs-on: ubuntu-latest needs: [packages, genApi] steps: - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 20.x - uses: actions/checkout@v4 - run: SKIP_GENAPI=1 npm ci - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: apis path: ./src/lib/apis/generated @@ -52,12 +51,12 @@ jobs: runs-on: ubuntu-latest needs: [packages, genApi] steps: - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 20.x - uses: actions/checkout@v4 - run: SKIP_GENAPI=1 npm ci - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: apis path: ./src/lib/apis/generated @@ -67,12 +66,12 @@ jobs: runs-on: ubuntu-latest needs: [packages, genApi] steps: - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 20.x - uses: actions/checkout@v4 - run: SKIP_GENAPI=1 npm ci - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: apis path: ./src/lib/apis/generated diff --git a/package.json b/package.json index 094aacca..753a776e 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,9 @@ "lint": "eslint --fix --ext .ts,.vue src", "lint:nofix": "eslint --ext .ts,.vue src", "type-check": "vue-tsc --noEmit", - "fetch-openapi": "node scripts/fetchOpenapi.js", "gen-api": "node scripts/generateApi.js", - "start-mock": "prism mock -p 4010 -d scripts/traPortfolio.v1.yaml", - "clean": "rimraf scripts/traPorfolio.v1.yaml src/lib/apis/generated", - "postinstall": "npm run fetch-openapi && npm run gen-api" + "start-mock": "prism mock -p 4010 -d https://raw.githubusercontent.com/traPtitech/traPortfolio/main/docs/swagger/traPortfolio.v1.yaml", + "postinstall": "npm run gen-api" }, "dependencies": { "@iconify/iconify": "^3.1.1", diff --git a/scripts/fetchOpenapi.js b/scripts/fetchOpenapi.js deleted file mode 100644 index 3d6ec81e..00000000 --- a/scripts/fetchOpenapi.js +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ -/* eslint-disable no-undef */ -const fetch = require('node-fetch') -const fs = require('fs').promises -const path = require('path') - -const URL = - 'https://raw.githubusercontent.com/traPtitech/traPortfolio/main/docs/swagger/traPortfolio.v1.yaml' -const dist = './traPortfolio.v1.yaml' - -if (process.env.SKIP_GENAPI) { - // eslint-disable-next-line no-console - console.log('Skipped fetching openapi.') - return -} - -;(async () => { - const res = await fetch(URL) - const body = await res.text() - await fs.writeFile(path.resolve(__dirname, dist), body) -})() From cb54dd30c3f72d34cee24aabfa11063e490b3124 Mon Sep 17 00:00:00 2001 From: Pugma Date: Sun, 21 Jan 2024 13:35:02 +0900 Subject: [PATCH 3/4] =?UTF-8?q?setup-node=E3=81=8C`.node-version`=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=AE=E3=83=90=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=82=92=E5=8F=82=E7=85=A7=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e2055d23..83d225a5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,7 +13,8 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: 20.x + node-version-file: .node-version + cache: npm - uses: actions/checkout@v4 - run: SKIP_GENAPI=1 npm ci genApi: @@ -22,7 +23,8 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: 20.x + node-version-file: .node-version + cache: npm - uses: actions/checkout@v4 - run: npm ci - uses: actions/upload-artifact@v4 @@ -36,7 +38,8 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: 20.x + node-version-file: .node-version + cache: npm - uses: actions/checkout@v4 - run: SKIP_GENAPI=1 npm ci - uses: actions/download-artifact@v4 @@ -53,7 +56,8 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: 20.x + node-version-file: .node-version + cache: npm - uses: actions/checkout@v4 - run: SKIP_GENAPI=1 npm ci - uses: actions/download-artifact@v4 @@ -68,7 +72,8 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: 20.x + node-version-file: .node-version + cache: npm - uses: actions/checkout@v4 - run: SKIP_GENAPI=1 npm ci - uses: actions/download-artifact@v4 From aefa139d57f5be4c1c1fe4b861f3f00b2d503904 Mon Sep 17 00:00:00 2001 From: Pugma Date: Sun, 21 Jan 2024 13:40:42 +0900 Subject: [PATCH 4/4] =?UTF-8?q?`checkout`=E3=81=A8`setup-node`=E3=81=AE?= =?UTF-8?q?=E9=A0=86=E5=BA=8F=E3=82=92=E5=85=A5=E3=82=8C=E6=9B=BF=E3=81=88?= =?UTF-8?q?=E3=81=A6UI=E3=81=AE=E6=96=B9=E3=81=AECi=E3=81=A8=E7=B5=B1?= =?UTF-8?q?=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 83d225a5..ff1e9f15 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,21 +11,21 @@ jobs: name: Packages runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version-file: .node-version cache: npm - - uses: actions/checkout@v4 - run: SKIP_GENAPI=1 npm ci genApi: name: Generate APIs runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version-file: .node-version cache: npm - - uses: actions/checkout@v4 - run: npm ci - uses: actions/upload-artifact@v4 with: @@ -36,11 +36,11 @@ jobs: runs-on: ubuntu-latest needs: [packages, genApi] steps: + - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version-file: .node-version cache: npm - - uses: actions/checkout@v4 - run: SKIP_GENAPI=1 npm ci - uses: actions/download-artifact@v4 with: @@ -54,11 +54,11 @@ jobs: runs-on: ubuntu-latest needs: [packages, genApi] steps: + - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version-file: .node-version cache: npm - - uses: actions/checkout@v4 - run: SKIP_GENAPI=1 npm ci - uses: actions/download-artifact@v4 with: @@ -70,11 +70,11 @@ jobs: runs-on: ubuntu-latest needs: [packages, genApi] steps: + - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version-file: .node-version cache: npm - - uses: actions/checkout@v4 - run: SKIP_GENAPI=1 npm ci - uses: actions/download-artifact@v4 with: