@tsoa-next/cli 7.3.4 → 8.0.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/dist/api.d.ts +38 -0
- package/dist/api.js +393 -0
- package/dist/api.js.map +1 -0
- package/dist/cli.d.ts +2 -46
- package/dist/cli.js +4 -469
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/module/generate-routes.d.ts +1 -1
- package/dist/module/generate-spec.d.ts +1 -1
- package/dist/routeGeneration/defaultRouteGenerator.d.ts +1 -1
- package/dist/routeGeneration/routeGenerator.d.ts +1 -1
- package/dist/runCLI.d.ts +5 -0
- package/dist/runCLI.js +144 -0
- package/dist/runCLI.js.map +1 -0
- package/dist/swagger/specGenerator.d.ts +1 -1
- package/dist/swagger/specGenerator2.d.ts +1 -1
- package/dist/swagger/specGenerator3.d.ts +1 -1
- package/dist/swagger/specGenerator31.d.ts +1 -1
- package/package.json +2 -2
package/dist/runCLI.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.runCLI = runCLI;
|
|
37
|
+
const api_1 = require("./api");
|
|
38
|
+
const configurationArgs = {
|
|
39
|
+
alias: 'c',
|
|
40
|
+
describe: 'tsoa configuration file; default is tsoa.json in the working directory',
|
|
41
|
+
required: false,
|
|
42
|
+
string: true,
|
|
43
|
+
};
|
|
44
|
+
const hostArgs = {
|
|
45
|
+
describe: 'API host',
|
|
46
|
+
required: false,
|
|
47
|
+
string: true,
|
|
48
|
+
};
|
|
49
|
+
const basePathArgs = {
|
|
50
|
+
describe: 'Base API path',
|
|
51
|
+
required: false,
|
|
52
|
+
string: true,
|
|
53
|
+
};
|
|
54
|
+
const yamlArgs = {
|
|
55
|
+
describe: 'Swagger spec yaml format',
|
|
56
|
+
required: false,
|
|
57
|
+
boolean: true,
|
|
58
|
+
};
|
|
59
|
+
const jsonArgs = {
|
|
60
|
+
describe: 'Swagger spec json format',
|
|
61
|
+
required: false,
|
|
62
|
+
boolean: true,
|
|
63
|
+
};
|
|
64
|
+
const configCommandArgs = {
|
|
65
|
+
basePath: basePathArgs,
|
|
66
|
+
configuration: configurationArgs,
|
|
67
|
+
};
|
|
68
|
+
const specCommandArgs = {
|
|
69
|
+
...configCommandArgs,
|
|
70
|
+
host: hostArgs,
|
|
71
|
+
json: jsonArgs,
|
|
72
|
+
yaml: yamlArgs,
|
|
73
|
+
};
|
|
74
|
+
const isYargsFactory = (value) => typeof value === 'function';
|
|
75
|
+
const getYargsFactory = (moduleExports) => {
|
|
76
|
+
if (isYargsFactory(moduleExports)) {
|
|
77
|
+
return moduleExports;
|
|
78
|
+
}
|
|
79
|
+
if (typeof moduleExports === 'object' && moduleExports !== null && 'default' in moduleExports) {
|
|
80
|
+
const defaultExport = moduleExports.default;
|
|
81
|
+
if (isYargsFactory(defaultExport)) {
|
|
82
|
+
return defaultExport;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
throw new TypeError('Unable to load yargs');
|
|
86
|
+
};
|
|
87
|
+
const isHideBin = (value) => typeof value === 'function';
|
|
88
|
+
const getHideBin = (moduleExports) => {
|
|
89
|
+
if (typeof moduleExports === 'object' && moduleExports !== null && 'hideBin' in moduleExports) {
|
|
90
|
+
const hideBin = moduleExports.hideBin;
|
|
91
|
+
if (isHideBin(hideBin)) {
|
|
92
|
+
return hideBin;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
throw new TypeError('Unable to load yargs/helpers');
|
|
96
|
+
};
|
|
97
|
+
async function runCLI() {
|
|
98
|
+
const [yargsModule, yargsHelpers] = await Promise.all([Promise.resolve().then(() => __importStar(require('yargs'))), Promise.resolve().then(() => __importStar(require('yargs/helpers')))]);
|
|
99
|
+
const yargsFactory = getYargsFactory(yargsModule);
|
|
100
|
+
const hideBin = getHideBin(yargsHelpers);
|
|
101
|
+
const cli = yargsFactory(hideBin(process.argv));
|
|
102
|
+
return cli
|
|
103
|
+
.scriptName('tsoa')
|
|
104
|
+
.usage('Usage: $0 <command> [options]')
|
|
105
|
+
.command('spec', 'Generate OpenAPI spec', specCommandArgs, async (args) => {
|
|
106
|
+
await (0, api_1.generateSpecFromArgs)({
|
|
107
|
+
basePath: args.basePath,
|
|
108
|
+
configuration: args.configuration,
|
|
109
|
+
host: args.host,
|
|
110
|
+
json: args.json,
|
|
111
|
+
yaml: args.yaml,
|
|
112
|
+
});
|
|
113
|
+
})
|
|
114
|
+
.command('routes', 'Generate routes', configCommandArgs, async (args) => {
|
|
115
|
+
await (0, api_1.generateRoutesFromArgs)({
|
|
116
|
+
basePath: args.basePath,
|
|
117
|
+
configuration: args.configuration,
|
|
118
|
+
});
|
|
119
|
+
})
|
|
120
|
+
.command('spec-and-routes', 'Generate OpenAPI spec and routes', specCommandArgs, async (args) => {
|
|
121
|
+
await (0, api_1.generateSpecAndRoutes)({
|
|
122
|
+
basePath: args.basePath,
|
|
123
|
+
configuration: args.configuration,
|
|
124
|
+
host: args.host,
|
|
125
|
+
json: args.json,
|
|
126
|
+
yaml: args.yaml,
|
|
127
|
+
});
|
|
128
|
+
})
|
|
129
|
+
.demandCommand(1, 1, 'Must provide a valid command.')
|
|
130
|
+
.help('help')
|
|
131
|
+
.alias('help', 'h')
|
|
132
|
+
.exitProcess(false)
|
|
133
|
+
.fail((message, error) => {
|
|
134
|
+
if (!error && message) {
|
|
135
|
+
cli.showHelp('error');
|
|
136
|
+
}
|
|
137
|
+
if (error instanceof Error) {
|
|
138
|
+
throw error;
|
|
139
|
+
}
|
|
140
|
+
throw new Error(message);
|
|
141
|
+
})
|
|
142
|
+
.parseAsync();
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=runCLI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runCLI.js","sourceRoot":"","sources":["../src/runCLI.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFA,wBAiDC;AAvID,+BAA2F;AAM3F,MAAM,iBAAiB,GAAG;IACxB,KAAK,EAAE,GAAG;IACV,QAAQ,EAAE,wEAAwE;IAClF,QAAQ,E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Q,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,KAAK,EAAE,IAA4B,EAAE,EAAE;QAC9F,MAAM,IAAA,4BAAsB,EAAC;YAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,aAAa,EAAE,IAAI,CAAC,aAAa;SAClC,CAAC,CAAA;IACJ,CAAC,CAAC;SACD,OAAO,CAAC,iBAAiB,EAAE,kCAAkC,EAAE,eAAe,EAAE,KAAK,EAAE,IAA0B,EAAE,EAAE;QACpH,MAAM,IAAA,2BAAqB,EAAC;YAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC,CAAA;IACJ,CAAC,CAAC;SACD,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,+BAA+B,CAAC;SACpD,IAAI,CAAC,MAAM,CAAC;SACZ,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC;SAClB,WAAW,CAAC,KAAK,CAAC;SAClB,IAAI,CAAC,CAAC,OAAe,EAAE,KAAwB,EAAE,EAAE;QAClD,IAAI,CAAC,KAAK,IAAI,OAAO,EAAE,CAAC;YACtB,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QACvB,CAAC;QAED,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,MAAM,KAAK,CAAA;QACb,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;IAC1B,CAAC,CAAC;SACD,UAAU,EAAE,CAAA;AACjB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Tsoa, Swagger } from '@tsoa-next/runtime';
|
|
2
2
|
import { SpecGenerator } from './specGenerator';
|
|
3
|
-
import { ExtendedSpecConfig } from '../
|
|
3
|
+
import type { ExtendedSpecConfig } from '../api';
|
|
4
4
|
export declare class SpecGenerator2 extends SpecGenerator {
|
|
5
5
|
protected readonly metadata: Tsoa.Metadata;
|
|
6
6
|
protected readonly config: ExtendedSpecConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsoa-next/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Build swagger-compliant REST APIs using TypeScript and Node",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"author": "Vanna DiCatania <vanna@dicatania.me> (http://www.dicatania.me)",
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tsoa-next/runtime": "
|
|
36
|
+
"@tsoa-next/runtime": "8.0.0",
|
|
37
37
|
"@types/multer": "^2.1.0",
|
|
38
38
|
"fs-extra": "^11.3.4",
|
|
39
39
|
"glob": "^13.0.6",
|