Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APIの参照先変更 #156

Merged
merged 5 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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