@mnci/cli 4.19.0 → 4.20.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/cli.js +14 -6
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2492,27 +2492,35 @@ function projectTask(name, kind) {
|
|
|
2492
2492
|
return kind === "start" ? { ...base, isBackground: true } : { ...base, group: kind };
|
|
2493
2493
|
}
|
|
2494
2494
|
function renameScaffoldPlaceholder(projectRoot, name) {
|
|
2495
|
-
const
|
|
2495
|
+
const sourceDir = (0, import_node_path4.join)(projectRoot, "src");
|
|
2496
|
+
const placeholder = (0, import_node_path4.join)(sourceDir, "lib", `${name}.ts`);
|
|
2496
2497
|
if (!(0, import_node_fs4.existsSync)(placeholder)) {
|
|
2497
2498
|
return;
|
|
2498
2499
|
}
|
|
2499
|
-
|
|
2500
|
-
|
|
2500
|
+
const sliceDir = (0, import_node_path4.join)(sourceDir, name);
|
|
2501
|
+
(0, import_node_fs4.mkdirSync)(sliceDir, { recursive: true });
|
|
2502
|
+
(0, import_node_fs4.renameSync)(placeholder, (0, import_node_path4.join)(sliceDir, `${name}.use-case.ts`));
|
|
2503
|
+
const spec = (0, import_node_path4.join)(sourceDir, "lib", `${name}.spec.ts`);
|
|
2501
2504
|
if ((0, import_node_fs4.existsSync)(spec)) {
|
|
2502
|
-
const renamed = (0, import_node_path4.join)(
|
|
2505
|
+
const renamed = (0, import_node_path4.join)(sliceDir, `${name}.use-case.spec.ts`);
|
|
2503
2506
|
(0, import_node_fs4.renameSync)(spec, renamed);
|
|
2504
2507
|
writeFileEnsured(
|
|
2505
2508
|
renamed,
|
|
2509
|
+
// The spec still sits beside the implementation, so only its role suffix changes.
|
|
2506
2510
|
repointSpecifier((0, import_node_fs4.readFileSync)(renamed, "utf8"), `./${name}`, `./${name}.use-case`)
|
|
2507
2511
|
);
|
|
2508
2512
|
}
|
|
2509
|
-
const barrel = (0, import_node_path4.join)(
|
|
2513
|
+
const barrel = (0, import_node_path4.join)(sourceDir, "index.ts");
|
|
2514
|
+
const esm = (0, import_node_fs4.existsSync)(barrel) && (0, import_node_fs4.readFileSync)(barrel, "utf8").includes(`./lib/${name}.js'`);
|
|
2515
|
+
writeFileEnsured((0, import_node_path4.join)(sliceDir, "index.ts"), `export * from './${name}.use-case${esm ? ".js" : ""}'
|
|
2516
|
+
`);
|
|
2510
2517
|
if ((0, import_node_fs4.existsSync)(barrel)) {
|
|
2511
2518
|
writeFileEnsured(
|
|
2512
2519
|
barrel,
|
|
2513
|
-
|
|
2520
|
+
(0, import_node_fs4.readFileSync)(barrel, "utf8").replaceAll(`./lib/${name}.js'`, () => `./${name}/index.js'`).replaceAll(`./lib/${name}'`, () => `./${name}'`)
|
|
2514
2521
|
);
|
|
2515
2522
|
}
|
|
2523
|
+
(0, import_node_fs4.rmSync)((0, import_node_path4.join)(sourceDir, "lib"), { recursive: true, force: true });
|
|
2516
2524
|
}
|
|
2517
2525
|
function repointSpecifier(source, from, to) {
|
|
2518
2526
|
return source.replaceAll(`${from}'`, () => `${to}'`).replaceAll(`${from}.js'`, () => `${to}.js'`);
|