diff --git a/package.json b/package.json index 12c831e8..d5e5c8ca 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 00000000..3a1e774f --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,20 @@ +export declare enum HttpClient { + FETCH = 'fetch', + XHR = 'xhr', + NODE = 'node', +} + +export interface Options { + input: string | Record; + 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; diff --git a/yarn.lock b/yarn.lock index 19b13803..7e4fc51c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"