@qraft/cli 1.0.0-beta.4 → 1.0.0-beta.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/CHANGELOG.md +14 -0
- package/dist/bin.d.ts +4 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +96 -0
- package/dist/bin.js.map +1 -0
- package/dist/builtInPlugins.d.ts +8 -0
- package/dist/builtInPlugins.d.ts.map +1 -0
- package/dist/builtInPlugins.js +8 -0
- package/dist/builtInPlugins.js.map +1 -0
- package/dist/commands/asyncapi.d.ts +3 -0
- package/dist/commands/asyncapi.d.ts.map +1 -0
- package/dist/commands/asyncapi.js +9 -0
- package/dist/commands/asyncapi.js.map +1 -0
- package/dist/commands/openapi.d.ts +3 -0
- package/dist/commands/openapi.d.ts.map +1 -0
- package/dist/commands/openapi.js +9 -0
- package/dist/commands/openapi.js.map +1 -0
- package/dist/commands/runAsyncAPI.d.ts +3 -0
- package/dist/commands/runAsyncAPI.d.ts.map +1 -0
- package/dist/commands/runAsyncAPI.js +30 -0
- package/dist/commands/runAsyncAPI.js.map +1 -0
- package/dist/commands/runOpenAPI.d.ts +3 -0
- package/dist/commands/runOpenAPI.d.ts.map +1 -0
- package/dist/commands/runOpenAPI.js +30 -0
- package/dist/commands/runOpenAPI.js.map +1 -0
- package/dist/packageVersion.d.ts +2 -0
- package/dist/packageVersion.d.ts.map +1 -0
- package/dist/packageVersion.js +3 -0
- package/dist/packageVersion.js.map +1 -0
- package/package.json +13 -13
- package/src/packageVersion.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @qraft/cli
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5041c44: Align release pipeline with the new publishable package set.
|
|
8
|
+
- Updated dependencies [5041c44]
|
|
9
|
+
- @qraft/asyncapi-plugin@1.0.0-beta.5
|
|
10
|
+
- @qraft/asyncapi-typescript-plugin@1.0.0-beta.5
|
|
11
|
+
- @qraft/cli-utils@1.0.0-beta.5
|
|
12
|
+
- @openapi-qraft/openapi-typescript-plugin@2.15.0-beta.6
|
|
13
|
+
- @openapi-qraft/tanstack-query-react-plugin@2.15.0-beta.6
|
|
14
|
+
- @openapi-qraft/plugin@2.15.0-beta.6
|
|
15
|
+
- @qraft/plugin@1.0.0-beta.5
|
|
16
|
+
|
|
3
17
|
## 1.0.0-beta.4
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAa9C,wBAAsB,IAAI,CACxB,WAAW,EAAE,MAAM,EAAE,EACrB,uBAAuB,CAAC,EAAE,YAAY,iBAyFvC"}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { ASYNCAPI_QRAFT_REDOC_CONFIG_KEY, OPENAPI_QRAFT_REDOC_CONFIG_KEY, } from '@qraft/plugin/lib/getRedocAPIsToQraft';
|
|
3
|
+
import { createRedoclyOption, RedoclyConfigCommand, } from '@qraft/plugin/lib/RedoclyConfigCommand';
|
|
4
|
+
import c from 'ansi-colors';
|
|
5
|
+
import { Command } from 'commander';
|
|
6
|
+
import { packageVersion } from './packageVersion.js';
|
|
7
|
+
export async function main(processArgv, processArgvParseOptions) {
|
|
8
|
+
const program = new Command();
|
|
9
|
+
program
|
|
10
|
+
.name('qraft')
|
|
11
|
+
.description('Generate type-safe code from OpenAPI and AsyncAPI specifications')
|
|
12
|
+
// todo::maybe add "<bin> help <command>" handling
|
|
13
|
+
.helpCommand(false)
|
|
14
|
+
.version(packageVersion);
|
|
15
|
+
program
|
|
16
|
+
.command('openapi')
|
|
17
|
+
.description('Generate code from OpenAPI specification')
|
|
18
|
+
.allowUnknownOption()
|
|
19
|
+
.allowExcessArguments()
|
|
20
|
+
.action(async () => {
|
|
21
|
+
const subcommandArgv = extractSubcommandArgv(processArgv, 'openapi');
|
|
22
|
+
const { qraftOpenapi } = await import('./commands/openapi.js');
|
|
23
|
+
await qraftOpenapi(subcommandArgv, processArgvParseOptions);
|
|
24
|
+
})
|
|
25
|
+
.helpOption(false); // The command handles the help independently
|
|
26
|
+
program
|
|
27
|
+
.command('asyncapi')
|
|
28
|
+
.description('Generate code from AsyncAPI specification')
|
|
29
|
+
.allowUnknownOption()
|
|
30
|
+
.allowExcessArguments()
|
|
31
|
+
.action(async () => {
|
|
32
|
+
const subcommandArgv = extractSubcommandArgv(processArgv, 'asyncapi');
|
|
33
|
+
const { qraftAsyncapi } = await import('./commands/asyncapi.js');
|
|
34
|
+
await qraftAsyncapi(subcommandArgv, processArgvParseOptions);
|
|
35
|
+
})
|
|
36
|
+
.helpOption(false); // The command handles the help independently
|
|
37
|
+
program
|
|
38
|
+
.command('redocly')
|
|
39
|
+
.description('Generate from Redocly config (both OpenAPI and AsyncAPI)')
|
|
40
|
+
.argument('[apis...]', 'Selective API names from Redocly config to generate')
|
|
41
|
+
.addOption(createRedoclyOption())
|
|
42
|
+
.action(async (apis, options) => {
|
|
43
|
+
const redoclyArgv = buildRedoclyArgv(apis, options.redocly);
|
|
44
|
+
await new RedoclyConfigCommand().parseConfig({
|
|
45
|
+
[OPENAPI_QRAFT_REDOC_CONFIG_KEY]: async (argv, parseOptions) => {
|
|
46
|
+
const { runOpenAPI } = await import('./commands/runOpenAPI.js');
|
|
47
|
+
return runOpenAPI(argv, parseOptions);
|
|
48
|
+
},
|
|
49
|
+
[ASYNCAPI_QRAFT_REDOC_CONFIG_KEY]: async (argv, parseOptions) => {
|
|
50
|
+
const { runAsyncAPI } = await import('./commands/runAsyncAPI.js');
|
|
51
|
+
return runAsyncAPI(argv, parseOptions);
|
|
52
|
+
},
|
|
53
|
+
}, redoclyArgv, { from: 'user' });
|
|
54
|
+
});
|
|
55
|
+
program.addHelpText('after', `
|
|
56
|
+
${c.bold('Examples:')}
|
|
57
|
+
${c.dim('# Generate React Query hooks from OpenAPI')}
|
|
58
|
+
$ qraft openapi --plugin tanstack-query-react ./openapi.yaml -o ./src/api
|
|
59
|
+
|
|
60
|
+
${c.dim('# Generate TypeScript types from OpenAPI')}
|
|
61
|
+
$ qraft openapi --plugin openapi-typescript ./openapi.yaml -o ./src/types
|
|
62
|
+
|
|
63
|
+
${c.dim('# Generate TypeScript types from AsyncAPI')}
|
|
64
|
+
$ qraft asyncapi --plugin asyncapi-typescript ./asyncapi.yaml -o ./src/types
|
|
65
|
+
|
|
66
|
+
${c.dim('# Generate from Redocly config (both OpenAPI and AsyncAPI)')}
|
|
67
|
+
$ qraft redocly
|
|
68
|
+
|
|
69
|
+
${c.dim('# Generate specific APIs from Redocly config')}
|
|
70
|
+
$ qraft redocly openapi-main asyncapi-main
|
|
71
|
+
|
|
72
|
+
${c.dim('# Generate from custom Redocly config path')}
|
|
73
|
+
$ qraft redocly --redocly ./custom-redocly.yaml
|
|
74
|
+
`);
|
|
75
|
+
await program.parseAsync(processArgv, processArgvParseOptions);
|
|
76
|
+
}
|
|
77
|
+
function buildRedoclyArgv(apis, redoclyConfig) {
|
|
78
|
+
const argv = [...apis];
|
|
79
|
+
if (typeof redoclyConfig === 'string') {
|
|
80
|
+
argv.push('--redocly', redoclyConfig);
|
|
81
|
+
}
|
|
82
|
+
else if (redoclyConfig) {
|
|
83
|
+
argv.push('--redocly');
|
|
84
|
+
}
|
|
85
|
+
return argv;
|
|
86
|
+
}
|
|
87
|
+
function extractSubcommandArgv(processArgv, subcommand) {
|
|
88
|
+
const subcommandIndex = processArgv.indexOf(subcommand);
|
|
89
|
+
if (subcommandIndex === -1)
|
|
90
|
+
return processArgv;
|
|
91
|
+
return [
|
|
92
|
+
...processArgv.slice(0, 2),
|
|
93
|
+
...processArgv.slice(subcommandIndex + 1),
|
|
94
|
+
];
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,CAAC,MAAM,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,WAAqB,EACrB,uBAAsC;IAEtC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAE9B,OAAO;SACJ,IAAI,CAAC,OAAO,CAAC;SACb,WAAW,CACV,kEAAkE,CACnE;QACD,kDAAkD;SACjD,WAAW,CAAC,KAAK,CAAC;SAClB,OAAO,CAAC,cAAc,CAAC,CAAC;IAE3B,OAAO;SACJ,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,0CAA0C,CAAC;SACvD,kBAAkB,EAAE;SACpB,oBAAoB,EAAE;SACtB,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,cAAc,GAAG,qBAAqB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACrE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;QAC/D,MAAM,YAAY,CAAC,cAAc,EAAE,uBAAuB,CAAC,CAAC;IAC9D,CAAC,CAAC;SACD,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,6CAA6C;IAEnE,OAAO;SACJ,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,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-query-react': () => Promise<typeof import("@openapi-qraft/tanstack-query-react-plugin")>;
|
|
3
|
+
readonly 'openapi-typescript': () => Promise<typeof import("@openapi-qraft/openapi-typescript-plugin")>;
|
|
4
|
+
};
|
|
5
|
+
export declare const asyncApiBuiltInPlugins: {
|
|
6
|
+
readonly 'asyncapi-typescript': () => Promise<typeof import("@qraft/asyncapi-typescript-plugin")>;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=builtInPlugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtInPlugins.d.ts","sourceRoot":"","sources":["../src/builtInPlugins.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB;;;CAKC,CAAC;AAEpC,eAAO,MAAM,sBAAsB;;CAEA,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const openApiBuiltInPlugins = {
|
|
2
|
+
'tanstack-query-react': () => import('@openapi-qraft/tanstack-query-react-plugin'),
|
|
3
|
+
'openapi-typescript': () => import('@openapi-qraft/openapi-typescript-plugin'),
|
|
4
|
+
};
|
|
5
|
+
export const asyncApiBuiltInPlugins = {
|
|
6
|
+
'asyncapi-typescript': () => import('@qraft/asyncapi-typescript-plugin'),
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=builtInPlugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtInPlugins.js","sourceRoot":"","sources":["../src/builtInPlugins.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,sBAAsB,EAAE,GAAG,EAAE,CAC3B,MAAM,CAAC,4CAA4C,CAAC;IACtD,oBAAoB,EAAE,GAAG,EAAE,CACzB,MAAM,CAAC,0CAA0C,CAAC;CACnB,CAAC;AAEpC,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,qBAAqB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,mCAAmC,CAAC;CACvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncapi.d.ts","sourceRoot":"","sources":["../../src/commands/asyncapi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAG9C,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EAAE,EACrB,uBAAuB,CAAC,EAAE,YAAY,iBAcvC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { runAsyncAPI } from './runAsyncAPI.js';
|
|
2
|
+
export async function qraftAsyncapi(processArgv, processArgvParseOptions) {
|
|
3
|
+
const { RedoclyConfigCommand, ASYNCAPI_QRAFT_REDOC_CONFIG_KEY } = await import('@qraft/plugin/lib/RedoclyConfigCommand');
|
|
4
|
+
const redoclyConfigParseResult = await new RedoclyConfigCommand().parseConfig({ [ASYNCAPI_QRAFT_REDOC_CONFIG_KEY]: runAsyncAPI }, processArgv, processArgvParseOptions);
|
|
5
|
+
if (redoclyConfigParseResult?.length)
|
|
6
|
+
return;
|
|
7
|
+
await runAsyncAPI(processArgv, processArgvParseOptions);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=asyncapi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncapi.js","sourceRoot":"","sources":["../../src/commands/asyncapi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,WAAqB,EACrB,uBAAsC;IAEtC,MAAM,EAAE,oBAAoB,EAAE,+BAA+B,EAAE,GAC7D,MAAM,MAAM,CAAC,wCAAwC,CAAC,CAAC;IAEzD,MAAM,wBAAwB,GAAG,MAAM,IAAI,oBAAoB,EAAE,CAAC,WAAW,CAC3E,EAAE,CAAC,+BAA+B,CAAC,EAAE,WAAW,EAAE,EAClD,WAAW,EACX,uBAAuB,CACxB,CAAC;IAEF,IAAI,wBAAwB,EAAE,MAAM;QAAE,OAAO;IAE7C,MAAM,WAAW,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/commands/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAG9C,wBAAsB,YAAY,CAChC,WAAW,EAAE,MAAM,EAAE,EACrB,uBAAuB,CAAC,EAAE,YAAY,iBAcvC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { runOpenAPI } from './runOpenAPI.js';
|
|
2
|
+
export async function qraftOpenapi(processArgv, processArgvParseOptions) {
|
|
3
|
+
const { RedoclyConfigCommand, OPENAPI_QRAFT_REDOC_CONFIG_KEY } = await import('@qraft/plugin/lib/RedoclyConfigCommand');
|
|
4
|
+
const redoclyConfigParseResult = await new RedoclyConfigCommand().parseConfig({ [OPENAPI_QRAFT_REDOC_CONFIG_KEY]: runOpenAPI }, processArgv, processArgvParseOptions);
|
|
5
|
+
if (redoclyConfigParseResult?.length)
|
|
6
|
+
return;
|
|
7
|
+
await runOpenAPI(processArgv, processArgvParseOptions);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=openapi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.js","sourceRoot":"","sources":["../../src/commands/openapi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,WAAqB,EACrB,uBAAsC;IAEtC,MAAM,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,GAC5D,MAAM,MAAM,CAAC,wCAAwC,CAAC,CAAC;IAEzD,MAAM,wBAAwB,GAAG,MAAM,IAAI,oBAAoB,EAAE,CAAC,WAAW,CAC3E,EAAE,CAAC,8BAA8B,CAAC,EAAE,UAAU,EAAE,EAChD,WAAW,EACX,uBAAuB,CACxB,CAAC;IAEF,IAAI,wBAAwB,EAAE,MAAM;QAAE,OAAO;IAE7C,MAAM,UAAU,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runAsyncAPI.d.ts","sourceRoot":"","sources":["../../src/commands/runAsyncAPI.ts"],"names":[],"mappings":"AAOA,OAAO,EAAU,YAAY,EAAE,MAAM,WAAW,CAAC;AAGjD,wBAAsB,WAAW,CAC/B,WAAW,EAAE,MAAM,EAAE,EACrB,uBAAuB,CAAC,EAAE,YAAY,iBAuCvC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { addCommandUsageWithPlugins, createFileHeader, extractArgvPluginOptions, hasHelpOption, setupPlugins, } from '@qraft/cli-utils';
|
|
2
|
+
import { Option } from 'commander';
|
|
3
|
+
import { asyncApiBuiltInPlugins } from '../builtInPlugins.js';
|
|
4
|
+
export async function runAsyncAPI(processArgv, processArgvParseOptions) {
|
|
5
|
+
const { QraftCommand } = await import('@qraft/asyncapi-plugin');
|
|
6
|
+
const command = new QraftCommand('qraft asyncapi', {
|
|
7
|
+
defaultFileHeader: createFileHeader('@qraft/cli'),
|
|
8
|
+
});
|
|
9
|
+
const { argv, plugins } = extractArgvPluginOptions(processArgv);
|
|
10
|
+
if (plugins) {
|
|
11
|
+
await setupPlugins({
|
|
12
|
+
command,
|
|
13
|
+
plugins,
|
|
14
|
+
builtInPlugins: asyncApiBuiltInPlugins,
|
|
15
|
+
addUsage: addCommandUsageWithPlugins,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
command.addOption(new Option('--plugin <name_1> --plugin <name_2>', `Specifies which generator plugins should be used for code generation`)
|
|
20
|
+
.choices(Object.keys(asyncApiBuiltInPlugins))
|
|
21
|
+
.argParser(() => {
|
|
22
|
+
throw new Error('The plugin option must be processed before command parsing and should not be directly passed to the commander');
|
|
23
|
+
}));
|
|
24
|
+
if (!hasHelpOption(argv)) {
|
|
25
|
+
throw new Error(`Plugin must be explicitly specified for asyncapi command. Available plugins: ${Object.keys(asyncApiBuiltInPlugins).join(', ')}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
await command.parseAsync(argv, processArgvParseOptions);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=runAsyncAPI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runAsyncAPI.js","sourceRoot":"","sources":["../../src/commands/runAsyncAPI.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,wBAAwB,EACxB,aAAa,EACb,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAgB,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,WAAqB,EACrB,uBAAsC;IAEtC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC;IAEhE,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,gBAAgB,EAAE;QACjD,iBAAiB,EAAE,gBAAgB,CAAC,YAAY,CAAC;KAClD,CAAC,CAAC;IAEH,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,wBAAwB,CAAC,WAAW,CAAC,CAAC;IAEhE,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,YAAY,CAAC;YACjB,OAAO;YACP,OAAO;YACP,cAAc,EAAE,sBAAsB;YACtC,QAAQ,EAAE,0BAA0B;SACrC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,SAAS,CACf,IAAI,MAAM,CACR,qCAAqC,EACrC,sEAAsE,CACvE;aACE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;aAC5C,SAAS,CAAC,GAAG,EAAE;YACd,MAAM,IAAI,KAAK,CACb,+GAA+G,CAChH,CAAC;QACJ,CAAC,CAAC,CACL,CAAC;QAEF,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACb,gFAAgF,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACjI,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runOpenAPI.d.ts","sourceRoot":"","sources":["../../src/commands/runOpenAPI.ts"],"names":[],"mappings":"AAOA,OAAO,EAAU,YAAY,EAAE,MAAM,WAAW,CAAC;AAGjD,wBAAsB,UAAU,CAC9B,WAAW,EAAE,MAAM,EAAE,EACrB,uBAAuB,CAAC,EAAE,YAAY,iBAuCvC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { addCommandUsageWithPlugins, createFileHeader, extractArgvPluginOptions, hasHelpOption, setupPlugins, } from '@qraft/cli-utils';
|
|
2
|
+
import { Option } from 'commander';
|
|
3
|
+
import { openApiBuiltInPlugins } from '../builtInPlugins.js';
|
|
4
|
+
export async function runOpenAPI(processArgv, processArgvParseOptions) {
|
|
5
|
+
const { QraftCommand } = await import('@openapi-qraft/plugin');
|
|
6
|
+
const command = new QraftCommand('qraft openapi', {
|
|
7
|
+
defaultFileHeader: createFileHeader('@qraft/cli'),
|
|
8
|
+
});
|
|
9
|
+
const { argv, plugins } = extractArgvPluginOptions(processArgv);
|
|
10
|
+
if (plugins) {
|
|
11
|
+
await setupPlugins({
|
|
12
|
+
command,
|
|
13
|
+
plugins,
|
|
14
|
+
builtInPlugins: openApiBuiltInPlugins,
|
|
15
|
+
addUsage: addCommandUsageWithPlugins,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
command.addOption(new Option('--plugin <name_1> --plugin <name_2>', `Specifies which generator plugins should be used for code generation`)
|
|
20
|
+
.choices(Object.keys(openApiBuiltInPlugins))
|
|
21
|
+
.argParser(() => {
|
|
22
|
+
throw new Error('The plugin option must be processed before command parsing and should not be directly passed to the commander');
|
|
23
|
+
}));
|
|
24
|
+
if (!hasHelpOption(argv)) {
|
|
25
|
+
throw new Error(`Plugin must be explicitly specified for openapi command. Available plugins: ${Object.keys(openApiBuiltInPlugins).join(', ')}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
await command.parseAsync(argv, processArgvParseOptions);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=runOpenAPI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runOpenAPI.js","sourceRoot":"","sources":["../../src/commands/runOpenAPI.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,wBAAwB,EACxB,aAAa,EACb,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAgB,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,WAAqB,EACrB,uBAAsC;IAEtC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAE/D,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,eAAe,EAAE;QAChD,iBAAiB,EAAE,gBAAgB,CAAC,YAAY,CAAC;KAClD,CAAC,CAAC;IAEH,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,wBAAwB,CAAC,WAAW,CAAC,CAAC;IAEhE,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,YAAY,CAAC;YACjB,OAAO;YACP,OAAO;YACP,cAAc,EAAE,qBAAqB;YACrC,QAAQ,EAAE,0BAA0B;SACrC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,SAAS,CACf,IAAI,MAAM,CACR,qCAAqC,EACrC,sEAAsE,CACvE;aACE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;aAC3C,SAAS,CAAC,GAAG,EAAE;YACd,MAAM,IAAI,KAAK,CACb,+GAA+G,CAChH,CAAC;QACJ,CAAC,CAAC,CACL,CAAC;QAEF,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACb,+EAA+E,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC/H,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qraft/cli",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.5",
|
|
4
4
|
"description": "CLI tool for generating type-safe code from OpenAPI and AsyncAPI specifications",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc --project tsconfig.build.json",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"qraft": "./bin.mjs"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@openapi-qraft/openapi-typescript-plugin": "2.15.0-beta.
|
|
20
|
-
"@openapi-qraft/plugin": "2.15.0-beta.
|
|
21
|
-
"@openapi-qraft/tanstack-query-react-plugin": "2.15.0-beta.
|
|
22
|
-
"@qraft/asyncapi-plugin": "1.0.0-beta.
|
|
23
|
-
"@qraft/asyncapi-typescript-plugin": "1.0.0-beta.
|
|
19
|
+
"@openapi-qraft/openapi-typescript-plugin": "2.15.0-beta.6",
|
|
20
|
+
"@openapi-qraft/plugin": "2.15.0-beta.6",
|
|
21
|
+
"@openapi-qraft/tanstack-query-react-plugin": "2.15.0-beta.6",
|
|
22
|
+
"@qraft/asyncapi-plugin": "1.0.0-beta.5",
|
|
23
|
+
"@qraft/asyncapi-typescript-plugin": "1.0.0-beta.5"
|
|
24
24
|
},
|
|
25
25
|
"peerDependenciesMeta": {
|
|
26
26
|
"@openapi-qraft/openapi-typescript-plugin": {
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@qraft/cli-utils": "1.0.0-beta.
|
|
44
|
-
"@qraft/plugin": "1.0.0-beta.
|
|
43
|
+
"@qraft/cli-utils": "1.0.0-beta.5",
|
|
44
|
+
"@qraft/plugin": "1.0.0-beta.5",
|
|
45
45
|
"ansi-colors": "^4.1.3",
|
|
46
46
|
"commander": "^14.0.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@openapi-qraft/eslint-config": "1.0.1",
|
|
50
|
-
"@openapi-qraft/openapi-typescript-plugin": "2.15.0-beta.
|
|
51
|
-
"@openapi-qraft/plugin": "2.15.0-beta.
|
|
52
|
-
"@openapi-qraft/tanstack-query-react-plugin": "2.15.0-beta.
|
|
53
|
-
"@qraft/asyncapi-plugin": "1.0.0-beta.
|
|
54
|
-
"@qraft/asyncapi-typescript-plugin": "1.0.0-beta.
|
|
50
|
+
"@openapi-qraft/openapi-typescript-plugin": "2.15.0-beta.6",
|
|
51
|
+
"@openapi-qraft/plugin": "2.15.0-beta.6",
|
|
52
|
+
"@openapi-qraft/tanstack-query-react-plugin": "2.15.0-beta.6",
|
|
53
|
+
"@qraft/asyncapi-plugin": "1.0.0-beta.5",
|
|
54
|
+
"@qraft/asyncapi-typescript-plugin": "1.0.0-beta.5",
|
|
55
55
|
"@types/node": "^20.16.5",
|
|
56
56
|
"eslint": "^9.39.1",
|
|
57
57
|
"rimraf": "^6.1.2",
|