@mnci/cli 4.21.0 → 4.22.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/README.md +1 -1
- package/dist/cli.js +22 -15
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -204,7 +204,7 @@ value always wins.
|
|
|
204
204
|
swc's `transform()` without `sourceMaps`, so swc returns no map, the rollup
|
|
205
205
|
chain breaks, and the map comes out valid-looking and **empty** — `sources: []`.
|
|
206
206
|
Measured on a real package: swc gave 0 sources, babel gave 9. Revert the swap
|
|
207
|
-
once Nx passes `sourceMaps` through;
|
|
207
|
+
once Nx passes `sourceMaps` through; issue #308 has the one-line upstream fix.
|
|
208
208
|
|
|
209
209
|
Re-measured against the exact toolchain `mnci new` pins today (Nx 23.2.0,
|
|
210
210
|
`@swc/core` 1.15.8): `@nx/rollup`'s swc plugin still does **not** pass
|
package/dist/cli.js
CHANGED
|
@@ -2673,27 +2673,33 @@ function projectTask(name, kind) {
|
|
|
2673
2673
|
return kind === "start" ? { ...base, isBackground: true } : { ...base, group: kind };
|
|
2674
2674
|
}
|
|
2675
2675
|
function renameScaffoldPlaceholder(projectRoot, name) {
|
|
2676
|
+
reshapeScaffoldSlice(projectRoot, name, "ts", "use-case");
|
|
2677
|
+
}
|
|
2678
|
+
function reshapeReactScaffold(projectRoot, name) {
|
|
2679
|
+
reshapeScaffoldSlice(projectRoot, name, "tsx", "component");
|
|
2680
|
+
}
|
|
2681
|
+
function reshapeScaffoldSlice(projectRoot, name, extension, role) {
|
|
2676
2682
|
const sourceDir = (0, import_node_path5.join)(projectRoot, "src");
|
|
2677
|
-
const
|
|
2678
|
-
if (!(0, import_node_fs5.existsSync)(
|
|
2683
|
+
const libDir = (0, import_node_path5.join)(sourceDir, "lib");
|
|
2684
|
+
if (!(0, import_node_fs5.existsSync)((0, import_node_path5.join)(libDir, `${name}.${extension}`))) {
|
|
2679
2685
|
return;
|
|
2680
2686
|
}
|
|
2681
2687
|
const sliceDir = (0, import_node_path5.join)(sourceDir, name);
|
|
2682
2688
|
(0, import_node_fs5.mkdirSync)(sliceDir, { recursive: true });
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
renamed,
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2689
|
+
for (const entry of (0, import_node_fs5.readdirSync)(libDir)) {
|
|
2690
|
+
if (entry === `${name}.${extension}`) {
|
|
2691
|
+
(0, import_node_fs5.renameSync)((0, import_node_path5.join)(libDir, entry), (0, import_node_path5.join)(sliceDir, `${name}.${role}.${extension}`));
|
|
2692
|
+
} else if (entry === `${name}.spec.${extension}`) {
|
|
2693
|
+
const renamed = (0, import_node_path5.join)(sliceDir, `${name}.${role}.spec.${extension}`);
|
|
2694
|
+
(0, import_node_fs5.renameSync)((0, import_node_path5.join)(libDir, entry), renamed);
|
|
2695
|
+
writeFileEnsured(renamed, repointSpecifier((0, import_node_fs5.readFileSync)(renamed, "utf8"), `./${name}`, `./${name}.${role}`));
|
|
2696
|
+
} else {
|
|
2697
|
+
(0, import_node_fs5.renameSync)((0, import_node_path5.join)(libDir, entry), (0, import_node_path5.join)(sliceDir, entry));
|
|
2698
|
+
}
|
|
2693
2699
|
}
|
|
2694
2700
|
const barrel = (0, import_node_path5.join)(sourceDir, "index.ts");
|
|
2695
2701
|
const esm = (0, import_node_fs5.existsSync)(barrel) && (0, import_node_fs5.readFileSync)(barrel, "utf8").includes(`./lib/${name}.js'`);
|
|
2696
|
-
writeFileEnsured((0, import_node_path5.join)(sliceDir, "index.ts"), `export * from './${name}
|
|
2702
|
+
writeFileEnsured((0, import_node_path5.join)(sliceDir, "index.ts"), `export * from './${name}.${role}${esm ? ".js" : ""}'
|
|
2697
2703
|
`);
|
|
2698
2704
|
if ((0, import_node_fs5.existsSync)(barrel)) {
|
|
2699
2705
|
writeFileEnsured(
|
|
@@ -2701,7 +2707,7 @@ function renameScaffoldPlaceholder(projectRoot, name) {
|
|
|
2701
2707
|
(0, import_node_fs5.readFileSync)(barrel, "utf8").replaceAll(`./lib/${name}.js'`, () => `./${name}/index.js'`).replaceAll(`./lib/${name}'`, () => `./${name}'`)
|
|
2702
2708
|
);
|
|
2703
2709
|
}
|
|
2704
|
-
(0, import_node_fs5.rmSync)(
|
|
2710
|
+
(0, import_node_fs5.rmSync)(libDir, { recursive: true, force: true });
|
|
2705
2711
|
}
|
|
2706
2712
|
function repointSpecifier(source, from, to) {
|
|
2707
2713
|
return source.replaceAll(`${from}'`, () => `${to}'`).replaceAll(`${from}.js'`, () => `${to}.js'`);
|
|
@@ -4136,7 +4142,7 @@ function sourceMapCapableCompiler(indent) {
|
|
|
4136
4142
|
return [
|
|
4137
4143
|
`${indent}// Swapped from swc by MoNecromanCI. @nx/rollup runs swc without`,
|
|
4138
4144
|
`${indent}// sourceMaps, so it returns no map and the bundle's map comes out empty -`,
|
|
4139
|
-
`${indent}// valid-looking, and useless for debugging. See
|
|
4145
|
+
`${indent}// valid-looking, and useless for debugging. See issue #308.`,
|
|
4140
4146
|
`${indent}compiler: 'babel',`
|
|
4141
4147
|
].join("\n");
|
|
4142
4148
|
}
|
|
@@ -4764,6 +4770,7 @@ async function addReactLib(workspaceRoot, name, options, kindProvided, stack) {
|
|
|
4764
4770
|
repairPublishableManifest(publishableManifest);
|
|
4765
4771
|
repairDeclarationSpecifiers(projectRoot);
|
|
4766
4772
|
writeProjectReadme(projectRoot, `${scope}/${name}`, stack.testRunner);
|
|
4773
|
+
reshapeReactScaffold(projectRoot, name);
|
|
4767
4774
|
removeGeneratedEslintConfig(workspaceRoot, `packages/${name}`);
|
|
4768
4775
|
removeLocalRegistryScaffolding(workspaceRoot);
|
|
4769
4776
|
registerProjectCommands(workspaceRoot, name, { build: true });
|