@mnci/cli 4.10.3 → 4.10.5
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 +71 -19
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -449,7 +449,30 @@ function releaseConfig(ci) {
|
|
|
449
449
|
// Set here at `new` time it wins: the generator only fills this in when
|
|
450
450
|
// absent (it spreads the existing release.version over its default). Both
|
|
451
451
|
// globs are listed; `nx run-many` no-ops cleanly when one matches nothing.
|
|
452
|
-
preVersionCommand: "npx nx run-many -t build --projects=packages/*,python-packages/*"
|
|
452
|
+
preVersionCommand: "npx nx run-many -t build --projects=packages/*,python-packages/*",
|
|
453
|
+
// The lock file resync is OFF, and the reason is that it cannot succeed
|
|
454
|
+
// on the one release where it would matter.
|
|
455
|
+
//
|
|
456
|
+
// It is not `preVersionCommand` that does this, despite the name it gets
|
|
457
|
+
// reported under: `@nx/js`'s `afterAllProjectsVersioned` hook shells
|
|
458
|
+
// `npm install --package-lock-only` once every project has been versioned.
|
|
459
|
+
// That command resolves the whole tree against the registry, so the first
|
|
460
|
+
// release of two NEW interdependent packages 404s — package A declares a
|
|
461
|
+
// dependency on package B at the version this very run is about to
|
|
462
|
+
// publish, and B does not exist on the registry yet. Measured on a real
|
|
463
|
+
// workspace releasing `@scope/cli` and `@scope/studio` together.
|
|
464
|
+
//
|
|
465
|
+
// Turning it off costs nothing here, because mnci releases are tag-only:
|
|
466
|
+
// `git.commit` is `false`, so the refreshed lock file is written into an
|
|
467
|
+
// ephemeral CI checkout and then thrown away without ever being committed.
|
|
468
|
+
// It was never protecting anything. That it goes stale is not a new
|
|
469
|
+
// condition either — every manifest on disk is already stale by design for
|
|
470
|
+
// exactly the same reason, which is why `fallbackCurrentVersionResolver`
|
|
471
|
+
// is `'disk'` and why a tagless clone makes a dry run silently wrong.
|
|
472
|
+
//
|
|
473
|
+
// A workspace that DOES want the lock file refreshed should commit the
|
|
474
|
+
// bump too (`git.commit: true`), at which point this can be dropped.
|
|
475
|
+
versionActionsOptions: { skipLockFileUpdate: true }
|
|
453
476
|
},
|
|
454
477
|
changelog: githubReleases ? {
|
|
455
478
|
workspaceChangelog: false,
|
|
@@ -573,13 +596,9 @@ var ROOT_LINT_TARGET = {
|
|
|
573
596
|
cwd: "."
|
|
574
597
|
}
|
|
575
598
|
};
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
...manifest.devDependencies
|
|
580
|
-
};
|
|
581
|
-
return declared.express === void 0 ? {} : { "@nx/react": { express: "$express" } };
|
|
582
|
-
}
|
|
599
|
+
var NX_PEER_OVERRIDES = {
|
|
600
|
+
"@nx/react": { express: ">=4.0.0 <6.0.0" }
|
|
601
|
+
};
|
|
583
602
|
var ESLINT_PEER_OVERRIDES = {
|
|
584
603
|
"eslint-plugin-jsx-a11y": { eslint: "$eslint" },
|
|
585
604
|
// Scoped to EACH named parent, not top-level and not `nx` alone.
|
|
@@ -1861,11 +1880,9 @@ function applyOverlay(workspaceRoot, options, onProgress = () => {
|
|
|
1861
1880
|
...manifest.overrides,
|
|
1862
1881
|
...ESLINT_PEER_OVERRIDES,
|
|
1863
1882
|
...SECURITY_OVERRIDES,
|
|
1864
|
-
//
|
|
1865
|
-
//
|
|
1866
|
-
|
|
1867
|
-
// itself. This line is what carries it across an `mnci upgrade`.
|
|
1868
|
-
...reactExpressPeerOverride(manifest)
|
|
1883
|
+
// Static, so it is present before any generator can run an install — see
|
|
1884
|
+
// NX_PEER_OVERRIDES for why the conditional form could never be.
|
|
1885
|
+
...NX_PEER_OVERRIDES
|
|
1869
1886
|
};
|
|
1870
1887
|
const existingNx = manifest.nx;
|
|
1871
1888
|
const existingTargets = withoutKey(
|
|
@@ -2093,8 +2110,45 @@ function projectTask(name, kind) {
|
|
|
2093
2110
|
const base = { label: `${name}: ${kind}`, type: "npm", script, problemMatcher: [] };
|
|
2094
2111
|
return kind === "start" ? { ...base, isBackground: true } : { ...base, group: kind };
|
|
2095
2112
|
}
|
|
2113
|
+
function renameScaffoldPlaceholder(projectRoot, name) {
|
|
2114
|
+
const placeholder = (0, import_node_path3.join)(projectRoot, "src", "lib", `${name}.ts`);
|
|
2115
|
+
if (!(0, import_node_fs3.existsSync)(placeholder)) {
|
|
2116
|
+
return;
|
|
2117
|
+
}
|
|
2118
|
+
(0, import_node_fs3.renameSync)(placeholder, (0, import_node_path3.join)(projectRoot, "src", "lib", `${name}.use-case.ts`));
|
|
2119
|
+
const spec = (0, import_node_path3.join)(projectRoot, "src", "lib", `${name}.spec.ts`);
|
|
2120
|
+
if ((0, import_node_fs3.existsSync)(spec)) {
|
|
2121
|
+
const renamed = (0, import_node_path3.join)(projectRoot, "src", "lib", `${name}.use-case.spec.ts`);
|
|
2122
|
+
(0, import_node_fs3.renameSync)(spec, renamed);
|
|
2123
|
+
writeFileEnsured(
|
|
2124
|
+
renamed,
|
|
2125
|
+
(0, import_node_fs3.readFileSync)(renamed, "utf8").replaceAll(`./${name}'`, () => `./${name}.use-case'`)
|
|
2126
|
+
);
|
|
2127
|
+
}
|
|
2128
|
+
const barrel = (0, import_node_path3.join)(projectRoot, "src", "index.ts");
|
|
2129
|
+
if ((0, import_node_fs3.existsSync)(barrel)) {
|
|
2130
|
+
writeFileEnsured(
|
|
2131
|
+
barrel,
|
|
2132
|
+
(0, import_node_fs3.readFileSync)(barrel, "utf8").replaceAll(`./lib/${name}'`, () => `./lib/${name}.use-case'`)
|
|
2133
|
+
);
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
function ensureNxPeerOverrides(workspaceRoot) {
|
|
2137
|
+
const manifestPath = (0, import_node_path3.join)(workspaceRoot, "package.json");
|
|
2138
|
+
if (!(0, import_node_fs3.existsSync)(manifestPath)) {
|
|
2139
|
+
return;
|
|
2140
|
+
}
|
|
2141
|
+
const manifest = readJson(manifestPath);
|
|
2142
|
+
const existing = manifest.overrides ?? {};
|
|
2143
|
+
const overrides = { ...existing, ...NX_PEER_OVERRIDES };
|
|
2144
|
+
if (JSON.stringify(existing) === JSON.stringify(overrides)) {
|
|
2145
|
+
return;
|
|
2146
|
+
}
|
|
2147
|
+
writeFileEnsured(manifestPath, toJson({ ...manifest, overrides }));
|
|
2148
|
+
}
|
|
2096
2149
|
function registerProjectCommands(workspaceRoot, name, commands) {
|
|
2097
2150
|
removeStaleGitkeeps(workspaceRoot);
|
|
2151
|
+
ensurePythonArtefactsIgnored(workspaceRoot);
|
|
2098
2152
|
const scripts = {
|
|
2099
2153
|
[`${name}:qa`]: `nx run ${name}:lint && nx run ${name}:test`
|
|
2100
2154
|
};
|
|
@@ -2111,16 +2165,11 @@ function registerProjectCommands(workspaceRoot, name, commands) {
|
|
|
2111
2165
|
const manifestPath = (0, import_node_path3.join)(workspaceRoot, "package.json");
|
|
2112
2166
|
const manifest = readJson(manifestPath);
|
|
2113
2167
|
const existingScripts = manifest.scripts ?? {};
|
|
2114
|
-
const overrides = {
|
|
2115
|
-
...manifest.overrides,
|
|
2116
|
-
...reactExpressPeerOverride(manifest)
|
|
2117
|
-
};
|
|
2118
2168
|
writeFileEnsured(
|
|
2119
2169
|
manifestPath,
|
|
2120
2170
|
toJson({
|
|
2121
2171
|
...manifest,
|
|
2122
|
-
scripts: { ...existingScripts, ...scripts }
|
|
2123
|
-
...Object.keys(overrides).length > 0 && { overrides }
|
|
2172
|
+
scripts: { ...existingScripts, ...scripts }
|
|
2124
2173
|
})
|
|
2125
2174
|
);
|
|
2126
2175
|
const codeWorkspacePath = findCodeWorkspaceFile(workspaceRoot);
|
|
@@ -3231,6 +3280,7 @@ async function addNpmLib(workspaceRoot, name, options, kindProvided, stack) {
|
|
|
3231
3280
|
repairPublishableManifest(manifestPath);
|
|
3232
3281
|
repairDeclarationSpecifiers(projectRoot);
|
|
3233
3282
|
writeProjectReadme(projectRoot, `${scope}/${name}`, stack.testRunner);
|
|
3283
|
+
renameScaffoldPlaceholder(projectRoot, name);
|
|
3234
3284
|
removeGeneratedEslintConfig(workspaceRoot, `packages/${name}`);
|
|
3235
3285
|
removeLocalRegistryScaffolding(workspaceRoot);
|
|
3236
3286
|
registerProjectCommands(workspaceRoot, name, { build: true });
|
|
@@ -4674,6 +4724,7 @@ async function runAdd(kind, name, options) {
|
|
|
4674
4724
|
const resolvedName = name ?? await promptText("Project name");
|
|
4675
4725
|
assertValidProjectName(resolvedName, "Project name");
|
|
4676
4726
|
const rootDependenciesBefore = rootRuntimeDependencies(workspaceRoot);
|
|
4727
|
+
ensureNxPeerOverrides(workspaceRoot);
|
|
4677
4728
|
switch (resolvedKind) {
|
|
4678
4729
|
case "react-app": {
|
|
4679
4730
|
addReactApp(workspaceRoot, resolvedName, stack);
|
|
@@ -4713,6 +4764,7 @@ async function runAdd(kind, name, options) {
|
|
|
4713
4764
|
workspaceRoot
|
|
4714
4765
|
);
|
|
4715
4766
|
markPrivate((0, import_node_path18.join)(workspaceRoot, "libs", resolvedName, "package.json"));
|
|
4767
|
+
renameScaffoldPlaceholder((0, import_node_path18.join)(workspaceRoot, "libs", resolvedName), resolvedName);
|
|
4716
4768
|
removeGeneratedEslintConfig(workspaceRoot, `libs/${resolvedName}`);
|
|
4717
4769
|
registerProjectCommands(workspaceRoot, resolvedName, { build: true });
|
|
4718
4770
|
break;
|