gen-api-types 1.0.10 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/argv/index.ts +12 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gen-api-types",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "一个自动生成请求接口返回类型的 cli 小工具",
5
5
  "main": "./src/index.ts",
6
6
  "exports": {
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',