@hey-api/openapi-ts 0.86.4 → 0.86.5
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/bin/run.cmd +3 -0
- package/bin/run.js +18 -0
- package/dist/{getSpec-Ci2amIoH.js → getSpec-CdBgV-sm.js} +2 -2
- package/dist/getSpec-CdBgV-sm.js.map +1 -0
- package/dist/{getSpec-6kHHn13e.cjs → getSpec-y1q2Fa6c.cjs} +2 -2
- package/dist/getSpec-y1q2Fa6c.cjs.map +1 -0
- package/dist/index.cjs +1 -1318
- package/dist/index.d.cts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.js +1 -1310
- package/dist/internal.cjs +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/run.cjs +3 -0
- package/dist/run.cjs.map +1 -0
- package/dist/run.d.cts +1 -0
- package/dist/run.d.ts +1 -0
- package/dist/run.js +3 -0
- package/dist/run.js.map +1 -0
- package/dist/src-DxujYdu0.cjs +1318 -0
- package/dist/src-DxujYdu0.cjs.map +1 -0
- package/dist/src-SnUobB4f.js +1310 -0
- package/dist/src-SnUobB4f.js.map +1 -0
- package/dist/{types-yDJUUQN6.d.ts → types-7_tn_FD9.d.ts} +7554 -7553
- package/dist/{types-CQZml4KE.d.cts → types-ComCm5zo.d.cts} +7554 -7553
- package/package.json +2 -2
- package/bin/index.cjs +0 -148
- package/dist/getSpec-6kHHn13e.cjs.map +0 -1
- package/dist/getSpec-Ci2amIoH.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hey-api/openapi-ts",
|
|
3
|
-
"version": "0.86.
|
|
3
|
+
"version": "0.86.5",
|
|
4
4
|
"description": "🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.",
|
|
5
5
|
"homepage": "https://heyapi.dev/",
|
|
6
6
|
"repository": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"./package.json": "./package.json"
|
|
67
67
|
},
|
|
68
68
|
"bin": {
|
|
69
|
-
"openapi-ts": "bin/
|
|
69
|
+
"openapi-ts": "./bin/run.js"
|
|
70
70
|
},
|
|
71
71
|
"files": [
|
|
72
72
|
"bin",
|
package/bin/index.cjs
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
const path = require('path');
|
|
6
|
-
|
|
7
|
-
const { program } = require('commander');
|
|
8
|
-
const pkg = require('../package.json');
|
|
9
|
-
|
|
10
|
-
const params = program
|
|
11
|
-
.name(Object.keys(pkg.bin)[0])
|
|
12
|
-
.usage('[options]')
|
|
13
|
-
.version(pkg.version)
|
|
14
|
-
.option(
|
|
15
|
-
'-c, --client <value>',
|
|
16
|
-
'HTTP client to generate [@hey-api/client-axios, @hey-api/client-fetch, @hey-api/client-next, @hey-api/client-nuxt, legacy/angular, legacy/axios, legacy/fetch, legacy/node, legacy/xhr]',
|
|
17
|
-
)
|
|
18
|
-
.option('-d, --debug', 'Set log level to debug')
|
|
19
|
-
.option('--dry-run [value]', 'Skip writing files to disk?')
|
|
20
|
-
.option(
|
|
21
|
-
'-e, --experimental-parser [value]',
|
|
22
|
-
'Opt-in to the experimental parser?',
|
|
23
|
-
)
|
|
24
|
-
.option('-f, --file [value]', 'Path to the config file')
|
|
25
|
-
.option(
|
|
26
|
-
'-i, --input <value>',
|
|
27
|
-
'OpenAPI specification (path, url, or string content)',
|
|
28
|
-
)
|
|
29
|
-
.option('-l, --logs [value]', 'Logs folder')
|
|
30
|
-
.option('-o, --output <value>', 'Output folder')
|
|
31
|
-
.option('-p, --plugins [value...]', "List of plugins you'd like to use")
|
|
32
|
-
.option(
|
|
33
|
-
'--base [value]',
|
|
34
|
-
'DEPRECATED. Manually set base in OpenAPI config instead of inferring from server value',
|
|
35
|
-
)
|
|
36
|
-
.option('-s, --silent', 'Set log level to silent')
|
|
37
|
-
.option(
|
|
38
|
-
'--no-log-file',
|
|
39
|
-
'Disable writing a log file. Works like --silent but without suppressing console output',
|
|
40
|
-
)
|
|
41
|
-
.option(
|
|
42
|
-
'-w, --watch [value]',
|
|
43
|
-
'Regenerate the client when the input file changes?',
|
|
44
|
-
)
|
|
45
|
-
.option('--exportCore [value]', 'DEPRECATED. Write core files to disk')
|
|
46
|
-
.option('--name <value>', 'DEPRECATED. Custom client class name')
|
|
47
|
-
.option('--request <value>', 'DEPRECATED. Path to custom request file')
|
|
48
|
-
.option(
|
|
49
|
-
'--useOptions [value]',
|
|
50
|
-
'DEPRECATED. Use options instead of arguments?',
|
|
51
|
-
)
|
|
52
|
-
.parse(process.argv)
|
|
53
|
-
.opts();
|
|
54
|
-
|
|
55
|
-
const stringToBoolean = (value) => {
|
|
56
|
-
if (value === 'true') {
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
if (value === 'false') {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
return value;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const processParams = (obj, booleanKeys) => {
|
|
66
|
-
for (const key of booleanKeys) {
|
|
67
|
-
const value = obj[key];
|
|
68
|
-
if (typeof value === 'string') {
|
|
69
|
-
const parsedValue = stringToBoolean(value);
|
|
70
|
-
delete obj[key];
|
|
71
|
-
obj[key] = parsedValue;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (obj.file) {
|
|
75
|
-
obj.configFile = obj.file;
|
|
76
|
-
}
|
|
77
|
-
return obj;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
async function start() {
|
|
81
|
-
let userConfig;
|
|
82
|
-
|
|
83
|
-
try {
|
|
84
|
-
const { createClient } = require(
|
|
85
|
-
path.resolve(__dirname, '../dist/index.cjs'),
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
userConfig = processParams(params, [
|
|
89
|
-
'dryRun',
|
|
90
|
-
'logFile',
|
|
91
|
-
'experimentalParser',
|
|
92
|
-
'exportCore',
|
|
93
|
-
'useOptions',
|
|
94
|
-
]);
|
|
95
|
-
|
|
96
|
-
if (params.plugins === true) {
|
|
97
|
-
userConfig.plugins = [];
|
|
98
|
-
} else if (params.plugins) {
|
|
99
|
-
userConfig.plugins = params.plugins;
|
|
100
|
-
} else if (userConfig.client) {
|
|
101
|
-
userConfig.plugins = ['@hey-api/typescript', '@hey-api/sdk'];
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (userConfig.client) {
|
|
105
|
-
userConfig.plugins.push(userConfig.client);
|
|
106
|
-
delete userConfig.client;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
userConfig.logs = userConfig.logs
|
|
110
|
-
? {
|
|
111
|
-
path: userConfig.logs,
|
|
112
|
-
}
|
|
113
|
-
: {};
|
|
114
|
-
|
|
115
|
-
if (userConfig.debug || stringToBoolean(process.env.DEBUG)) {
|
|
116
|
-
userConfig.logs.level = 'debug';
|
|
117
|
-
} else if (userConfig.silent) {
|
|
118
|
-
userConfig.logs.level = 'silent';
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
userConfig.logs.file = userConfig.logFile;
|
|
122
|
-
delete userConfig.logFile;
|
|
123
|
-
|
|
124
|
-
if (typeof params.watch === 'string') {
|
|
125
|
-
userConfig.watch = Number.parseInt(params.watch, 10);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (!Object.keys(userConfig.logs).length) {
|
|
129
|
-
delete userConfig.logs;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const context = await createClient(userConfig);
|
|
133
|
-
if (
|
|
134
|
-
!context[0] ||
|
|
135
|
-
!context[0].config ||
|
|
136
|
-
!context[0].config.input ||
|
|
137
|
-
!context[0].config.input.some(
|
|
138
|
-
(input) => input.watch && input.watch.enabled,
|
|
139
|
-
)
|
|
140
|
-
) {
|
|
141
|
-
process.exit(0);
|
|
142
|
-
}
|
|
143
|
-
} catch {
|
|
144
|
-
process.exit(1);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
start();
|