@mnci/cli 4.1.0 → 4.1.2
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 +68 -17
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -250,7 +250,7 @@ var import_node_path2 = require("path");
|
|
|
250
250
|
var DEFAULT_STACK = { testRunner: "jest" };
|
|
251
251
|
var TS_COMPILER_DEPENDENCIES = {
|
|
252
252
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
253
|
-
typescript: "npm:@typescript/typescript6@^6.0.2"
|
|
253
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2"
|
|
254
254
|
};
|
|
255
255
|
function registryUrl(registry) {
|
|
256
256
|
if (registry.kind === "azure-artifacts") {
|
|
@@ -447,7 +447,7 @@ var ESLINT_PEER_OVERRIDES = {
|
|
|
447
447
|
// both — and forcing those to v5 breaks them. So the blast radius is one
|
|
448
448
|
// dependency edge per named parent, and a test asserts there is no top-level
|
|
449
449
|
// entry.
|
|
450
|
-
nx: { "brace-expansion": "^5.0.9" },
|
|
450
|
+
"nx": { "brace-expansion": "^5.0.9" },
|
|
451
451
|
"@nx/js": { "brace-expansion": "^5.0.9" },
|
|
452
452
|
"@nx/eslint": { "brace-expansion": "^5.0.9" },
|
|
453
453
|
"@nx/eslint-plugin": { "brace-expansion": "^5.0.9" },
|
|
@@ -456,14 +456,14 @@ var ESLINT_PEER_OVERRIDES = {
|
|
|
456
456
|
// which every publishable `npm-lib` gets. GHSA-2v37-7h3g-55p8 is high, fixed in
|
|
457
457
|
// 3.3.18, and the fix is a patch — so unlike the entry above this one is not
|
|
458
458
|
// even a trade, just a version nobody had bumped yet.
|
|
459
|
-
postcss: { nanoid: "^3.3.18" }
|
|
459
|
+
"postcss": { nanoid: "^3.3.18" }
|
|
460
460
|
};
|
|
461
461
|
var SECURITY_OVERRIDES = {
|
|
462
462
|
"brace-expansion@4.0.0 - 5.0.8": "^5.0.9"
|
|
463
463
|
};
|
|
464
464
|
function eslintToolchainDependencies(nxVersion) {
|
|
465
465
|
return {
|
|
466
|
-
eslint: ESLINT_VERSION,
|
|
466
|
+
"eslint": ESLINT_VERSION,
|
|
467
467
|
"@nx/eslint": nxVersion,
|
|
468
468
|
"@nx/eslint-plugin": nxVersion,
|
|
469
469
|
"@mnci/eslint-config": eslintConfigSpec()
|
|
@@ -513,8 +513,13 @@ var ESLINT_BLOCK_INVENTORY = `// WHAT IS IN HERE. Each line is one config block,
|
|
|
513
513
|
// (Vitest's globals too; the two stacks share them)
|
|
514
514
|
// mnci/nx-dependency-checks @nx/eslint-plugin, on publishable packages' manifests
|
|
515
515
|
// mnci/standard JavaScript Standard Style as ESLint rules \u2014 the
|
|
516
|
-
// whole formatting opinion
|
|
517
|
-
//
|
|
516
|
+
// whole formatting opinion, a faithful port of
|
|
517
|
+
// neostandard
|
|
518
|
+
// mnci/house-style the deliberate departures from Standard:
|
|
519
|
+
// trailing commas, aligned object values,
|
|
520
|
+
// consistent-as-needed quote-props, a blank line
|
|
521
|
+
// before return. Composed LAST, on purpose:
|
|
522
|
+
// nothing may follow that disables it.
|
|
518
523
|
//
|
|
519
524
|
// To list them as ESLint actually resolves them: npx eslint --inspect-config
|
|
520
525
|
`;
|
|
@@ -657,14 +662,14 @@ function vscodeWorkspace(workspaceName, existingTasks, existingLaunch, existingS
|
|
|
657
662
|
);
|
|
658
663
|
}
|
|
659
664
|
var ROOT_SCRIPTS = {
|
|
660
|
-
build: "nx run-many -t build",
|
|
661
|
-
lint: "nx run-many -t lint",
|
|
662
|
-
test: "nx run-many -t test",
|
|
663
|
-
typecheck: "nx run-many -t typecheck",
|
|
664
|
-
affected: "nx affected -t lint,typecheck,test,build",
|
|
665
|
-
graph: "nx graph",
|
|
665
|
+
"build": "nx run-many -t build",
|
|
666
|
+
"lint": "nx run-many -t lint",
|
|
667
|
+
"test": "nx run-many -t test",
|
|
668
|
+
"typecheck": "nx run-many -t typecheck",
|
|
669
|
+
"affected": "nx affected -t lint,typecheck,test,build",
|
|
670
|
+
"graph": "nx graph",
|
|
666
671
|
"release:preview": "nx release --dry-run",
|
|
667
|
-
prepare: "husky"
|
|
672
|
+
"prepare": "husky"
|
|
668
673
|
};
|
|
669
674
|
function rootScripts() {
|
|
670
675
|
return {
|
|
@@ -673,7 +678,7 @@ function rootScripts() {
|
|
|
673
678
|
// `format:check`: `lint` already reports formatting as ordinary errors.
|
|
674
679
|
// Carrying a second script that ran the same tool twice would just make a
|
|
675
680
|
// CI run slower for no extra coverage.
|
|
676
|
-
format: "eslint . --fix --cache",
|
|
681
|
+
"format": "eslint . --fix --cache",
|
|
677
682
|
"python:install": `${PYTHON_INSTALL_GUARD} && ${PYTHON_WORKSPACE_INSTALL_GUARD}`
|
|
678
683
|
};
|
|
679
684
|
}
|
|
@@ -1669,6 +1674,50 @@ function registerProjectCommands(workspaceRoot, name, commands) {
|
|
|
1669
1674
|
})
|
|
1670
1675
|
);
|
|
1671
1676
|
}
|
|
1677
|
+
var PROJECT_MANIFEST_ROOTS = ["apps", "packages", "libs"];
|
|
1678
|
+
function rootRuntimeDependencies(workspaceRoot) {
|
|
1679
|
+
try {
|
|
1680
|
+
return readJson((0, import_node_path3.join)(workspaceRoot, "package.json")).dependencies ?? {};
|
|
1681
|
+
} catch {
|
|
1682
|
+
return {};
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
function relocateRootRuntimeDependencies(workspaceRoot, projectName, before) {
|
|
1686
|
+
const after = rootRuntimeDependencies(workspaceRoot);
|
|
1687
|
+
const added = Object.keys(after).filter((name) => !Object.hasOwn(before, name));
|
|
1688
|
+
if (added.length === 0) {
|
|
1689
|
+
return;
|
|
1690
|
+
}
|
|
1691
|
+
const manifestPath = PROJECT_MANIFEST_ROOTS.map(
|
|
1692
|
+
(root) => (0, import_node_path3.join)(workspaceRoot, root, projectName, "package.json")
|
|
1693
|
+
).find((candidate) => fileExists(candidate));
|
|
1694
|
+
if (manifestPath === void 0) {
|
|
1695
|
+
return;
|
|
1696
|
+
}
|
|
1697
|
+
const manifest = readJson(manifestPath);
|
|
1698
|
+
const owned = manifest.dependencies ?? {};
|
|
1699
|
+
const moved = Object.fromEntries(added.map((name) => [name, after[name]]));
|
|
1700
|
+
writeFileEnsured(manifestPath, toJson({ ...manifest, dependencies: { ...moved, ...owned } }));
|
|
1701
|
+
const remaining = Object.fromEntries(
|
|
1702
|
+
Object.entries(after).filter(([name]) => !added.includes(name))
|
|
1703
|
+
);
|
|
1704
|
+
const rootManifest = readJson((0, import_node_path3.join)(workspaceRoot, "package.json"));
|
|
1705
|
+
const { dependencies: _dropped, ...rest } = rootManifest;
|
|
1706
|
+
writeFileEnsured(
|
|
1707
|
+
(0, import_node_path3.join)(workspaceRoot, "package.json"),
|
|
1708
|
+
toJson(Object.keys(remaining).length > 0 ? { ...rest, dependencies: remaining } : rest)
|
|
1709
|
+
);
|
|
1710
|
+
logger.step(`Moved ${added.join(", ")} into ${projectName}'s own manifest`);
|
|
1711
|
+
if (runShell(
|
|
1712
|
+
"npm",
|
|
1713
|
+
["install", "--package-lock-only", "--no-audit", "--no-fund"],
|
|
1714
|
+
workspaceRoot
|
|
1715
|
+
) !== 0) {
|
|
1716
|
+
logger.warn(
|
|
1717
|
+
`Could not refresh package-lock.json after moving ${added.join(", ")}. Run 'npm install'.`
|
|
1718
|
+
);
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1672
1721
|
|
|
1673
1722
|
// src/commands/add/flutter.ts
|
|
1674
1723
|
function addProjectJsonTargets(projectJsonPath, newTargets) {
|
|
@@ -2820,9 +2869,9 @@ function resolvedVersion(workspaceRoot, ecosystem, name) {
|
|
|
2820
2869
|
// src/deps/semver.ts
|
|
2821
2870
|
var UPDATE_KINDS = ["patch", "minor", "major", "non-semver"];
|
|
2822
2871
|
var UPDATE_KIND_LABELS = {
|
|
2823
|
-
patch: { title: "Patch Update", blurb: "Backwards-compatible bug fixes." },
|
|
2824
|
-
minor: { title: "Minor Update", blurb: "New backwards-compatible features." },
|
|
2825
|
-
major: { title: "Major Update", blurb: "Potentially breaking API changes. Use caution." },
|
|
2872
|
+
"patch": { title: "Patch Update", blurb: "Backwards-compatible bug fixes." },
|
|
2873
|
+
"minor": { title: "Minor Update", blurb: "New backwards-compatible features." },
|
|
2874
|
+
"major": { title: "Major Update", blurb: "Potentially breaking API changes. Use caution." },
|
|
2826
2875
|
"non-semver": { title: "Non-Semver", blurb: "Versions less than 1.0.0, caution." }
|
|
2827
2876
|
};
|
|
2828
2877
|
var RANGE_OPERATORS = [">=", "<=", "^", "~", ">", "<", "="];
|
|
@@ -3076,6 +3125,7 @@ async function runAdd(kind, name, options) {
|
|
|
3076
3125
|
});
|
|
3077
3126
|
const resolvedName = name ?? await promptText("Project name");
|
|
3078
3127
|
assertValidProjectName(resolvedName, "Project name");
|
|
3128
|
+
const rootDependenciesBefore = rootRuntimeDependencies(workspaceRoot);
|
|
3079
3129
|
switch (resolvedKind) {
|
|
3080
3130
|
case "react-app": {
|
|
3081
3131
|
addReactApp(workspaceRoot, resolvedName, stack);
|
|
@@ -3176,6 +3226,7 @@ async function runAdd(kind, name, options) {
|
|
|
3176
3226
|
);
|
|
3177
3227
|
}
|
|
3178
3228
|
}
|
|
3229
|
+
relocateRootRuntimeDependencies(workspaceRoot, resolvedName, rootDependenciesBefore);
|
|
3179
3230
|
syncProjectReferences(workspaceRoot);
|
|
3180
3231
|
runFormatter(workspaceRoot);
|
|
3181
3232
|
logger.success(`Added ${resolvedKind} '${resolvedName}'.`);
|