Skip to content

Commit

Permalink
VR-99: swagger JSON is being looked at src/ rather than build/ fix. (#40
Browse files Browse the repository at this point in the history
)

* VR-99: swagger JSON is being looked at src/ rather than build/ fix.

* VR-99: rebase and version bump.

* VR-99: rebase and version bump.

* VR-99: versiom bump/

* VR-99: unused variable.

---------

Co-authored-by: Paulius Michelevicius <[email protected]>
  • Loading branch information
n3op2 and Paulius Michelevicius authored May 30, 2024
1 parent 9d34e17 commit 4bf4721
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "veritable-ui",
"version": "0.3.13",
"version": "0.3.14",
"description": "UI for Veritable",
"main": "src/index.ts",
"type": "module",
Expand Down
10 changes: 7 additions & 3 deletions src/swagger.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import fs from 'node:fs/promises'
import fs from 'fs/promises'
import path from 'path'
import { fileURLToPath } from 'url'

import path from 'node:path'
import { Env } from './env.js'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

/**
* Monkey-patch the generated swagger JSON so that when it is valid for the deployed environment
* @param env Environment containing configuration for monkey-patching the swagger
Expand All @@ -13,7 +17,7 @@ export default async function loadApiSpec(env: Env): Promise<unknown> {
const authorizationUrl = `${env.get('IDP_PUBLIC_URL_PREFIX')}${env.get('IDP_AUTH_PATH')}`
const tokenUrl = `${env.get('IDP_PUBLIC_URL_PREFIX')}${env.get('IDP_TOKEN_PATH')}`

const swaggerBuffer = await fs.readFile(path.join('src/swagger.json'))
const swaggerBuffer = await fs.readFile(path.join(__dirname, './swagger.json'))
const swaggerJson = JSON.parse(swaggerBuffer.toString('utf8'))
swaggerJson.info.title += `:${API_SWAGGER_HEADING}`
swaggerJson.components.securitySchemes.oauth2.flows.authorizationCode.authorizationUrl = authorizationUrl
Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"plugins": [{ "name": "@kitajs/ts-html-plugin" }],
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"target": "ES2021",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"strict": true,
"sourceMap": true,
Expand Down

0 comments on commit 4bf4721

Please sign in to comment.