@openapi-qraft/cli 2.12.0 → 2.13.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/CHANGELOG.md +18 -4
- package/README.md +2 -2
- package/dist/bin.d.ts.map +1 -1
- package/dist/bin.js +4 -2
- package/dist/bin.js.map +1 -1
- package/dist/handleDeprecatedOptions.d.ts +2 -0
- package/dist/handleDeprecatedOptions.d.ts.map +1 -0
- package/dist/handleDeprecatedOptions.js +15 -0
- package/dist/handleDeprecatedOptions.js.map +1 -0
- package/package.json +9 -8
- package/src/bin.ts +5 -2
- package/src/handleDeprecatedOptions.ts +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @openapi-qraft/cli
|
|
2
2
|
|
|
3
|
+
## 2.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 79ec773: Deprecate `-rm` CLI option in favor of `-c` for `--clean` flag.
|
|
8
|
+
|
|
9
|
+
The `-rm` short flag for the `--clean` option has been deprecated due to commander.js v14 requiring single-character
|
|
10
|
+
short flags. The option will continue to work but will show a deprecation warning. Please migrate to using `-c` or
|
|
11
|
+
`--clean` instead. The `-rm` flag will be removed in v3.0.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [58cf835]
|
|
16
|
+
- Updated dependencies [eafe0b0]
|
|
17
|
+
- @openapi-qraft/tanstack-query-react-plugin@2.13.0
|
|
18
|
+
- @openapi-qraft/openapi-typescript-plugin@2.13.0
|
|
19
|
+
- @openapi-qraft/plugin@2.13.0
|
|
20
|
+
|
|
3
21
|
## 2.12.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -364,13 +382,11 @@
|
|
|
364
382
|
include all path parts and parameters, and the structure can be customized based on the `--service-name-base` value.
|
|
365
383
|
|
|
366
384
|
**Breaking Changes:**
|
|
367
|
-
|
|
368
385
|
- Operation names now include all path parts and parameters by default.
|
|
369
386
|
- `/api/v{api-version}` is no longer automatically removed from the path when generating operation names.
|
|
370
387
|
- The `--service-name-base` option now influences the generated operation names with a new structure.
|
|
371
388
|
|
|
372
389
|
**Examples:**
|
|
373
|
-
|
|
374
390
|
- With `--service-name-base=endpoint[0]`:
|
|
375
391
|
`POST /v1/users/{id}` → `api.v1.postUsersId`
|
|
376
392
|
- With `--service-name-base=endpoint[1]`:
|
|
@@ -522,13 +538,11 @@
|
|
|
522
538
|
include all path parts and parameters, and the structure can be customized based on the `--service-name-base` value.
|
|
523
539
|
|
|
524
540
|
**Breaking Changes:**
|
|
525
|
-
|
|
526
541
|
- Operation names now include all path parts and parameters by default.
|
|
527
542
|
- `/api/v{api-version}` is no longer automatically removed from the path when generating operation names.
|
|
528
543
|
- The `--service-name-base` option now influences the generated operation names with a new structure.
|
|
529
544
|
|
|
530
545
|
**Examples:**
|
|
531
|
-
|
|
532
546
|
- With `--service-name-base=endpoint[0]`:
|
|
533
547
|
`POST /v1/users/{id}` → `api.v1.postUsersId`
|
|
534
548
|
- With `--service-name-base=endpoint[1]`:
|
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ Arguments:
|
|
|
28
28
|
|
|
29
29
|
Options:
|
|
30
30
|
-o, --output-dir <path> Output directory for generated services
|
|
31
|
-
-
|
|
31
|
+
-c, --clean Clean output directory before generating services
|
|
32
32
|
--filter-services <glob-patterns...> Filter services to be generated using glob patterns. Example: "/user/**,/post/**". For more details, see the NPM `micromatch` package documentation.
|
|
33
33
|
--operation-predefined-parameters <patterns...> Predefined parameters for services. The specified service parameters will be optional. Example: "/**:header.x-monite-version,query.x-api-key" or
|
|
34
34
|
"get /**:header.x-monite-entity-id"
|
|
@@ -93,7 +93,7 @@ npx openapi-qraft --plugin tanstack-query-react --plugin openapi-typescript http
|
|
|
93
93
|
|
|
94
94
|
### Edge-case Options
|
|
95
95
|
|
|
96
|
-
- **`-
|
|
96
|
+
- **`-c, --clean`:** Clean the specified output directory services before generating to remove stale files _(optional)_.
|
|
97
97
|
- **`--filter-services <glob-patterns...>`:** Filter services to be generated by glob pattern _(optional)_.
|
|
98
98
|
- **Pattern syntax:**
|
|
99
99
|
- `<glob-pattern>,<glob-pattern>,...` - comma-separated list of glob patterns. See [`micromatch`](https://github.com/micromatch/micromatch)
|
package/dist/bin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAIA,OAAO,EAAU,YAAY,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAIA,OAAO,EAAU,YAAY,EAAE,MAAM,WAAW,CAAC;AAIjD,wBAAsB,IAAI,CACxB,WAAW,EAAE,MAAM,EAAE,EACrB,uBAAuB,CAAC,EAAE,YAAY,iBAavC;AAkED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE;;;;;;EA6BtD"}
|
package/dist/bin.js
CHANGED
|
@@ -3,11 +3,13 @@ import { QraftCommand } from '@openapi-qraft/plugin';
|
|
|
3
3
|
import { RedoclyConfigCommand } from '@openapi-qraft/plugin/lib/RedoclyConfigCommand';
|
|
4
4
|
import { Option } from 'commander';
|
|
5
5
|
import { builtInPlugins } from './builtInPlugins.js';
|
|
6
|
+
import { handleDeprecatedOptions } from './handleDeprecatedOptions.js';
|
|
6
7
|
export async function main(processArgv, processArgvParseOptions) {
|
|
7
|
-
const
|
|
8
|
+
const argv = handleDeprecatedOptions(processArgv);
|
|
9
|
+
const redoclyConfigParseResult = await new RedoclyConfigCommand().parseConfig(qraft, argv, processArgvParseOptions);
|
|
8
10
|
if (redoclyConfigParseResult?.length)
|
|
9
11
|
return;
|
|
10
|
-
await qraft(
|
|
12
|
+
await qraft(argv, processArgvParseOptions);
|
|
11
13
|
}
|
|
12
14
|
async function qraft(processArgv, processArgvParseOptions) {
|
|
13
15
|
const command = new QraftCommand();
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAAE,MAAM,EAAgB,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAAE,MAAM,EAAgB,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,WAAqB,EACrB,uBAAsC;IAEtC,MAAM,IAAI,GAAG,uBAAuB,CAAC,WAAW,CAAC,CAAC;IAElD,MAAM,wBAAwB,GAAG,MAAM,IAAI,oBAAoB,EAAE,CAAC,WAAW,CAC3E,KAAK,EACL,IAAI,EACJ,uBAAuB,CACxB,CAAC;IAEF,IAAI,wBAAwB,EAAE,MAAM;QAAE,OAAO;IAE7C,MAAM,KAAK,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;AAC7C,CAAC;AAED,KAAK,UAAU,KAAK,CAClB,WAAqB,EACrB,uBAAsC;IAEtC,MAAM,OAAO,GAAG,IAAI,YAAY,EAAE,CAAC;IAEnC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,wBAAwB,CAAC,WAAW,CAAC,CAAC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,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleDeprecatedOptions.d.ts","sourceRoot":"","sources":["../src/handleDeprecatedOptions.ts"],"names":[],"mappings":"AAMA,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAahE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import c from 'ansi-colors';
|
|
2
|
+
const deprecatedOptionsMap = {
|
|
3
|
+
'-rm': { replacement: '-c' },
|
|
4
|
+
};
|
|
5
|
+
export function handleDeprecatedOptions(argv) {
|
|
6
|
+
return argv.map((arg) => {
|
|
7
|
+
const deprecated = deprecatedOptionsMap[arg];
|
|
8
|
+
if (deprecated) {
|
|
9
|
+
console.warn(c.yellow(`⚠ Option '${arg}' is deprecated and will be removed in v3.0. Please use '${deprecated.replacement}' instead.`));
|
|
10
|
+
return deprecated.replacement;
|
|
11
|
+
}
|
|
12
|
+
return arg;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=handleDeprecatedOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleDeprecatedOptions.js","sourceRoot":"","sources":["../src/handleDeprecatedOptions.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,aAAa,CAAC;AAE5B,MAAM,oBAAoB,GAA4C;IACpE,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;CAC7B,CAAC;AAEF,MAAM,UAAU,uBAAuB,CAAC,IAAc;IACpD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACtB,MAAM,UAAU,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;QAC7C,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CACV,CAAC,CAAC,MAAM,CACN,aAAa,GAAG,4DAA4D,UAAU,CAAC,WAAW,YAAY,CAC/G,CACF,CAAC;YACF,OAAO,UAAU,CAAC,WAAW,CAAC;QAChC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openapi-qraft/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"description": "CLI for generating typed TanStack Query React Hooks and services from OpenAPI Document, improving type safety in React apps",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc --project tsconfig.build.json",
|
|
@@ -15,18 +15,19 @@
|
|
|
15
15
|
"openapi-qraft": "./bin.mjs"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@openapi-qraft/openapi-typescript-plugin": "2.
|
|
19
|
-
"@openapi-qraft/plugin": "2.
|
|
20
|
-
"@openapi-qraft/tanstack-query-react-plugin": "2.
|
|
21
|
-
"
|
|
18
|
+
"@openapi-qraft/openapi-typescript-plugin": "2.13.0",
|
|
19
|
+
"@openapi-qraft/plugin": "2.13.0",
|
|
20
|
+
"@openapi-qraft/tanstack-query-react-plugin": "2.13.0",
|
|
21
|
+
"ansi-colors": "^4.1.3",
|
|
22
|
+
"commander": "^14.0.2"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@openapi-qraft/eslint-config": "1.0.1",
|
|
25
26
|
"@types/node": "^20.16.5",
|
|
26
|
-
"eslint": "^9.
|
|
27
|
-
"rimraf": "^
|
|
27
|
+
"eslint": "^9.39.1",
|
|
28
|
+
"rimraf": "^6.1.2",
|
|
28
29
|
"typescript": "^5.6.2",
|
|
29
|
-
"vitest": "^3.
|
|
30
|
+
"vitest": "^3.2.4"
|
|
30
31
|
},
|
|
31
32
|
"files": [
|
|
32
33
|
"dist",
|
package/src/bin.ts
CHANGED
|
@@ -4,20 +4,23 @@ import { QraftCommand } from '@openapi-qraft/plugin';
|
|
|
4
4
|
import { RedoclyConfigCommand } from '@openapi-qraft/plugin/lib/RedoclyConfigCommand';
|
|
5
5
|
import { Option, ParseOptions } from 'commander';
|
|
6
6
|
import { builtInPlugins } from './builtInPlugins.js';
|
|
7
|
+
import { handleDeprecatedOptions } from './handleDeprecatedOptions.js';
|
|
7
8
|
|
|
8
9
|
export async function main(
|
|
9
10
|
processArgv: string[],
|
|
10
11
|
processArgvParseOptions?: ParseOptions
|
|
11
12
|
) {
|
|
13
|
+
const argv = handleDeprecatedOptions(processArgv);
|
|
14
|
+
|
|
12
15
|
const redoclyConfigParseResult = await new RedoclyConfigCommand().parseConfig(
|
|
13
16
|
qraft,
|
|
14
|
-
|
|
17
|
+
argv,
|
|
15
18
|
processArgvParseOptions
|
|
16
19
|
);
|
|
17
20
|
|
|
18
21
|
if (redoclyConfigParseResult?.length) return;
|
|
19
22
|
|
|
20
|
-
await qraft(
|
|
23
|
+
await qraft(argv, processArgvParseOptions);
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
async function qraft(
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import c from 'ansi-colors';
|
|
2
|
+
|
|
3
|
+
const deprecatedOptionsMap: Record<string, { replacement: string }> = {
|
|
4
|
+
'-rm': { replacement: '-c' },
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export function handleDeprecatedOptions(argv: string[]): string[] {
|
|
8
|
+
return argv.map((arg) => {
|
|
9
|
+
const deprecated = deprecatedOptionsMap[arg];
|
|
10
|
+
if (deprecated) {
|
|
11
|
+
console.warn(
|
|
12
|
+
c.yellow(
|
|
13
|
+
`⚠ Option '${arg}' is deprecated and will be removed in v3.0. Please use '${deprecated.replacement}' instead.`
|
|
14
|
+
)
|
|
15
|
+
);
|
|
16
|
+
return deprecated.replacement;
|
|
17
|
+
}
|
|
18
|
+
return arg;
|
|
19
|
+
});
|
|
20
|
+
}
|