gen-api-types 1.0.9 → 1.0.11
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/index.js +6 -2
- package/package.json +1 -1
- package/src/argv/index.ts +12 -1
package/bin/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { spawn } from 'node:child_process';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
5
7
|
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
10
|
const args = process.argv.slice(2);
|
|
7
11
|
const cliPath = path.resolve(__dirname, '../src/cli/index.ts');
|
|
8
12
|
const tsxCliPath = require.resolve('tsx/cli');
|
package/package.json
CHANGED
package/src/argv/index.ts
CHANGED
|
@@ -8,11 +8,22 @@ const OUTPUT_FILE = 'index.d.ts';
|
|
|
8
8
|
const OUTPUT_DIR = PROJECT_ROOT
|
|
9
9
|
const TS_CONFIG_PATH = path.join(PROJECT_ROOT, 'tsconfig.json');
|
|
10
10
|
|
|
11
|
+
function normalizeArgv(args: string[]) {
|
|
12
|
+
return args.map(arg => {
|
|
13
|
+
const matched = arg.match(/^([\u2013\u2014]+)(.+)$/u)
|
|
14
|
+
if (!matched) return arg
|
|
15
|
+
|
|
16
|
+
const [, dashes, optionName] = matched
|
|
17
|
+
if (dashes.length > 1 || optionName.length > 1) return `--${optionName}`
|
|
18
|
+
return `-${optionName}`
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
|
|
11
22
|
|
|
12
23
|
|
|
13
24
|
const _arg = parseArgs({
|
|
14
25
|
allowPositionals: true,
|
|
15
|
-
args: process.argv.slice(2),
|
|
26
|
+
args: normalizeArgv(process.argv.slice(2)),
|
|
16
27
|
options: {
|
|
17
28
|
output_dir: {
|
|
18
29
|
type: 'string',
|