Skip to content

Commit

Permalink
Merge pull request #156 from traPtitech/improveApiReference
Browse files Browse the repository at this point in the history
APIの参照先変更とCIの改善
  • Loading branch information
Pugma authored Jan 21, 2024
2 parents a791a27 + aefa139 commit 8990b26
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 47 deletions.
46 changes: 25 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,23 @@ jobs:
name: Packages
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: 20.x
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: SKIP_GENAPI=1 npm ci
genApi:
name: Generate APIs
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: 20.x
- uses: actions/checkout@v4
- run: SKIP_GENAPI=1 npm ci
- run: npm run postinstall
- uses: actions/upload-artifact@v3
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: npm ci
- uses: actions/upload-artifact@v4
with:
name: apis
path: ./src/lib/apis/generated
Expand All @@ -35,12 +36,13 @@ jobs:
runs-on: ubuntu-latest
needs: [packages, genApi]
steps:
- uses: actions/setup-node@v3
with:
node-version: 20.x
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: SKIP_GENAPI=1 npm ci
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: apis
path: ./src/lib/apis/generated
Expand All @@ -52,12 +54,13 @@ jobs:
runs-on: ubuntu-latest
needs: [packages, genApi]
steps:
- uses: actions/setup-node@v3
with:
node-version: 20.x
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: SKIP_GENAPI=1 npm ci
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: apis
path: ./src/lib/apis/generated
Expand All @@ -67,12 +70,13 @@ jobs:
runs-on: ubuntu-latest
needs: [packages, genApi]
steps:
- uses: actions/setup-node@v3
with:
node-version: 20.x
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: SKIP_GENAPI=1 npm ci
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: apis
path: ./src/lib/apis/generated
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
21 changes: 0 additions & 21 deletions scripts/fetchOpenapi.js

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/generateApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 8990b26

Please sign in to comment.