@mnci/cli 4.10.3 → 4.10.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.
package/dist/cli.js CHANGED
@@ -573,13 +573,9 @@ var ROOT_LINT_TARGET = {
573
573
  cwd: "."
574
574
  }
575
575
  };
576
- function reactExpressPeerOverride(manifest) {
577
- const declared = {
578
- ...manifest.dependencies,
579
- ...manifest.devDependencies
580
- };
581
- return declared.express === void 0 ? {} : { "@nx/react": { express: "$express" } };
582
- }
576
+ var NX_PEER_OVERRIDES = {
577
+ "@nx/react": { express: ">=4.0.0 <6.0.0" }
578
+ };
583
579
  var ESLINT_PEER_OVERRIDES = {
584
580
  "eslint-plugin-jsx-a11y": { eslint: "$eslint" },
585
581
  // Scoped to EACH named parent, not top-level and not `nx` alone.
@@ -1861,11 +1857,9 @@ function applyOverlay(workspaceRoot, options, onProgress = () => {
1861
1857
  ...manifest.overrides,
1862
1858
  ...ESLINT_PEER_OVERRIDES,
1863
1859
  ...SECURITY_OVERRIDES,
1864
- // Last, and conditional — see reactExpressPeerOverride. At `mnci new` there
1865
- // is no express yet, so this is a no-op; `mnci add node-app --framework
1866
- // express` is what puts express in the root manifest, and syncs the override
1867
- // itself. This line is what carries it across an `mnci upgrade`.
1868
- ...reactExpressPeerOverride(manifest)
1860
+ // Static, so it is present before any generator can run an install — see
1861
+ // NX_PEER_OVERRIDES for why the conditional form could never be.
1862
+ ...NX_PEER_OVERRIDES
1869
1863
  };
1870
1864
  const existingNx = manifest.nx;
1871
1865
  const existingTargets = withoutKey(
@@ -2093,8 +2087,22 @@ function projectTask(name, kind) {
2093
2087
  const base = { label: `${name}: ${kind}`, type: "npm", script, problemMatcher: [] };
2094
2088
  return kind === "start" ? { ...base, isBackground: true } : { ...base, group: kind };
2095
2089
  }
2090
+ function ensureNxPeerOverrides(workspaceRoot) {
2091
+ const manifestPath = (0, import_node_path3.join)(workspaceRoot, "package.json");
2092
+ if (!(0, import_node_fs3.existsSync)(manifestPath)) {
2093
+ return;
2094
+ }
2095
+ const manifest = readJson(manifestPath);
2096
+ const existing = manifest.overrides ?? {};
2097
+ const overrides = { ...existing, ...NX_PEER_OVERRIDES };
2098
+ if (JSON.stringify(existing) === JSON.stringify(overrides)) {
2099
+ return;
2100
+ }
2101
+ writeFileEnsured(manifestPath, toJson({ ...manifest, overrides }));
2102
+ }
2096
2103
  function registerProjectCommands(workspaceRoot, name, commands) {
2097
2104
  removeStaleGitkeeps(workspaceRoot);
2105
+ ensurePythonArtefactsIgnored(workspaceRoot);
2098
2106
  const scripts = {
2099
2107
  [`${name}:qa`]: `nx run ${name}:lint && nx run ${name}:test`
2100
2108
  };
@@ -2111,16 +2119,11 @@ function registerProjectCommands(workspaceRoot, name, commands) {
2111
2119
  const manifestPath = (0, import_node_path3.join)(workspaceRoot, "package.json");
2112
2120
  const manifest = readJson(manifestPath);
2113
2121
  const existingScripts = manifest.scripts ?? {};
2114
- const overrides = {
2115
- ...manifest.overrides,
2116
- ...reactExpressPeerOverride(manifest)
2117
- };
2118
2122
  writeFileEnsured(
2119
2123
  manifestPath,
2120
2124
  toJson({
2121
2125
  ...manifest,
2122
- scripts: { ...existingScripts, ...scripts },
2123
- ...Object.keys(overrides).length > 0 && { overrides }
2126
+ scripts: { ...existingScripts, ...scripts }
2124
2127
  })
2125
2128
  );
2126
2129
  const codeWorkspacePath = findCodeWorkspaceFile(workspaceRoot);
@@ -4674,6 +4677,7 @@ async function runAdd(kind, name, options) {
4674
4677
  const resolvedName = name ?? await promptText("Project name");
4675
4678
  assertValidProjectName(resolvedName, "Project name");
4676
4679
  const rootDependenciesBefore = rootRuntimeDependencies(workspaceRoot);
4680
+ ensureNxPeerOverrides(workspaceRoot);
4677
4681
  switch (resolvedKind) {
4678
4682
  case "react-app": {
4679
4683
  addReactApp(workspaceRoot, resolvedName, stack);