@jambff/oac
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -9,2 +9,3 @@ const { ModuleKind } = require('typescript'); | ||
const assert = require('assert'); | ||
const glob = require('fast-glob'); | ||
const { pascalCase } = require('pascal-case'); | ||
@@ -328,6 +329,7 @@ const openapiTS = require('openapi-typescript'); | ||
const distDir = path.join(appRoot.path, 'node_modules', '.oac'); | ||
const files = glob.sync('**.ts', { cwd: SRC_DIR, absolute: true }); | ||
compileTs(path.join(SRC_DIR, 'index.ts'), ModuleKind.CommonJS, distDir); | ||
compileTs(files, ModuleKind.CommonJS, distDir); | ||
console.info(`${chalk.green('✔')} OpenAPI client generated`); | ||
}; |
@@ -42,4 +42,4 @@ const ts = require('typescript'); | ||
module.exports.compileTs = (entryPoint, module, outDir) => { | ||
compile([entryPoint], { | ||
module.exports.compileTs = (files, module, outDir) => { | ||
compile(files, { | ||
noEmitOnError: true, | ||
@@ -46,0 +46,0 @@ noImplicitAny: true, |
{ | ||
"name": "@jambff/oac", | ||
"description": "A JavaScript OpenAPI client generator.", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"author": "Alex Mendes", | ||
@@ -41,2 +41,3 @@ "license": "MIT", | ||
"chalk": "^4.1.2", | ||
"fast-glob": "^3.2.11", | ||
"fs-extra": "^11.1.0", | ||
@@ -43,0 +44,0 @@ "handlebars": "^4.7.7", |
@@ -25,14 +25,5 @@ # OAC | ||
This repository exposes a command line tool that you can run to generate the | ||
OpenAPI client. Add a script to your `package.json`: | ||
OpenAPI client. After installing the package you can generate the client from | ||
an OpenAPI specification with the following command: | ||
```json | ||
{ | ||
"scripts": { | ||
"oac": "oac", | ||
} | ||
} | ||
``` | ||
Then run: | ||
```text | ||
@@ -39,0 +30,0 @@ yarn oac http://example.api.com/docs.json |
@@ -13,2 +13,3 @@ // @ts-ignore | ||
...acc, | ||
// @ts-ignore | ||
[operation]: jest.fn(() => { | ||
@@ -30,7 +31,10 @@ console.warn( | ||
// Create a mock OpenAPI client. | ||
// @ts-ignore | ||
export const createOpenApiClient = jest.fn(() => mockClient); | ||
// Use the real isOpenApiClientError function. | ||
// @ts-ignore | ||
export const isOpenApiClientError = jest.fn((err) => | ||
// @ts-ignore | ||
jest.requireActual('../errors').isOpenApiClientError(err), | ||
); |
38891
846
16
271
+ Addedfast-glob@^3.2.11