@rsdk/cli.cmd.autodoc 6.0.0-next.1 → 6.0.0-next.3
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.
|
@@ -3,5 +3,6 @@ export declare class OpenApiCommand implements IRunnable {
|
|
|
3
3
|
private readonly logger;
|
|
4
4
|
private readonly loader;
|
|
5
5
|
constructor();
|
|
6
|
-
run(verbose: boolean, ifPresent: boolean, outPath
|
|
6
|
+
run(verbose: boolean, ifPresent: boolean, outPath?: string, appPath?: string, configPath?: string, includeZones?: string[], excludeZones?: string[], title?: string, version?: string, description?: string): Promise<void>;
|
|
7
|
+
private readConfig;
|
|
7
8
|
}
|
|
@@ -28,30 +28,51 @@ let OpenApiCommand = OpenApiCommand_1 = class OpenApiCommand {
|
|
|
28
28
|
this.logger = logging_1.LoggerFactory.create(OpenApiCommand_1);
|
|
29
29
|
this.loader = new app_loader_1.AppLoader(this.logger);
|
|
30
30
|
}
|
|
31
|
-
async run(verbose, ifPresent, outPath, appPath, includeZones, excludeZones, title, version, description) {
|
|
31
|
+
async run(verbose, ifPresent, outPath, appPath, configPath, includeZones, excludeZones, title, version, description) {
|
|
32
32
|
if (verbose) {
|
|
33
33
|
this.logger.info(`app path: ${appPath}`);
|
|
34
34
|
this.logger.info(`output file: ${outPath}`);
|
|
35
35
|
this.logger.info(`--if-present: ${ifPresent}`);
|
|
36
36
|
}
|
|
37
|
-
const
|
|
37
|
+
const config = await this.readConfig(configPath);
|
|
38
|
+
// Command line options take precedence over config file
|
|
39
|
+
const effectiveOutPath = outPath ?? config.out ?? 'openapi.json';
|
|
40
|
+
const effectiveAppPath = appPath ?? config.app ?? './dist/app.js';
|
|
41
|
+
if (verbose) {
|
|
42
|
+
this.logger.info(`effective out path: ${effectiveOutPath}`);
|
|
43
|
+
this.logger.info(`effective app path: ${effectiveAppPath}`);
|
|
44
|
+
}
|
|
45
|
+
const app = await this.loader.loadApp(effectiveAppPath, !ifPresent);
|
|
38
46
|
if (!app) {
|
|
39
47
|
return;
|
|
40
48
|
}
|
|
41
|
-
const [absolutePath] = common_node_1.Path.absolutize(
|
|
49
|
+
const [absolutePath] = common_node_1.Path.absolutize(effectiveOutPath);
|
|
42
50
|
const [dirname, filename] = common_node_1.Path.split(absolutePath);
|
|
43
51
|
const options = {
|
|
52
|
+
...config,
|
|
44
53
|
...(includeZones && { includeZones }),
|
|
45
54
|
...(excludeZones && { excludeZones }),
|
|
55
|
+
...(title && { title }),
|
|
46
56
|
...(description && { description }),
|
|
47
57
|
...(version && { version }),
|
|
48
|
-
...(title && { title }),
|
|
49
58
|
};
|
|
59
|
+
if (verbose) {
|
|
60
|
+
this.logger.info('override options', options);
|
|
61
|
+
}
|
|
50
62
|
const generator = new openapi_json_generator_1.OpenapiGenerator(app, options);
|
|
51
63
|
const writer = new document_file_1.DocumentWriter(this.logger, dirname);
|
|
52
64
|
const document = await generator.createFile(filename);
|
|
53
65
|
await writer.write(document);
|
|
54
66
|
}
|
|
67
|
+
async readConfig(configPath) {
|
|
68
|
+
if (!configPath) {
|
|
69
|
+
return {};
|
|
70
|
+
}
|
|
71
|
+
this.logger.info(`reading config file: ${configPath}`);
|
|
72
|
+
const [absolutePath] = common_node_1.Path.absolutize(configPath);
|
|
73
|
+
const config = await (0, common_node_1.readObj)(absolutePath);
|
|
74
|
+
return config;
|
|
75
|
+
}
|
|
55
76
|
};
|
|
56
77
|
exports.OpenApiCommand = OpenApiCommand;
|
|
57
78
|
__decorate([
|
|
@@ -62,51 +83,47 @@ __decorate([
|
|
|
62
83
|
})),
|
|
63
84
|
__param(2, (0, cli_common_1.ValueOption)('out', new common_node_1.FsPathParser('file', { check: 'dirname' }), {
|
|
64
85
|
description: 'output file',
|
|
65
|
-
defaultValue: 'openapi.json',
|
|
66
86
|
alias: 'o',
|
|
67
87
|
})),
|
|
68
88
|
__param(3, (0, cli_common_1.ValueOption)('app', new common_node_1.FsPathParser('file'), {
|
|
69
89
|
description: 'path to app.js file',
|
|
70
|
-
defaultValue: './dist/app.js',
|
|
71
90
|
alias: 'a',
|
|
72
91
|
})),
|
|
73
|
-
__param(4, (0, cli_common_1.ValueOption)('
|
|
92
|
+
__param(4, (0, cli_common_1.ValueOption)('conf', new common_node_1.FsPathParser('file'), {
|
|
93
|
+
description: (0, common_1.text) `
|
|
94
|
+
Path to configuration file (YAML or JSON) containing any of the command options.
|
|
95
|
+
Command line options take precedence over config file values.
|
|
96
|
+
`,
|
|
97
|
+
})),
|
|
98
|
+
__param(5, (0, cli_common_1.ValueOption)('include-zones', new common_1.ArrayParser(new common_1.StringParser()), {
|
|
74
99
|
description: (0, common_1.text) `
|
|
75
100
|
API zones to include. Only controllers with these zones will be included in the output.
|
|
76
101
|
Zones are specified as a comma-separated list.
|
|
77
102
|
`,
|
|
78
|
-
defaultValue: undefined,
|
|
79
103
|
})),
|
|
80
|
-
__param(
|
|
104
|
+
__param(6, (0, cli_common_1.ValueOption)('exclude-zones', new common_1.ArrayParser(new common_1.StringParser()), {
|
|
81
105
|
description: (0, common_1.text) `
|
|
82
106
|
API zones to exclude. Only controllers without these zones will be included in the output.
|
|
83
107
|
Zones are specified as a comma-separated list.
|
|
84
108
|
`,
|
|
85
|
-
defaultValue: undefined,
|
|
86
109
|
})),
|
|
87
|
-
__param(
|
|
110
|
+
__param(7, (0, cli_common_1.ValueOption)('title', new common_1.StringParser(), {
|
|
88
111
|
description: (0, common_1.text) `
|
|
89
|
-
The title of OpenAPI document.
|
|
90
|
-
the app metadata which is used by default.
|
|
112
|
+
The title of OpenAPI document. Takes precedence over config file and app metadata.
|
|
91
113
|
`,
|
|
92
|
-
defaultValue: undefined,
|
|
93
114
|
})),
|
|
94
|
-
__param(
|
|
115
|
+
__param(8, (0, cli_common_1.ValueOption)('version', new common_1.StringParser(), {
|
|
95
116
|
description: (0, common_1.text) `
|
|
96
|
-
The version of OpenAPI document.
|
|
97
|
-
the app metadata which is used by default.
|
|
117
|
+
The version of OpenAPI document. Takes precedence over config file and app metadata.
|
|
98
118
|
`,
|
|
99
|
-
defaultValue: undefined,
|
|
100
119
|
})),
|
|
101
|
-
__param(
|
|
120
|
+
__param(9, (0, cli_common_1.ValueOption)('description', new common_1.StringParser(), {
|
|
102
121
|
description: (0, common_1.text) `
|
|
103
|
-
The description of OpenAPI document.
|
|
104
|
-
the app metadata which is used by default.
|
|
122
|
+
The description of OpenAPI document. Takes precedence over config file and app metadata.
|
|
105
123
|
`,
|
|
106
|
-
defaultValue: undefined,
|
|
107
124
|
})),
|
|
108
125
|
__metadata("design:type", Function),
|
|
109
|
-
__metadata("design:paramtypes", [Boolean, Boolean, String, String, Array, Array, String, String, String]),
|
|
126
|
+
__metadata("design:paramtypes", [Boolean, Boolean, String, String, String, Array, Array, String, String, String]),
|
|
110
127
|
__metadata("design:returntype", Promise)
|
|
111
128
|
], OpenApiCommand.prototype, "run", null);
|
|
112
129
|
exports.OpenApiCommand = OpenApiCommand = OpenApiCommand_1 = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.variation.js","sourceRoot":"","sources":["../../src/commands/openapi.variation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAK0B;AAC1B,yCAA+D;AAC/D,
|
|
1
|
+
{"version":3,"file":"openapi.variation.js","sourceRoot":"","sources":["../../src/commands/openapi.variation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAK0B;AAC1B,yCAA+D;AAC/D,mDAAgE;AAChE,2CAAuD;AAEvD,mDAA+C;AAC/C,yDAAuD;AACvD,8FAG2D;AAUpD,IAAM,cAAc,sBAApB,MAAM,cAAc;IACR,MAAM,CAAU;IAChB,MAAM,CAAY;IAEnC;QACE,IAAI,CAAC,MAAM,GAAG,uBAAa,CAAC,MAAM,CAAC,gBAAc,CAAC,CAAC;QACnD,IAAI,CAAC,MAAM,GAAG,IAAI,sBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAEK,AAAN,KAAK,CA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IAAA,aAAI,EAAA;;OAEhB;KACF,CAAC,CAAA;;;;yCA+CH;yBAxHU,cAAc;IAH1B,IAAA,6BAAgB,EAAC,iBAAiB,EAAE;QACnC,WAAW,EAAE,mBAAmB;KACjC,CAAC;;GACW,cAAc,CAwI1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdk/cli.cmd.autodoc",
|
|
3
|
-
"version": "6.0.0-next.
|
|
3
|
+
"version": "6.0.0-next.3",
|
|
4
4
|
"description": "autodoc your app!",
|
|
5
5
|
"homepage": "https://github.com/R-Vision/rsdk",
|
|
6
6
|
"license": "Apache License 2.0",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"@rsdk/zones": "*",
|
|
39
39
|
"reflect-metadata": "^0.1.12 || ^0.2.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "e9a3e6741c196ecd2d6d1db6a6d9b6611b7d39c4"
|
|
42
42
|
}
|