@mnci/cli 1.15.7 → 1.15.9

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 CHANGED
@@ -145,7 +145,13 @@ that would just fail felt worse than being upfront that it doesn't exist yet.
145
145
  2. Patches `nx.json` with the release opinion (the only config Nx has no
146
146
  default for): independent versioning from **conventional commits**,
147
147
  `{projectName}@{version}` tags, **tag-only git** (`commit: false`) — nothing
148
- is ever pushed to `main`; future runs resolve versions from tag names.
148
+ is ever pushed to `main`; future runs resolve versions from tag names. Also
149
+ fills in `namedInputs.sharedGlobals` with the root config files
150
+ (`eslint.config.mjs`, `tsconfig.base.json`, `package.json`), without which
151
+ `nx affected` on a pull request is blind to them: they live in no project, so
152
+ changing one marked only the root pseudo-project — which has no
153
+ lint/typecheck/test/build target — and the affected-scoped verify step ran
154
+ nothing at all while reporting green.
149
155
  3. Writes `eslint.config.mjs` (three lines importing `@mnci/eslint-config` —
150
156
  the whole linting opinion, in one root config), `.prettierrc.json` +
151
157
  `.prettierignore`, `.npmrc` (publish auth — see **Publish auth** below),
@@ -169,7 +175,8 @@ this existed; nothing let an already-generated workspace pick one up.
169
175
  `mnci upgrade`, run from the workspace root, closes that gap: it resolves the
170
176
  same options `new` would have and calls the exact same `applyOverlay` `new`
171
177
  itself calls — the one function that does every bit of `mnci`-owned file
172
- writing (`nx.json`'s `release`/`sync`/`generators`/`mnci` blocks, `.npmrc`,
178
+ writing (`nx.json`'s `release`/`sync`/`generators`/`namedInputs.sharedGlobals`/
179
+ `mnci` blocks, `.npmrc`,
173
180
  `eslint.config.mjs`, `.prettierrc.json`, `commitlint.config.mjs`,
174
181
  `.husky/commit-msg`, the CI pipeline file(s), the
175
182
  `<workspace-name>.code-workspace` file, and the curated root `package.json`
package/dist/cli.js CHANGED
@@ -1329,6 +1329,20 @@ function withEslintPlugin(nxJson) {
1329
1329
  const registered = plugins.some((entry) => pluginName(entry) === ESLINT_PLUGIN_CONFIG.plugin);
1330
1330
  return registered ? { ...nxJson, plugins } : { ...nxJson, plugins: [...plugins, ESLINT_PLUGIN_CONFIG] };
1331
1331
  }
1332
+ var SHARED_GLOBAL_INPUTS = [
1333
+ "{workspaceRoot}/eslint.config.mjs",
1334
+ "{workspaceRoot}/tsconfig.base.json",
1335
+ "{workspaceRoot}/package.json"
1336
+ ];
1337
+ function withSharedGlobals(nxJson) {
1338
+ const namedInputs = nxJson.namedInputs ?? {};
1339
+ const existing = namedInputs.sharedGlobals ?? [];
1340
+ const missing = SHARED_GLOBAL_INPUTS.filter((entry) => !existing.includes(entry));
1341
+ return {
1342
+ ...nxJson,
1343
+ namedInputs: { ...namedInputs, sharedGlobals: [...existing, ...missing] }
1344
+ };
1345
+ }
1332
1346
  function withReleaseConfig(nxJson, ci) {
1333
1347
  return { ...nxJson, defaultBase: "main", release: releaseConfig(ci) };
1334
1348
  }
@@ -1350,7 +1364,10 @@ var ESLINT_CONFIG_VERSION = "^0.1.0";
1350
1364
  function eslintConfigSpec() {
1351
1365
  return process.env.MNCI_ESLINT_CONFIG_SPEC ?? ESLINT_CONFIG_VERSION;
1352
1366
  }
1353
- var ESLINT_VERSION = "^9.39.0";
1367
+ var ESLINT_VERSION = "^10.8.0";
1368
+ var ESLINT_PEER_OVERRIDES = {
1369
+ "eslint-plugin-jsx-a11y": { eslint: "$eslint" }
1370
+ };
1354
1371
  function eslintToolchainDependencies(nxVersion) {
1355
1372
  return {
1356
1373
  eslint: ESLINT_VERSION,
@@ -2004,7 +2021,7 @@ function applyOverlay(workspaceRoot, options) {
2004
2021
  };
2005
2022
  const sync = { ...nxJson.sync, ...SYNC_CONFIG };
2006
2023
  const mnci = { ...nxJson.mnci, ...mnciConfig(options) };
2007
- const patched = withEslintPlugin(withReleaseConfig(nxJson, options.ci));
2024
+ const patched = withSharedGlobals(withEslintPlugin(withReleaseConfig(nxJson, options.ci)));
2008
2025
  writeFileEnsured(nxJsonPath, toJson({ ...patched, generators, sync, mnci }));
2009
2026
  const manifestPath = (0, import_node_path11.join)(workspaceRoot, "package.json");
2010
2027
  const manifest = readJson(manifestPath);
@@ -2020,9 +2037,19 @@ function applyOverlay(workspaceRoot, options) {
2020
2037
  ...eslintToolchainDependencies(existingDevDeps?.nx ?? "latest"),
2021
2038
  prettier: PRETTIER_VERSION
2022
2039
  };
2040
+ const overrides = {
2041
+ ...manifest.overrides,
2042
+ ...ESLINT_PEER_OVERRIDES
2043
+ };
2023
2044
  writeFileEnsured(
2024
2045
  manifestPath,
2025
- toJson({ ...manifest, name: `${options.scope}/source`, scripts, devDependencies: devDeps })
2046
+ toJson({
2047
+ ...manifest,
2048
+ name: `${options.scope}/source`,
2049
+ scripts,
2050
+ devDependencies: devDeps,
2051
+ overrides
2052
+ })
2026
2053
  );
2027
2054
  writeFileEnsured((0, import_node_path11.join)(workspaceRoot, ".npmrc"), npmrcContent(options.registry, options.scope));
2028
2055
  writeFileEnsured((0, import_node_path11.join)(workspaceRoot, "commitlint.config.mjs"), COMMITLINT_CONFIG);
@@ -2056,7 +2083,7 @@ function applyOverlay(workspaceRoot, options) {
2056
2083
  }
2057
2084
 
2058
2085
  // src/commands/doctor.ts
2059
- var SUPPORTED_ESLINT_MAJOR = ESLINT_VERSION.replace(/^\D*/, "").split(".")[0];
2086
+ var SUPPORTED_ESLINT_MAJOR = ESLINT_VERSION.replace(/^\D*/, "").split(".", 1)[0];
2060
2087
  function checkEslintConfigs(workspaceRoot) {
2061
2088
  const rootConfigs = (0, import_node_fs7.globSync)("eslint.config.{js,mjs,cjs,ts,mts,cts}", { cwd: workspaceRoot });
2062
2089
  const projectConfigs = (0, import_node_fs7.globSync)("{apps,libs,packages}/*/eslint.config.{js,mjs,cjs,ts,mts,cts}", {
@@ -2089,7 +2116,7 @@ function checkPrettierConfig(workspaceRoot) {
2089
2116
  function checkEslintPlugin(nxJson) {
2090
2117
  const plugins = nxJson.plugins ?? [];
2091
2118
  const registered = plugins.some(
2092
- (entry) => typeof entry === "string" ? entry === "@nx/eslint/plugin" : entry.plugin === "@nx/eslint/plugin"
2119
+ (entry) => (typeof entry === "string" ? entry : entry.plugin) === "@nx/eslint/plugin"
2093
2120
  );
2094
2121
  return {
2095
2122
  check: "@nx/eslint/plugin registered",
@@ -2105,7 +2132,7 @@ function checkResolvedEslint(workspaceRoot) {
2105
2132
  }
2106
2133
  try {
2107
2134
  const { version } = readJson(manifestPath);
2108
- const major = version.split(".")[0];
2135
+ const major = version.split(".", 1)[0];
2109
2136
  return {
2110
2137
  check: `resolved eslint is ${SUPPORTED_ESLINT_MAJOR}.x`,
2111
2138
  ok: major === SUPPORTED_ESLINT_MAJOR,
@@ -2150,7 +2177,6 @@ function checkVersionActions(workspaceRoot) {
2150
2177
  const projectJson = readJson(projectJsonPath);
2151
2178
  hasOverride = Boolean(projectJson.release?.version?.versionActions);
2152
2179
  } catch {
2153
- hasOverride = false;
2154
2180
  }
2155
2181
  return [
2156
2182
  {
@@ -2407,15 +2433,15 @@ function runUpgrade(workspaceRoot, options) {
2407
2433
  // src/commands/interactive.ts
2408
2434
  async function runInteractive() {
2409
2435
  const inWorkspace = fileExists((0, import_node_path15.join)(process.cwd(), "nx.json"));
2410
- const newChoice = { name: "Create a new monorepo", value: "new" };
2411
- const addChoice = { name: "Add a project to this workspace", value: "add" };
2412
- const upgradeChoice = {
2436
+ const choiceNew = { name: "Create a new monorepo", value: "new" };
2437
+ const choiceAdd = { name: "Add a project to this workspace", value: "add" };
2438
+ const choiceUpgrade = {
2413
2439
  name: "Upgrade this workspace (re-apply the latest overlay)",
2414
2440
  value: "upgrade"
2415
2441
  };
2416
2442
  const action = await (0, import_prompts8.select)({
2417
2443
  message: "What would you like to do?",
2418
- choices: inWorkspace ? [addChoice, upgradeChoice, newChoice] : [newChoice, addChoice, upgradeChoice]
2444
+ choices: inWorkspace ? [choiceAdd, choiceUpgrade, choiceNew] : [choiceNew, choiceAdd, choiceUpgrade]
2419
2445
  });
2420
2446
  if (action === "new") {
2421
2447
  await runNew(void 0, {});
@@ -2538,7 +2564,7 @@ async function main() {
2538
2564
  checkForUpdate(cliVersion);
2539
2565
  const arguments_ = new Set(process.argv.slice(2));
2540
2566
  const requestedVersionFlag = arguments_.has("-v") || arguments_.has("--version");
2541
- if (process.stdout.isTTY && !requestedVersionFlag) {
2567
+ if (!requestedVersionFlag && process.stdout.isTTY) {
2542
2568
  logger.info(`mnci v${cliVersion}`);
2543
2569
  }
2544
2570
  await program.parseAsync(process.argv);