@7nohe/openapi-react-query-codegen 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,15 +24,17 @@ Usage: openapi-rq [options]
24
24
  Generate React Query code based on OpenAPI
25
25
 
26
26
  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
- --exportSchemas <value> Write schemas to disk (default: false)
32
- --indent <value> Indentation options [4, 2, tabs] (default: "4")
33
- --postfix <value> Service name postfix (default: "Service")
34
- --request <value> Path to custom request file
35
- -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
36
38
  ```
37
39
 
38
40
  ## Example Usage
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@7nohe/openapi-react-query-codegen",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "OpenAPI React Query Codegen",
5
5
  "bin": {
6
6
  "openapi-rq": "dist/src/cli.js"
@@ -34,14 +34,14 @@
34
34
  "devDependencies": {
35
35
  "@types/node": "^18.15.11",
36
36
  "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"
40
40
  },
41
41
  "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",
45
45
  "typescript": ">= 4.8.3"
46
46
  }
47
47
  }
package/dist/src/cli.js CHANGED
@@ -15,9 +15,11 @@ program
15
15
  .requiredOption("-i, --input <value>", "OpenAPI specification, can be a path, url or string content (required)")
16
16
  .option("-o, --output <value>", "Output directory", "openapi")
17
17
  .option("-c, --client <value>", "HTTP client to generate [fetch, xhr, node, axios, angular]", "fetch")
18
+ .option("--useUnionTypes", "Use union types", false)
18
19
  .option("--exportSchemas <value>", "Write schemas to disk", false)
19
20
  .option("--indent <value>", "Indentation options [4, 2, tabs]", "4")
20
- .option("--postfix <value>", "Service name postfix", "Service")
21
+ .option("--postfixServices <value>", "Service name postfix", "Service")
22
+ .option("--postfixModels <value>", "Modal name postfix")
21
23
  .option("--request <value>", "Path to custom request file")
22
24
  .parse();
23
25
  const options = program.opts();
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createExports = void 0;
7
7
  const typescript_1 = __importDefault(require("typescript"));
8
- const glob_1 = __importDefault(require("glob"));
8
+ const glob_1 = require("glob");
9
9
  const path_1 = require("path");
10
10
  const fs_1 = __importDefault(require("fs"));
11
11
  const createUseQuery_1 = require("./createUseQuery");
12
12
  const createUseMutation_1 = require("./createUseMutation");
13
13
  const createExports = (generatedClientsPath) => {
14
- const services = glob_1.default.sync((0, path_1.join)(generatedClientsPath, 'services', '*.ts').replace(/\\/g, '/'));
14
+ const services = (0, glob_1.sync)((0, path_1.join)(generatedClientsPath, 'services', '*.ts').replace(/\\/g, '/'));
15
15
  const nodes = services.map((servicePath) => typescript_1.default.createSourceFile(servicePath, // fileName
16
16
  fs_1.default.readFileSync((0, path_1.join)(process.cwd(), servicePath), "utf8"), typescript_1.default.ScriptTarget.Latest // langugeVersion
17
17
  ));
@@ -5,11 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createImports = void 0;
7
7
  const typescript_1 = __importDefault(require("typescript"));
8
- const glob_1 = __importDefault(require("glob"));
8
+ const glob_1 = require("glob");
9
9
  const path_1 = require("path");
10
10
  const createImports = (generatedClientsPath) => {
11
- const models = glob_1.default.sync((0, path_1.join)(generatedClientsPath, 'models', '*.ts').replace(/\\/g, '/'));
12
- const services = glob_1.default.sync((0, path_1.join)(generatedClientsPath, 'services', '*.ts').replace(/\\/g, '/'));
11
+ const models = (0, glob_1.sync)((0, path_1.join)(generatedClientsPath, 'models', '*.ts').replace(/\\/g, '/'));
12
+ const services = (0, glob_1.sync)((0, path_1.join)(generatedClientsPath, 'services', '*.ts').replace(/\\/g, '/'));
13
13
  return [
14
14
  typescript_1.default.factory.createImportDeclaration(undefined, typescript_1.default.factory.createImportClause(false, undefined, typescript_1.default.factory.createNamedImports([
15
15
  typescript_1.default.factory.createImportSpecifier(false, undefined, typescript_1.default.factory.createIdentifier("useQuery")),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@7nohe/openapi-react-query-codegen",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "OpenAPI React Query Codegen",
5
5
  "bin": {
6
6
  "openapi-rq": "dist/src/cli.js"
@@ -28,14 +28,14 @@
28
28
  "devDependencies": {
29
29
  "@types/node": "^18.15.11",
30
30
  "commander": "^10.0.0",
31
- "glob": "^9.3.4",
32
- "openapi-typescript-codegen": "^0.23.0",
33
- "typescript": "^5.0.3"
31
+ "glob": "^10.0.0",
32
+ "openapi-typescript-codegen": "^0.24.0",
33
+ "typescript": "^5.0.4"
34
34
  },
35
35
  "peerDependencies": {
36
- "commander": "> 10",
37
- "glob": "> 9",
38
- "openapi-typescript-codegen": "^0.23.0",
36
+ "commander": ">= 10 < 11",
37
+ "glob": ">= 10",
38
+ "openapi-typescript-codegen": "^0.24.0",
39
39
  "typescript": ">= 4.8.3"
40
40
  },
41
41
  "scripts": {