Skip to content

Commit

Permalink
feat: add copy-files, better path for spec files
Browse files Browse the repository at this point in the history
  • Loading branch information
njlie committed Nov 8, 2022
1 parent 21c3c1f commit c7f1f8a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ pnpm --filter open-api test
# run all tests
pnpm -r --workspace-concurrency=1 test

# pull in latest openapi specs for auth server:
pnpm --filter auth fetch-schemas

# format and lint code:
pnpm format

Expand Down
5 changes: 3 additions & 2 deletions packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
"scripts": {
"knex": "knex",
"build:deps": "pnpm --filter openapi build",
"build": "pnpm build:deps && tsc --build tsconfig.json",
"build": "pnpm build:deps && tsc --build tsconfig.json && pnpm copy-files",
"clean": "rm -fr dist/",
"fetch-schemas": "./scripts/get-op-schema.sh",
"test": "jest --passWithNoTests --maxWorkers=50%",
"prepack": "pnpm build"
"prepack": "pnpm build",
"copy-files": "pnpm fetch-schemas && cp -r ./openapi ./dist"
},
"dependencies": {
"@adonisjs/fold": "^8.1.0",
Expand Down
11 changes: 8 additions & 3 deletions packages/auth/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'path'
import { EventEmitter } from 'events'
import createLogger from 'pino'
import { knex } from 'knex'
Expand Down Expand Up @@ -103,11 +104,15 @@ export function initIocContainer(
})

container.singleton('openApi', async () => {
const authServerSpec = await createOpenAPI('./openapi/auth-server.yaml')
const authServerSpec = await createOpenAPI(
path.resolve(__dirname, './openapi/auth-server.yaml')
)
const resourceServerSpec = await createOpenAPI(
'./openapi/resource-server.yaml'
path.resolve(__dirname, './openapi/resource-server.yaml')
)
const idpSpec = await createOpenAPI(
path.resolve(__dirname, './openapi/id-provider.yaml')
)
const idpSpec = await createOpenAPI('./openapi/id-provider.yaml')
return {
authServerSpec,
resourceServerSpec,
Expand Down

0 comments on commit c7f1f8a

Please sign in to comment.