@tuyau/core 0.0.4 → 0.0.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.
|
@@ -156,7 +156,7 @@ var ApiTypesGenerator = class {
|
|
|
156
156
|
continue;
|
|
157
157
|
}
|
|
158
158
|
const schemaImport = this.#extractRequest(handlerData);
|
|
159
|
-
const methods = route.methods.map((method) => method.toLowerCase()).filter((method) => method !== "head");
|
|
159
|
+
const methods = route.methods.map((method) => "$" + method.toLowerCase()).filter((method) => method !== "head");
|
|
160
160
|
const segments = route.pattern.split("/").filter(Boolean);
|
|
161
161
|
let currentLevel = types;
|
|
162
162
|
const relativePath = relative(this.#getDestinationDirectory(), file.getFilePath());
|
|
@@ -166,6 +166,7 @@ var ApiTypesGenerator = class {
|
|
|
166
166
|
}
|
|
167
167
|
currentLevel = currentLevel[segment];
|
|
168
168
|
if (i === segments.length - 1) {
|
|
169
|
+
currentLevel["$url"] = {};
|
|
169
170
|
for (const method of methods) {
|
|
170
171
|
currentLevel[method] = {
|
|
171
172
|
request: schemaImport ? `MakeOptional<${schemaImport}>` : "unknown",
|
|
@@ -197,15 +198,15 @@ var CodegenTypes = class extends BaseCommand {
|
|
|
197
198
|
*/
|
|
198
199
|
async run() {
|
|
199
200
|
const project = new Project({
|
|
200
|
-
|
|
201
|
-
|
|
201
|
+
manipulationSettings: { quoteKind: QuoteKind.Single },
|
|
202
|
+
tsConfigFilePath: new URL("./tsconfig.json", this.app.appRoot).pathname
|
|
202
203
|
});
|
|
203
204
|
const apiTypesGenerator = new ApiTypesGenerator({
|
|
204
205
|
project,
|
|
206
|
+
logger: this.logger,
|
|
205
207
|
appRoot: this.app.appRoot,
|
|
206
208
|
routes: await this.#getRoutes(),
|
|
207
|
-
config: this.app.config.get("tuyau")
|
|
208
|
-
logger: this.logger
|
|
209
|
+
config: this.app.config.get("tuyau")
|
|
209
210
|
});
|
|
210
211
|
await apiTypesGenerator.generate();
|
|
211
212
|
this.logger.success("Types generated successfully");
|