Skip to content

Commit 3b94880

Browse files
authored
fix(deps): fix breaking peer dep requirements (#17)
1 parent c2f59a7 commit 3b94880

File tree

7 files changed

+80
-83
lines changed

7 files changed

+80
-83
lines changed

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,17 @@ Usage: openapi-rq [options]
2424
Generate React Query code based on OpenAPI
2525
2626
Options:
27-
-V, --version output the version number
28-
-i, --input <value> OpenAPI specification, can be a path, url or string content (required)
29-
-o, --output <value> Output directory (default: "openapi")
30-
-c, --client <value> HTTP client to generate [fetch, xhr, node, axios, angular] (default: "fetch")
31-
--useUnionTypes Use union types (default: false)
32-
--exportSchemas <value> Write schemas to disk (default: false)
33-
--indent <value> Indentation options [4, 2, tabs] (default: "4")
34-
--postfix <value> Service name postfix (default: "Service")
35-
--request <value> Path to custom request file
36-
-h, --help display help for command
27+
-V, --version output the version number
28+
-i, --input <value> OpenAPI specification, can be a path, url or string content (required)
29+
-o, --output <value> Output directory (default: "openapi")
30+
-c, --client <value> HTTP client to generate [fetch, xhr, node, axios, angular] (default: "fetch")
31+
--useUnionTypes Use union types (default: false)
32+
--exportSchemas <value> Write schemas to disk (default: false)
33+
--indent <value> Indentation options [4, 2, tabs] (default: "4")
34+
--postfixServices <value> Service name postfix (default: "Service")
35+
--postfixModels <value> Modal name postfix
36+
--request <value> Path to custom request file
37+
-h, --help display help for command
3738
```
3839

3940
## Example Usage

examples/react-app/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@
99
"dev:mock": "prism mock ./petstore.yaml",
1010
"build": "tsc && vite build",
1111
"preview": "vite preview",
12-
"generate:api": "node ../../dist/src/cli.js -i ./petstore.yaml -c axios --exportSchemas=true --postfix=Client --request ./request.ts",
12+
"generate:api": "node ../../dist/src/cli.js -i ./petstore.yaml -c axios --exportSchemas=true --postfixServices=Client --request ./request.ts",
1313
"test:generated": "tsc ./openapi/queries/index.ts --noEmit --target esnext --moduleResolution node"
1414
},
1515
"dependencies": {
16-
"@tanstack/react-query": "^4.28.0",
16+
"@tanstack/react-query": "^4.29.1",
1717
"axios": "^1.3.5",
1818
"form-data": "~4.0.0",
1919
"react": "^18.2.0",
2020
"react-dom": "^18.2.0"
2121
},
2222
"devDependencies": {
2323
"@stoplight/prism-cli": "^4.11.1",
24-
"@types/react": "^18.0.33",
24+
"@types/react": "^18.0.34",
2525
"@types/react-dom": "^18.0.11",
2626
"@vitejs/plugin-react": "^3.1.0",
2727
"npm-run-all": "^4.1.5",
28-
"typescript": "^5.0.3",
28+
"typescript": "^5.0.4",
2929
"vite": "^4.2.1"
3030
}
3131
}

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@
3434
"devDependencies": {
3535
"@types/node": "^18.15.11",
3636
"commander": "^10.0.0",
37-
"glob": "^9.3.4",
38-
"openapi-typescript-codegen": "^0.23.0",
39-
"typescript": "^5.0.3"
37+
"glob": "^10.0.0",
38+
"openapi-typescript-codegen": "^0.24.0",
39+
"typescript": "^5.0.4"
4040
},
4141
"peerDependencies": {
42-
"commander": "> 10",
43-
"glob": "> 9",
44-
"openapi-typescript-codegen": "^0.23.0",
42+
"commander": ">= 10 < 11",
43+
"glob": ">= 10",
44+
"openapi-typescript-codegen": "^0.24.0",
4545
"typescript": ">= 4.8.3"
4646
}
4747
}

pnpm-lock.yaml

Lines changed: 51 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Options } from "openapi-typescript-codegen";
77
export type CLIOptions = {
88
output?: string;
99
client?: Options["httpClient"];
10-
} & Pick<Options, 'exportSchemas' | 'postfix' | 'request' | 'indent' | 'input' | 'useUnionTypes'>;
10+
} & Pick<Options, 'exportSchemas' | 'postfixModels' | 'postfixServices' | 'request' | 'indent' | 'input' | 'useUnionTypes'>;
1111

1212
const program = new Command();
1313

@@ -28,7 +28,8 @@ program
2828
.option("--useUnionTypes", "Use union types", false)
2929
.option("--exportSchemas <value>", "Write schemas to disk", false)
3030
.option("--indent <value>", "Indentation options [4, 2, tabs]", "4")
31-
.option("--postfix <value>", "Service name postfix", "Service")
31+
.option("--postfixServices <value>", "Service name postfix", "Service")
32+
.option("--postfixModels <value>", "Modal name postfix")
3233
.option("--request <value>", "Path to custom request file")
3334
.parse();
3435

src/createExports.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import ts from "typescript";
2-
import glob from "glob";
2+
import { sync } from "glob";
33
import { join } from "path";
44
import fs from "fs";
55
import { createUseQuery } from "./createUseQuery";
66
import { createUseMutation } from "./createUseMutation";
77

88
export const createExports = (generatedClientsPath: string) => {
9-
const services = glob.sync(join(generatedClientsPath, 'services', '*.ts').replace(/\\/g, '/'));
9+
const services = sync(join(generatedClientsPath, 'services', '*.ts').replace(/\\/g, '/'));
1010
const nodes = services.map((servicePath) =>
1111
ts.createSourceFile(
1212
servicePath, // fileName

src/createImports.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import ts from "typescript";
2-
import glob from "glob";
2+
import { sync } from "glob";
33
import { extname, basename, join } from "path";
44

55
export const createImports = (generatedClientsPath: string) => {
6-
const models = glob.sync(join(generatedClientsPath, 'models', '*.ts').replace(/\\/g, '/'));
7-
const services = glob.sync(join(generatedClientsPath, 'services', '*.ts').replace(/\\/g, '/'));
6+
const models = sync(join(generatedClientsPath, 'models', '*.ts').replace(/\\/g, '/'));
7+
const services = sync(join(generatedClientsPath, 'services', '*.ts').replace(/\\/g, '/'));
88
return [
99
ts.factory.createImportDeclaration(
1010
undefined,

0 commit comments

Comments
 (0)