Added types for clients who want to use the generator in ts-node

This commit is contained in:
Ferdi Koomen 2020-10-14 11:43:44 +02:00
parent ff480e08ef
commit 245afe6a15
3 changed files with 31 additions and 9 deletions

View File

@ -1,6 +1,6 @@
{
"name": "openapi-typescript-codegen",
"version": "0.5.1",
"version": "0.5.2",
"description": "NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification.",
"author": "Ferdi Koomen",
"homepage": "https://github.com/ferdikoomen/openapi-typescript-codegen",
@ -34,12 +34,14 @@
],
"main": "dist/index.js",
"module": "dist/index.js",
"types": "types/index.d.ts",
"bin": {
"openapi": "bin/index.js"
},
"files": [
"bin/index.js",
"dist/index.js"
"dist/index.js",
"types/index.d.ts"
],
"scripts": {
"clean": "rimraf ./dist ./test/generated ./test/e2e/generated ./samples/generated ./coverage ./node_modules/.cache",
@ -52,10 +54,10 @@
"test:watch": "jest --selectProjects UNIT --watch",
"test:coverage": "jest --selectProjects UNIT --coverage",
"test:e2e": "jest --selectProjects E2E --runInBand",
"eslint": "eslint \"./src/**/*.ts\" \"./bin/index.js\"",
"eslint:fix": "eslint \"./src/**/*.ts\" \"./bin/index.js\" --fix",
"prettier": "prettier \"./src/**/*.ts\" \"./bin/index.js\" --check",
"prettier:fix": "prettier \"./src/**/*.ts\" \"./bin/index.js\" --write",
"eslint": "eslint \"./src/**/*.ts\" \"./bin/index.js\" \"./types/index.d.ts\"",
"eslint:fix": "eslint \"./src/**/*.ts\" \"./bin/index.js\" \"./types/index.d.ts\" --fix",
"prettier": "prettier \"./src/**/*.ts\" \"./bin/index.js\" \"./types/index.d.ts\" --check",
"prettier:fix": "prettier \"./src/**/*.ts\" \"./bin/index.js\" \"./types/index.d.ts\" --write",
"prepublish": "yarn run clean && yarn run release",
"codecov": "codecov --token=66c30c23-8954-4892-bef9-fbaed0a2e42b"
},

20
types/index.d.ts vendored Normal file
View File

@ -0,0 +1,20 @@
export declare enum HttpClient {
FETCH = 'fetch',
XHR = 'xhr',
NODE = 'node',
}
export interface Options {
input: string | Record<string, any>;
output: string;
httpClient?: HttpClient;
useOptions?: boolean;
useUnionTypes?: boolean;
exportCore?: boolean;
exportServices?: boolean;
exportModels?: boolean;
exportSchemas?: boolean;
write?: boolean;
}
export declare function generate(options: Options): Promise<void>;

View File

@ -4369,9 +4369,9 @@ ms@2.1.2:
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
nan@^2.12.1:
version "2.14.1"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.1.tgz#d7be34dfa3105b91494c3147089315eff8874b01"
integrity sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==
version "2.14.2"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19"
integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==
nanomatch@^1.2.9:
version "1.2.13"