@mnci/cli 4.10.2 → 4.10.3
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 +51 -1
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2712,6 +2712,46 @@ function runNodeApp(workspaceRoot, name, stack, framework) {
|
|
|
2712
2712
|
],
|
|
2713
2713
|
workspaceRoot
|
|
2714
2714
|
);
|
|
2715
|
+
const appRoot = (0, import_node_path7.join)(workspaceRoot, "apps", name);
|
|
2716
|
+
separateDeclarationOutput(appRoot);
|
|
2717
|
+
repairAssetMapping(appRoot, name);
|
|
2718
|
+
}
|
|
2719
|
+
function separateDeclarationOutput(appRoot) {
|
|
2720
|
+
const tsconfigPath = (0, import_node_path7.join)(appRoot, "tsconfig.app.json");
|
|
2721
|
+
if (!fileExists(tsconfigPath)) {
|
|
2722
|
+
return;
|
|
2723
|
+
}
|
|
2724
|
+
const tsconfig = readJson(tsconfigPath);
|
|
2725
|
+
const compilerOptions = tsconfig.compilerOptions ?? {};
|
|
2726
|
+
if (compilerOptions.outDir !== "dist") {
|
|
2727
|
+
return;
|
|
2728
|
+
}
|
|
2729
|
+
writeFileEnsured(
|
|
2730
|
+
tsconfigPath,
|
|
2731
|
+
toJson({
|
|
2732
|
+
...tsconfig,
|
|
2733
|
+
compilerOptions: {
|
|
2734
|
+
...compilerOptions,
|
|
2735
|
+
outDir: "out-tsc/app",
|
|
2736
|
+
tsBuildInfoFile: "out-tsc/app/tsconfig.app.tsbuildinfo"
|
|
2737
|
+
}
|
|
2738
|
+
})
|
|
2739
|
+
);
|
|
2740
|
+
}
|
|
2741
|
+
function repairAssetMapping(appRoot, name) {
|
|
2742
|
+
const manifestPath = (0, import_node_path7.join)(appRoot, "package.json");
|
|
2743
|
+
if (!fileExists(manifestPath)) {
|
|
2744
|
+
return;
|
|
2745
|
+
}
|
|
2746
|
+
const manifest = readJson(manifestPath);
|
|
2747
|
+
const options = manifest.nx?.targets?.build?.options;
|
|
2748
|
+
if (!options || !Array.isArray(options.assets)) {
|
|
2749
|
+
return;
|
|
2750
|
+
}
|
|
2751
|
+
options.assets = options.assets.map(
|
|
2752
|
+
(asset) => typeof asset === "string" ? { input: asset, glob: "**/*", output: asset.replace(`apps/${name}/src/`, "") } : asset
|
|
2753
|
+
);
|
|
2754
|
+
writeFileEnsured(manifestPath, toJson(manifest));
|
|
2715
2755
|
}
|
|
2716
2756
|
function nodeAppPackageTarget(name) {
|
|
2717
2757
|
const zip = `dist/drop/node-app-${name}.zip`;
|
|
@@ -2800,7 +2840,7 @@ function repairNodeFunctionAppManifest(nodeFunctionAppRoot, workspaceRoot) {
|
|
|
2800
2840
|
function nodeFunctionAppPackageTarget(name) {
|
|
2801
2841
|
const zip = `dist/drop/node-function-app-${name}.zip`;
|
|
2802
2842
|
const root = `apps/${name}`;
|
|
2803
|
-
const command = `node -e "const fs=require('node:fs');fs.mkdirSync('dist/drop',{recursive:true});const A=require('adm-zip');const z=new A();z.addLocalFolder('${root}/dist','dist');z.addLocalFile('${root}/host.json');z.addLocalFile('${root}/package.json');z.writeZip('${zip}')"`;
|
|
2843
|
+
const command = String.raw`node -e "const fs=require('node:fs');fs.mkdirSync('dist/drop',{recursive:true});const A=require('adm-zip');const z=new A();z.addLocalFolder('${root}/dist','dist',(e)=>!/\.d\.ts(\.map)?$/.test(e));z.addLocalFile('${root}/host.json');z.addLocalFile('${root}/package.json');z.writeZip('${zip}')"`;
|
|
2804
2844
|
return {
|
|
2805
2845
|
executor: "nx:run-commands",
|
|
2806
2846
|
dependsOn: ["build"],
|
|
@@ -2808,6 +2848,15 @@ function nodeFunctionAppPackageTarget(name) {
|
|
|
2808
2848
|
options: { command }
|
|
2809
2849
|
};
|
|
2810
2850
|
}
|
|
2851
|
+
function nodeFunctionAppPruneTarget(name) {
|
|
2852
|
+
const pruned = `apps/${name}/dist/package.json`;
|
|
2853
|
+
const command = String.raw`node -e "const fs=require('node:fs');const root=JSON.parse(fs.readFileSync('package.json','utf8'));const o=root.overrides;if(!o||Object.keys(o).length===0){console.log('No root overrides - nothing to carry into the pruned manifest.');process.exit(0)}const p='${pruned}';if(!fs.existsSync(p)){console.error('Pruned manifest not found at '+p+' - run the prune-lockfile target first.');process.exit(1)}const m=JSON.parse(fs.readFileSync(p,'utf8'));m.overrides={...o,...m.overrides};fs.writeFileSync(p,JSON.stringify(m,null,2)+'\n');console.log('Carried '+Object.keys(o).length+' root override(s) into '+p)"`;
|
|
2854
|
+
return {
|
|
2855
|
+
executor: "nx:run-commands",
|
|
2856
|
+
dependsOn: ["prune-lockfile", "copy-workspace-modules"],
|
|
2857
|
+
options: { command }
|
|
2858
|
+
};
|
|
2859
|
+
}
|
|
2811
2860
|
function nodeFunctionAppStartTarget(name) {
|
|
2812
2861
|
return {
|
|
2813
2862
|
executor: "nx:run-commands",
|
|
@@ -2835,6 +2884,7 @@ function addNodeFunctionApp(workspaceRoot, name, stack) {
|
|
|
2835
2884
|
ensureAdmZip(workspaceRoot);
|
|
2836
2885
|
addNxTargets((0, import_node_path7.join)(nodeFunctionAppRoot, "package.json"), {
|
|
2837
2886
|
package: nodeFunctionAppPackageTarget(name),
|
|
2887
|
+
prune: nodeFunctionAppPruneTarget(name),
|
|
2838
2888
|
start: nodeFunctionAppStartTarget(name)
|
|
2839
2889
|
});
|
|
2840
2890
|
removeGeneratedEslintConfig(workspaceRoot, `apps/${name}`);
|