@tsed/cli 7.3.2 → 7.3.4
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.
|
@@ -265,7 +265,7 @@ export class InitCmd {
|
|
|
265
265
|
const runtimes = inject(RuntimesModule);
|
|
266
266
|
const runtime = runtimes.get();
|
|
267
267
|
// files with higher priority
|
|
268
|
-
const
|
|
268
|
+
const files = [
|
|
269
269
|
"tsconfig.base.json",
|
|
270
270
|
"tsconfig.json",
|
|
271
271
|
"tsconfig.spec.json",
|
|
@@ -287,10 +287,12 @@ export class InitCmd {
|
|
|
287
287
|
`pm2.${pm2}`,
|
|
288
288
|
"/views/home.ejs",
|
|
289
289
|
...runtime.files()
|
|
290
|
-
]
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
290
|
+
];
|
|
291
|
+
for (const id of files) {
|
|
292
|
+
if (id) {
|
|
293
|
+
await render(id, ctx);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
294
296
|
}
|
|
295
297
|
async renderFiles(ctx) {
|
|
296
298
|
// base files
|
|
@@ -299,28 +301,26 @@ export class InitCmd {
|
|
|
299
301
|
taskOutput(`Base files rendered (${Date.now() - startTime}ms)`);
|
|
300
302
|
const files = await $asyncAlter("$alterRenderFiles", [], [ctx]);
|
|
301
303
|
startTime = Date.now();
|
|
302
|
-
const
|
|
304
|
+
for (const option of files) {
|
|
303
305
|
if (!option) {
|
|
304
|
-
|
|
306
|
+
continue;
|
|
305
307
|
}
|
|
306
308
|
if (isString(option)) {
|
|
307
309
|
const [id, name] = option.split(":");
|
|
308
|
-
|
|
310
|
+
await render(id, {
|
|
309
311
|
...ctx,
|
|
310
312
|
from: TEMPLATE_DIR,
|
|
311
313
|
name: name || id
|
|
312
314
|
});
|
|
315
|
+
continue;
|
|
313
316
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
});
|
|
320
|
-
}
|
|
317
|
+
if ("id" in option) {
|
|
318
|
+
await render(option.id, {
|
|
319
|
+
...ctx,
|
|
320
|
+
...option
|
|
321
|
+
});
|
|
321
322
|
}
|
|
322
|
-
}
|
|
323
|
-
await Promise.all(promises);
|
|
323
|
+
}
|
|
324
324
|
taskOutput(`Plugins files rendered (${Date.now() - startTime}ms)`);
|
|
325
325
|
}
|
|
326
326
|
$onFinish(data, er) {
|
|
@@ -40,8 +40,13 @@ export class ProjectClient extends Project {
|
|
|
40
40
|
async createSource(path, sourceFileText, options) {
|
|
41
41
|
path = join(this.rootDir, path);
|
|
42
42
|
if (path.endsWith(".ts") || path.endsWith(".mts")) {
|
|
43
|
+
await this.fs.mkdir(dirname(path));
|
|
44
|
+
if (typeof sourceFileText === "string") {
|
|
45
|
+
await this.fs.writeFile(path, sourceFileText, { encoding: "utf-8" });
|
|
46
|
+
return this.getSourceFile(path) || this.addSourceFileAtPath(path);
|
|
47
|
+
}
|
|
43
48
|
const source = this.createSourceFile(path, sourceFileText, options);
|
|
44
|
-
await source.
|
|
49
|
+
await this.fs.writeFile(path, source.getFullText(), { encoding: "utf-8" });
|
|
45
50
|
return source;
|
|
46
51
|
}
|
|
47
52
|
await this.fs.ensureDir(dirname(path));
|