Skip to content

Commit

Permalink
Merge branch 'master' into feat/autoformat-with-eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlubos authored Mar 20, 2024
2 parents cf1a3b3 + 879fe97 commit 0c59b9d
Show file tree
Hide file tree
Showing 31 changed files with 84 additions and 2,385 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
dist
node_modules
samples
temp
test/e2e/generated
test/generated
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ yarn-error.log*
*.iml
dist
coverage
samples/generated
samples/swagger-codegen-cli-v2.jar
samples/swagger-codegen-cli-v3.jar
.env

# test files
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,25 @@ or
yarn add @nicolas-chaulet/openapi-typescript-codegen -D
```

and add a script to your `package.json` file
If you want to use `openapi-ts` with CLI, add a script to your `package.json` file

```json
"scripts": {
"openapi-ts": "openapi-ts"
}
```

You can also generate your client programmatically by importing `openapi-ts` in a `.ts` file.

```ts
import { createClient } from '@nicolas-chaulet/openapi-typescript-codegen'

createClient({
input: 'path/to/openapi.json',
output: 'src/client',
})
```

> ⚠️ You need to be running Node.js v18 or newer
## Configuration
Expand Down
7 changes: 2 additions & 5 deletions bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ const params = program

async function start() {
try {
const OpenAPI = await import(new URL('../dist/index.js', import.meta.url));
await OpenAPI.generate({
...params,
clientName: params.name,
});
const { createClient } = await import(new URL('../dist/index.js', import.meta.url));
await createClient(params);
process.exit(0);
} catch (error) {
console.error(error);
Expand Down
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.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nicolas-chaulet/openapi-typescript-codegen",
"version": "0.27.32",
"version": "0.27.33",
"type": "module",
"description": "Library that generates Typescript clients based on the OpenAPI specification.",
"author": "Ferdi Koomen",
Expand Down Expand Up @@ -49,7 +49,7 @@
"build-types-check": "tsc --project tsconfig.check.json",
"build-types-roll": "rollup --config rollup.dts.config.ts --configPlugin typescript && rimraf temp",
"build-types-temp": "tsc --emitDeclarationOnly --outDir temp -p src/node",
"clean": "rimraf dist test/generated test/e2e/generated samples/generated coverage node_modules/.cache",
"clean": "rimraf dist test/generated test/e2e/generated coverage node_modules/.cache",
"lint:fix": "eslint . --fix",
"lint": "eslint .",
"prepublishOnly": "npm run build",
Expand Down
21 changes: 0 additions & 21 deletions samples/codegen.sh

This file was deleted.

Loading

0 comments on commit 0c59b9d

Please sign in to comment.