Skip to content

Commit

Permalink
feat(open-payments): downgrading generation lib, updating how script …
Browse files Browse the repository at this point in the history
…is ran
  • Loading branch information
mkurapov committed Oct 14, 2022
1 parent 050ebef commit 9893029
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 19 deletions.
9 changes: 4 additions & 5 deletions packages/open-payments/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
{
"name": "open-payments",
"version": "1.0.0",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"files": [
"dist/**/*"
],
"scripts": {
"build": "pnpm clean && tsc --build tsconfig.json",
"clean": "rm -fr dist/",
"prepack": "pnpm build",
"generate:types": "node scripts/generate-types.js"
"generate:types": "npx ts-node scripts/generate-types.ts"
},
"devDependencies": {
"@types/node": "^18.7.12",
"openapi-typescript": "^5.4.1",
"typescript": "^4.2.4"
"openapi-typescript": "^4.5.0",

This comment has been minimized.

Copy link
@wilsonianb

wilsonianb Oct 14, 2022

Contributor

Why the downgrade?

"ts-node": "^10.7.0",
"typescript": "^4.3.0"
},
"dependencies": {
"axios": "^1.1.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import fs from 'fs'
import openapiTS from 'openapi-typescript'
import config from '../config.js'
import config from '../src/config'
;(async () => {
try {
const output = await openapiTS(new URL(config.OPEN_PAYMENTS_OPEN_API_URL))
const output = await openapiTS(config.OPEN_PAYMENTS_OPEN_API_URL)
const fileName = 'src/generated/types.ts'

fs.writeFile(fileName, output, (error) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/open-payments/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ILPStreamConnection, IncomingPayment } from './types'
import axios, { AxiosInstance } from 'axios'
import config from '../config.js'
import config from './config'

interface CreateOpenPaymentClientArgs {
timeout?: number
Expand Down Expand Up @@ -39,9 +39,9 @@ const get = async <T>(axios: AxiosInstance, args: GetArgs): Promise<T> => {
export const createClient = (
args?: CreateOpenPaymentClientArgs
): OpenPaymentsClient => {
const defaultTimeout = config['DEFAULT_REQUEST_TIMEOUT'] || 3_000
const defaultTimeout = config.DEFAULT_REQUEST_TIMEOUT || 3_000
const axiosInstance = axios.create({
timeout: args.timeout || defaultTimeout
timeout: args.timeout ?? defaultTimeout
})

axiosInstance.defaults.headers.common['Content-Type'] = 'application/json'
Expand Down
File renamed without changes.
10 changes: 2 additions & 8 deletions packages/open-payments/src/generated/types.ts

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

2 changes: 1 addition & 1 deletion packages/open-payments/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"declaration": true
},
"include": ["src/**/*"],
"exclude": ["**/*.test.ts"]
"exclude": ["**/*.test.ts", "src/scripts/*"]
}

0 comments on commit 9893029

Please sign in to comment.