@mnci/cli 4.40.2 → 4.40.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 +283 -202
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3168,7 +3168,7 @@ function runPhase(phase, workspaceRoot, dependencies) {
|
|
|
3168
3168
|
}
|
|
3169
3169
|
|
|
3170
3170
|
// src/project-scaffolding/add-project.use-case.ts
|
|
3171
|
-
var
|
|
3171
|
+
var import_node_path33 = require("path");
|
|
3172
3172
|
var import_prompts3 = require("@inquirer/prompts");
|
|
3173
3173
|
|
|
3174
3174
|
// src/project-name/project-name.validator.ts
|
|
@@ -5076,11 +5076,65 @@ function addNodeFunctionApp(workspaceRoot, name, stack, empty = false) {
|
|
|
5076
5076
|
}
|
|
5077
5077
|
|
|
5078
5078
|
// src/project-scaffolding/npm-lib.use-case.ts
|
|
5079
|
-
var
|
|
5079
|
+
var import_node_path24 = require("path");
|
|
5080
5080
|
|
|
5081
|
-
// src/
|
|
5081
|
+
// src/lockfile-pruning/prune-stale-local-registry.use-case.ts
|
|
5082
|
+
var import_node_fs20 = require("fs");
|
|
5083
|
+
var import_node_path20 = require("path");
|
|
5084
|
+
|
|
5085
|
+
// src/lockfile-pruning/stale-local-registry.validator.ts
|
|
5082
5086
|
var import_node_fs19 = require("fs");
|
|
5083
5087
|
var import_node_path19 = require("path");
|
|
5088
|
+
var LOCAL_REGISTRY_PACKAGE = "verdaccio";
|
|
5089
|
+
var LOCAL_REGISTRY_LOCK_KEY = `node_modules/${LOCAL_REGISTRY_PACKAGE}`;
|
|
5090
|
+
var DEPENDENCY_FIELDS = ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"];
|
|
5091
|
+
function readJsonFile(path) {
|
|
5092
|
+
if (!(0, import_node_fs19.existsSync)(path)) {
|
|
5093
|
+
return void 0;
|
|
5094
|
+
}
|
|
5095
|
+
try {
|
|
5096
|
+
return JSON.parse((0, import_node_fs19.readFileSync)(path, "utf8"));
|
|
5097
|
+
} catch {
|
|
5098
|
+
return void 0;
|
|
5099
|
+
}
|
|
5100
|
+
}
|
|
5101
|
+
function declaresLocalRegistry(manifest) {
|
|
5102
|
+
return DEPENDENCY_FIELDS.some((field) => {
|
|
5103
|
+
const list = manifest?.[field];
|
|
5104
|
+
return list !== void 0 && Object.hasOwn(list, LOCAL_REGISTRY_PACKAGE);
|
|
5105
|
+
});
|
|
5106
|
+
}
|
|
5107
|
+
function hasStaleLocalRegistry(workspaceRoot) {
|
|
5108
|
+
const lock = readJsonFile((0, import_node_path19.join)(workspaceRoot, "package-lock.json"));
|
|
5109
|
+
const entries = lock?.packages ?? {};
|
|
5110
|
+
if (!Object.hasOwn(entries, LOCAL_REGISTRY_LOCK_KEY)) {
|
|
5111
|
+
return false;
|
|
5112
|
+
}
|
|
5113
|
+
const members = Object.keys(entries).filter((key) => key !== "" && !key.startsWith("node_modules/") && !key.includes("/node_modules/"));
|
|
5114
|
+
const manifests = ["", ...members].map((directory) => readJsonFile((0, import_node_path19.join)(workspaceRoot, directory, "package.json")));
|
|
5115
|
+
return manifests.every((manifest) => !declaresLocalRegistry(manifest));
|
|
5116
|
+
}
|
|
5117
|
+
|
|
5118
|
+
// src/lockfile-pruning/prune-stale-local-registry.use-case.ts
|
|
5119
|
+
function pruneStaleLocalRegistry(workspaceRoot, resolve2 = runShell) {
|
|
5120
|
+
if (!hasStaleLocalRegistry(workspaceRoot)) {
|
|
5121
|
+
return { stale: false, status: 0 };
|
|
5122
|
+
}
|
|
5123
|
+
const lockPath = (0, import_node_path20.join)(workspaceRoot, "package-lock.json");
|
|
5124
|
+
const lock = JSON.parse((0, import_node_fs20.readFileSync)(lockPath, "utf8"));
|
|
5125
|
+
Reflect.deleteProperty(lock.packages, LOCAL_REGISTRY_LOCK_KEY);
|
|
5126
|
+
const root = lock.packages[""];
|
|
5127
|
+
if (root?.devDependencies !== void 0) {
|
|
5128
|
+
Reflect.deleteProperty(root.devDependencies, LOCAL_REGISTRY_PACKAGE);
|
|
5129
|
+
}
|
|
5130
|
+
(0, import_node_fs20.writeFileSync)(lockPath, `${JSON.stringify(lock, void 0, 2)}
|
|
5131
|
+
`);
|
|
5132
|
+
return { stale: true, status: resolve2("npm", ["install", "--package-lock-only", "--ignore-scripts", "--no-audit", "--no-fund"], workspaceRoot) };
|
|
5133
|
+
}
|
|
5134
|
+
|
|
5135
|
+
// src/rollup-library/repair-publishable-manifest.use-case.ts
|
|
5136
|
+
var import_node_fs21 = require("fs");
|
|
5137
|
+
var import_node_path21 = require("path");
|
|
5084
5138
|
var WRONG_TYPES_PATH = "./dist/index.esm.d.ts";
|
|
5085
5139
|
var ACTUAL_TYPES_PATH = "./dist/src/index.d.ts";
|
|
5086
5140
|
var DECLARATION_MAP_EXCLUSION = "!**/*.d.ts.map";
|
|
@@ -5103,14 +5157,14 @@ function repairPublishableManifest(manifestPath) {
|
|
|
5103
5157
|
}
|
|
5104
5158
|
function repairPublishableManifests(workspaceRoot) {
|
|
5105
5159
|
const changed = [];
|
|
5106
|
-
const manifests = (0,
|
|
5160
|
+
const manifests = (0, import_node_fs21.globSync)(["packages/*/package.json", "libs/*/package.json"], {
|
|
5107
5161
|
cwd: workspaceRoot
|
|
5108
5162
|
});
|
|
5109
5163
|
for (const relativePath of manifests) {
|
|
5110
|
-
const manifestPath = (0,
|
|
5111
|
-
const before = (0,
|
|
5164
|
+
const manifestPath = (0, import_node_path21.join)(workspaceRoot, relativePath);
|
|
5165
|
+
const before = (0, import_node_fs21.readFileSync)(manifestPath, "utf8");
|
|
5112
5166
|
repairPublishableManifest(manifestPath);
|
|
5113
|
-
const after = (0,
|
|
5167
|
+
const after = (0, import_node_fs21.readFileSync)(manifestPath, "utf8");
|
|
5114
5168
|
if (after !== before) {
|
|
5115
5169
|
changed.push(relativePath.replaceAll("\\", "/"));
|
|
5116
5170
|
}
|
|
@@ -5119,8 +5173,8 @@ function repairPublishableManifests(workspaceRoot) {
|
|
|
5119
5173
|
}
|
|
5120
5174
|
|
|
5121
5175
|
// src/rollup-library/repair-rollup-config.use-case.ts
|
|
5122
|
-
var
|
|
5123
|
-
var
|
|
5176
|
+
var import_node_fs22 = require("fs");
|
|
5177
|
+
var import_node_path22 = require("path");
|
|
5124
5178
|
|
|
5125
5179
|
// src/rollup-library/rollup-config.algorithm.ts
|
|
5126
5180
|
var ROLLUP_CONFIG_PLACEHOLDER = [
|
|
@@ -5322,12 +5376,12 @@ function withUpgradedDeclarationSpecifierPlugin(config) {
|
|
|
5322
5376
|
// src/rollup-library/repair-rollup-config.use-case.ts
|
|
5323
5377
|
function repairRollupSourceMaps(workspaceRoot) {
|
|
5324
5378
|
const changed = [];
|
|
5325
|
-
const configs = (0,
|
|
5379
|
+
const configs = (0, import_node_fs22.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
|
|
5326
5380
|
cwd: workspaceRoot
|
|
5327
5381
|
});
|
|
5328
5382
|
for (const relativePath of configs) {
|
|
5329
|
-
const configPath = (0,
|
|
5330
|
-
const before = (0,
|
|
5383
|
+
const configPath = (0, import_node_path22.join)(workspaceRoot, relativePath);
|
|
5384
|
+
const before = (0, import_node_fs22.readFileSync)(configPath, "utf8");
|
|
5331
5385
|
const after = withRollupSourceMaps(before);
|
|
5332
5386
|
if (after !== before) {
|
|
5333
5387
|
writeFileEnsured(configPath, after);
|
|
@@ -5338,12 +5392,12 @@ function repairRollupSourceMaps(workspaceRoot) {
|
|
|
5338
5392
|
}
|
|
5339
5393
|
function upgradeDeclarationSpecifierPlugins(workspaceRoot) {
|
|
5340
5394
|
const changed = [];
|
|
5341
|
-
const configs = (0,
|
|
5395
|
+
const configs = (0, import_node_fs22.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
|
|
5342
5396
|
cwd: workspaceRoot
|
|
5343
5397
|
});
|
|
5344
5398
|
for (const relativePath of configs) {
|
|
5345
|
-
const configPath = (0,
|
|
5346
|
-
const before = (0,
|
|
5399
|
+
const configPath = (0, import_node_path22.join)(workspaceRoot, relativePath);
|
|
5400
|
+
const before = (0, import_node_fs22.readFileSync)(configPath, "utf8");
|
|
5347
5401
|
const after = withUpgradedDeclarationSpecifierPlugin(before);
|
|
5348
5402
|
if (after !== before) {
|
|
5349
5403
|
writeFileEnsured(configPath, after);
|
|
@@ -5353,11 +5407,11 @@ function upgradeDeclarationSpecifierPlugins(workspaceRoot) {
|
|
|
5353
5407
|
return changed;
|
|
5354
5408
|
}
|
|
5355
5409
|
function repairDeclarationSpecifiers(projectRoot) {
|
|
5356
|
-
const configPath = (0,
|
|
5410
|
+
const configPath = (0, import_node_path22.join)(projectRoot, "rollup.config.cjs");
|
|
5357
5411
|
if (!fileExists(configPath)) {
|
|
5358
5412
|
return;
|
|
5359
5413
|
}
|
|
5360
|
-
const config = (0,
|
|
5414
|
+
const config = (0, import_node_fs22.readFileSync)(configPath, "utf8");
|
|
5361
5415
|
if (!config.includes(ROLLUP_CONFIG_PLACEHOLDER)) {
|
|
5362
5416
|
return;
|
|
5363
5417
|
}
|
|
@@ -5366,10 +5420,10 @@ function repairDeclarationSpecifiers(projectRoot) {
|
|
|
5366
5420
|
}
|
|
5367
5421
|
|
|
5368
5422
|
// src/rollup-library/rollup-config.repository.ts
|
|
5369
|
-
var
|
|
5370
|
-
var
|
|
5423
|
+
var import_node_fs23 = require("fs");
|
|
5424
|
+
var import_node_path23 = require("path");
|
|
5371
5425
|
function resolveRequireTarget(fromDir, specifier) {
|
|
5372
|
-
const base = (0,
|
|
5426
|
+
const base = (0, import_node_path23.join)(fromDir, specifier);
|
|
5373
5427
|
return [base, `${base}.cjs`, `${base}.js`].find((candidate) => fileExists(candidate));
|
|
5374
5428
|
}
|
|
5375
5429
|
function resolveRollupConfigText(configPath, visited = /* @__PURE__ */ new Set()) {
|
|
@@ -5379,7 +5433,7 @@ function resolveRollupConfigText(configPath, visited = /* @__PURE__ */ new Set()
|
|
|
5379
5433
|
visited.add(configPath);
|
|
5380
5434
|
let text;
|
|
5381
5435
|
try {
|
|
5382
|
-
text = (0,
|
|
5436
|
+
text = (0, import_node_fs23.readFileSync)(configPath, "utf8");
|
|
5383
5437
|
} catch {
|
|
5384
5438
|
return "";
|
|
5385
5439
|
}
|
|
@@ -5387,15 +5441,15 @@ function resolveRollupConfigText(configPath, visited = /* @__PURE__ */ new Set()
|
|
|
5387
5441
|
text.matchAll(/require\((['"])(\.[^'"]*)\1\)/g),
|
|
5388
5442
|
(match) => match[2]
|
|
5389
5443
|
);
|
|
5390
|
-
const requiredText = specifiers.map((specifier) => resolveRequireTarget((0,
|
|
5444
|
+
const requiredText = specifiers.map((specifier) => resolveRequireTarget((0, import_node_path23.dirname)(configPath), specifier)).filter((target) => target !== void 0).map((target) => resolveRollupConfigText(target, visited));
|
|
5391
5445
|
return [text, ...requiredText].join("\n");
|
|
5392
5446
|
}
|
|
5393
5447
|
|
|
5394
5448
|
// src/project-scaffolding/npm-lib.use-case.ts
|
|
5395
5449
|
async function addNpmLib(workspaceRoot, name, options, kindProvided, stack) {
|
|
5396
5450
|
const scope = options.scope ?? (kindProvided ? defaultScope(workspaceRoot) : await promptText("npm scope for the published package", defaultScope(workspaceRoot)));
|
|
5397
|
-
const projectRoot = (0,
|
|
5398
|
-
const manifestPath = (0,
|
|
5451
|
+
const projectRoot = (0, import_node_path24.join)(workspaceRoot, "packages", name);
|
|
5452
|
+
const manifestPath = (0, import_node_path24.join)(projectRoot, "package.json");
|
|
5399
5453
|
runGeneratorAndRepair(
|
|
5400
5454
|
workspaceRoot,
|
|
5401
5455
|
[
|
|
@@ -5418,14 +5472,18 @@ async function addNpmLib(workspaceRoot, name, options, kindProvided, stack) {
|
|
|
5418
5472
|
renameScaffoldPlaceholder(projectRoot, name, options.empty === true);
|
|
5419
5473
|
removeGeneratedEslintConfig(workspaceRoot, `packages/${name}`);
|
|
5420
5474
|
removeLocalRegistryScaffolding(workspaceRoot);
|
|
5475
|
+
const pruned = pruneStaleLocalRegistry(workspaceRoot);
|
|
5476
|
+
if (pruned.stale && pruned.status !== 0) {
|
|
5477
|
+
logger.warn("Could not drop the unused local registry from package-lock.json: run `mnci upgrade` once the network is back.");
|
|
5478
|
+
}
|
|
5421
5479
|
registerProjectCommands(workspaceRoot, name, { build: true });
|
|
5422
5480
|
}
|
|
5423
5481
|
);
|
|
5424
5482
|
}
|
|
5425
5483
|
|
|
5426
5484
|
// src/project-scaffolding/python.use-case.ts
|
|
5427
|
-
var
|
|
5428
|
-
var
|
|
5485
|
+
var import_node_fs24 = require("fs");
|
|
5486
|
+
var import_node_path25 = require("path");
|
|
5429
5487
|
function ensurePython(workspaceRoot) {
|
|
5430
5488
|
const hasPython = runShell("python3", ["--version"], workspaceRoot) === 0 || runShell("python", ["--version"], workspaceRoot) === 0;
|
|
5431
5489
|
if (!hasPython) {
|
|
@@ -5448,7 +5506,7 @@ function ensurePythonPipPlugin(workspaceRoot) {
|
|
|
5448
5506
|
registerPythonGraphPlugin(workspaceRoot);
|
|
5449
5507
|
}
|
|
5450
5508
|
function registerPythonGraphPlugin(workspaceRoot) {
|
|
5451
|
-
const nxJsonPath = (0,
|
|
5509
|
+
const nxJsonPath = (0, import_node_path25.join)(workspaceRoot, "nx.json");
|
|
5452
5510
|
if (!fileExists(nxJsonPath)) {
|
|
5453
5511
|
return;
|
|
5454
5512
|
}
|
|
@@ -5471,7 +5529,7 @@ pytest
|
|
|
5471
5529
|
pip-audit
|
|
5472
5530
|
`;
|
|
5473
5531
|
function ensureRequirementsDev(workspaceRoot) {
|
|
5474
|
-
const requirementsDevPath = (0,
|
|
5532
|
+
const requirementsDevPath = (0, import_node_path25.join)(workspaceRoot, "requirements-dev.txt");
|
|
5475
5533
|
if (!fileExists(requirementsDevPath)) {
|
|
5476
5534
|
writeFileEnsured(requirementsDevPath, PYTHON_REQUIREMENTS_DEV);
|
|
5477
5535
|
}
|
|
@@ -5531,8 +5589,8 @@ function addPythonApp(workspaceRoot, name) {
|
|
|
5531
5589
|
["g", "@mnci/nx-python-pip:application", name, `--directory=apps/${name}`, "--no-interactive"],
|
|
5532
5590
|
workspaceRoot
|
|
5533
5591
|
);
|
|
5534
|
-
writeFileEnsured((0,
|
|
5535
|
-
addProjectJsonTargets((0,
|
|
5592
|
+
writeFileEnsured((0, import_node_path25.join)(workspaceRoot, "apps", name, "main.py"), pythonAppMain(name));
|
|
5593
|
+
addProjectJsonTargets((0, import_node_path25.join)(workspaceRoot, "apps", name, "project.json"), {
|
|
5536
5594
|
package: pythonAppPackageTarget(name),
|
|
5537
5595
|
start: pythonAppStartTarget(name)
|
|
5538
5596
|
});
|
|
@@ -5554,7 +5612,7 @@ function addPythonFunctionApp(workspaceRoot, name) {
|
|
|
5554
5612
|
workspaceRoot
|
|
5555
5613
|
);
|
|
5556
5614
|
const moduleDirectory = pythonModuleDirectory(name);
|
|
5557
|
-
addProjectJsonTargets((0,
|
|
5615
|
+
addProjectJsonTargets((0, import_node_path25.join)(workspaceRoot, "apps", name, "project.json"), {
|
|
5558
5616
|
package: pythonFunctionAppPackageTarget(name, moduleDirectory),
|
|
5559
5617
|
start: pythonFunctionAppStartTarget(name)
|
|
5560
5618
|
});
|
|
@@ -5595,7 +5653,7 @@ function addPythonInternalLib(workspaceRoot, name) {
|
|
|
5595
5653
|
var PYTHON_PROJECT_DIRS = ["apps", "python-packages", "libs"];
|
|
5596
5654
|
function findPythonProjectDirectory(workspaceRoot, name) {
|
|
5597
5655
|
return PYTHON_PROJECT_DIRS.find(
|
|
5598
|
-
(directory) => fileExists((0,
|
|
5656
|
+
(directory) => fileExists((0, import_node_path25.join)(workspaceRoot, directory, name, "pyproject.toml"))
|
|
5599
5657
|
);
|
|
5600
5658
|
}
|
|
5601
5659
|
function parseVendorEntries(pyprojectToml) {
|
|
@@ -5634,7 +5692,7 @@ async function addPythonVendor(workspaceRoot, consumer, options, kindProvided) {
|
|
|
5634
5692
|
`No Python project named '${consumer}' with a pyproject.toml found (checked apps/, python-packages/, libs/). A Python function app has no pyproject.toml \u2014 there is nothing to vendor into.`
|
|
5635
5693
|
);
|
|
5636
5694
|
}
|
|
5637
|
-
if (!fileExists((0,
|
|
5695
|
+
if (!fileExists((0, import_node_path25.join)(workspaceRoot, "libs", lib, "pyproject.toml"))) {
|
|
5638
5696
|
throw new Error(
|
|
5639
5697
|
`No internal Python library named '${lib}' found at libs/${lib}/pyproject.toml. Only an internal library (added via 'mnci add python-internal-lib') can be vendored.`
|
|
5640
5698
|
);
|
|
@@ -5642,8 +5700,8 @@ async function addPythonVendor(workspaceRoot, consumer, options, kindProvided) {
|
|
|
5642
5700
|
if (consumerDirectory === "libs" && consumer === lib) {
|
|
5643
5701
|
throw new Error(`'${consumer}' cannot vendor itself.`);
|
|
5644
5702
|
}
|
|
5645
|
-
const pyprojectPath = (0,
|
|
5646
|
-
const pyprojectToml = (0,
|
|
5703
|
+
const pyprojectPath = (0, import_node_path25.join)(workspaceRoot, consumerDirectory, consumer, "pyproject.toml");
|
|
5704
|
+
const pyprojectToml = (0, import_node_fs24.readFileSync)(pyprojectPath, "utf8");
|
|
5647
5705
|
if (parseVendorEntries(pyprojectToml).includes(lib)) {
|
|
5648
5706
|
logger.info(`'${consumer}' already vendors '${lib}' \u2014 nothing to do.`);
|
|
5649
5707
|
return;
|
|
@@ -5655,8 +5713,8 @@ async function addPythonVendor(workspaceRoot, consumer, options, kindProvided) {
|
|
|
5655
5713
|
}
|
|
5656
5714
|
|
|
5657
5715
|
// src/project-scaffolding/react-app.use-case.ts
|
|
5658
|
-
var
|
|
5659
|
-
var
|
|
5716
|
+
var import_node_fs25 = require("fs");
|
|
5717
|
+
var import_node_path26 = require("path");
|
|
5660
5718
|
|
|
5661
5719
|
// src/project-scaffolding/react-app-example.algorithm.ts
|
|
5662
5720
|
function reactAppExampleFiles(name) {
|
|
@@ -5773,12 +5831,12 @@ function reactAppTargets(name) {
|
|
|
5773
5831
|
return targets;
|
|
5774
5832
|
}
|
|
5775
5833
|
function allowEnvFiles(workspaceRoot) {
|
|
5776
|
-
const gitignorePath = (0,
|
|
5834
|
+
const gitignorePath = (0, import_node_path26.join)(workspaceRoot, ".gitignore");
|
|
5777
5835
|
if (!fileExists(gitignorePath)) {
|
|
5778
5836
|
return;
|
|
5779
5837
|
}
|
|
5780
5838
|
const marker = "# MoNecromanCI: keep the committed per-environment Vite config (public VITE_ values)";
|
|
5781
|
-
const current = (0,
|
|
5839
|
+
const current = (0, import_node_fs25.readFileSync)(gitignorePath, "utf8");
|
|
5782
5840
|
if (current.includes(marker)) {
|
|
5783
5841
|
return;
|
|
5784
5842
|
}
|
|
@@ -5805,30 +5863,30 @@ function addReactApp(workspaceRoot, name, stack) {
|
|
|
5805
5863
|
workspaceRoot
|
|
5806
5864
|
);
|
|
5807
5865
|
ensureAdmZip(workspaceRoot);
|
|
5808
|
-
const reactAppRoot = (0,
|
|
5866
|
+
const reactAppRoot = (0, import_node_path26.join)(workspaceRoot, "apps", name);
|
|
5809
5867
|
for (const environment of REACT_ENVIRONMENTS) {
|
|
5810
|
-
writeFileEnsured((0,
|
|
5868
|
+
writeFileEnsured((0, import_node_path26.join)(reactAppRoot, `.env.${environment}`), reactEnvironmentFile(environment));
|
|
5811
5869
|
}
|
|
5812
5870
|
allowEnvFiles(workspaceRoot);
|
|
5813
|
-
addNxTargets((0,
|
|
5871
|
+
addNxTargets((0, import_node_path26.join)(reactAppRoot, "package.json"), reactAppTargets(name));
|
|
5814
5872
|
reshapeReactAppScaffold(reactAppRoot);
|
|
5815
|
-
(0,
|
|
5873
|
+
(0, import_node_fs25.rmSync)((0, import_node_path26.join)(reactAppRoot, "src/app/nx-welcome.component.tsx"), { force: true });
|
|
5816
5874
|
const example = reactAppExampleFiles(name);
|
|
5817
5875
|
for (const [relative, contents] of Object.entries(example)) {
|
|
5818
|
-
writeFileEnsured((0,
|
|
5876
|
+
writeFileEnsured((0, import_node_path26.join)(reactAppRoot, "src", relative), contents);
|
|
5819
5877
|
}
|
|
5820
5878
|
removeGeneratedEslintConfig(workspaceRoot, `apps/${name}`);
|
|
5821
5879
|
registerProjectCommands(workspaceRoot, name, { build: true, start: `nx run ${name}:serve` });
|
|
5822
5880
|
}
|
|
5823
5881
|
|
|
5824
5882
|
// src/project-scaffolding/react-lib.use-case.ts
|
|
5825
|
-
var
|
|
5883
|
+
var import_node_path27 = require("path");
|
|
5826
5884
|
var REACT_LIB_BUNDLER = "rollup";
|
|
5827
5885
|
async function addReactLib(workspaceRoot, name, options, kindProvided, stack) {
|
|
5828
5886
|
ensurePlugin(workspaceRoot, "@nx/react");
|
|
5829
5887
|
const scope = options.scope ?? (kindProvided ? defaultScope(workspaceRoot) : await promptText("npm scope for the published package", defaultScope(workspaceRoot)));
|
|
5830
|
-
const projectRoot = (0,
|
|
5831
|
-
const publishableManifest = (0,
|
|
5888
|
+
const projectRoot = (0, import_node_path27.join)(workspaceRoot, "packages", name);
|
|
5889
|
+
const publishableManifest = (0, import_node_path27.join)(projectRoot, "package.json");
|
|
5832
5890
|
runGeneratorAndRepair(
|
|
5833
5891
|
workspaceRoot,
|
|
5834
5892
|
[
|
|
@@ -5852,14 +5910,18 @@ async function addReactLib(workspaceRoot, name, options, kindProvided, stack) {
|
|
|
5852
5910
|
reshapeReactScaffold(projectRoot, name, options.empty === true);
|
|
5853
5911
|
removeGeneratedEslintConfig(workspaceRoot, `packages/${name}`);
|
|
5854
5912
|
removeLocalRegistryScaffolding(workspaceRoot);
|
|
5913
|
+
const pruned = pruneStaleLocalRegistry(workspaceRoot);
|
|
5914
|
+
if (pruned.stale && pruned.status !== 0) {
|
|
5915
|
+
logger.warn("Could not drop the unused local registry from package-lock.json: run `mnci upgrade` once the network is back.");
|
|
5916
|
+
}
|
|
5855
5917
|
registerProjectCommands(workspaceRoot, name, { build: true });
|
|
5856
5918
|
}
|
|
5857
5919
|
);
|
|
5858
5920
|
}
|
|
5859
5921
|
function addReactInternalLib(workspaceRoot, name, stack, empty = false) {
|
|
5860
5922
|
ensurePlugin(workspaceRoot, "@nx/react");
|
|
5861
|
-
const projectRoot = (0,
|
|
5862
|
-
const privateManifest = (0,
|
|
5923
|
+
const projectRoot = (0, import_node_path27.join)(workspaceRoot, "libs", name);
|
|
5924
|
+
const privateManifest = (0, import_node_path27.join)(projectRoot, "package.json");
|
|
5863
5925
|
runGeneratorAndRepair(
|
|
5864
5926
|
workspaceRoot,
|
|
5865
5927
|
[
|
|
@@ -5886,8 +5948,8 @@ function addReactInternalLib(workspaceRoot, name, stack, empty = false) {
|
|
|
5886
5948
|
}
|
|
5887
5949
|
|
|
5888
5950
|
// src/project-scaffolding/vscode-extension.use-case.ts
|
|
5889
|
-
var
|
|
5890
|
-
var
|
|
5951
|
+
var import_node_fs26 = require("fs");
|
|
5952
|
+
var import_node_path28 = require("path");
|
|
5891
5953
|
var VSCODE_EXTENSION_SCRIPT_PATH = "tools/vscode-extension.cjs";
|
|
5892
5954
|
var VSCODE_ENGINE_FLOOR = "1.96.0";
|
|
5893
5955
|
var VSCODE_SIDECAR_TARGETS = {
|
|
@@ -6072,8 +6134,8 @@ export const window = {
|
|
|
6072
6134
|
var VSCODE_STUB_PATH = "test/vscode.stub.ts";
|
|
6073
6135
|
function mapVscodeToStub(projectRoot, testRunner) {
|
|
6074
6136
|
const [file, anchor, mapping] = testRunner === "jest" ? ["jest.config.cts", "testEnvironment: 'node',", `moduleNameMapper: { '^vscode$': '<rootDir>/${VSCODE_STUB_PATH}' },`] : ["vitest.config.mts", "environment: 'node',", `alias: { vscode: \`\${import.meta.dirname}/${VSCODE_STUB_PATH}\` },`];
|
|
6075
|
-
const path = (0,
|
|
6076
|
-
const content = fileExists(path) ? (0,
|
|
6137
|
+
const path = (0, import_node_path28.join)(projectRoot, file);
|
|
6138
|
+
const content = fileExists(path) ? (0, import_node_fs26.readFileSync)(path, "utf8") : "";
|
|
6077
6139
|
const line = content.split("\n").find((candidate) => candidate.trim() === anchor);
|
|
6078
6140
|
if (line === void 0) {
|
|
6079
6141
|
throw new Error(`${file} has no "${anchor}" line to map the vscode module after; map 'vscode' to ${VSCODE_STUB_PATH} by hand.`);
|
|
@@ -6093,11 +6155,11 @@ function ensureVscodeToolchain(workspaceRoot) {
|
|
|
6093
6155
|
}
|
|
6094
6156
|
}
|
|
6095
6157
|
function defaultPublisher(workspaceRoot) {
|
|
6096
|
-
const { name } = readJson((0,
|
|
6158
|
+
const { name } = readJson((0, import_node_path28.join)(workspaceRoot, "package.json"));
|
|
6097
6159
|
return (name ?? "publisher").replace(/^@/, "").split("/", 1)[0];
|
|
6098
6160
|
}
|
|
6099
6161
|
function reshapeManifest(projectRoot, name, publisher) {
|
|
6100
|
-
const manifestPath = (0,
|
|
6162
|
+
const manifestPath = (0, import_node_path28.join)(projectRoot, "package.json");
|
|
6101
6163
|
const manifest = readJson(manifestPath);
|
|
6102
6164
|
const { nx = {}, ...rest } = manifest;
|
|
6103
6165
|
const targets = { ...nx.targets };
|
|
@@ -6161,11 +6223,11 @@ function vscodeExtensionPublishTarget(name, sidecar) {
|
|
|
6161
6223
|
};
|
|
6162
6224
|
}
|
|
6163
6225
|
function addDebugLaunch(workspaceRoot, name) {
|
|
6164
|
-
const file = (0,
|
|
6226
|
+
const file = (0, import_node_fs26.readdirSync)(workspaceRoot).find((entry) => entry.endsWith(".code-workspace"));
|
|
6165
6227
|
if (file === void 0) {
|
|
6166
6228
|
return;
|
|
6167
6229
|
}
|
|
6168
|
-
const path = (0,
|
|
6230
|
+
const path = (0, import_node_path28.join)(workspaceRoot, file);
|
|
6169
6231
|
const workspace = readCodeWorkspace(path) ?? {};
|
|
6170
6232
|
const folder = `\${workspaceFolder:${workspace.folders?.[0]?.name ?? file.replace(/\.code-workspace$/, "")}}`;
|
|
6171
6233
|
const taskLabel = `${name}: build (development)`;
|
|
@@ -6198,39 +6260,39 @@ function addDebugLaunch(workspaceRoot, name) {
|
|
|
6198
6260
|
);
|
|
6199
6261
|
}
|
|
6200
6262
|
function refreshVscodeExtensionScript(workspaceRoot) {
|
|
6201
|
-
const apps = (0,
|
|
6263
|
+
const apps = (0, import_node_path28.join)(workspaceRoot, "apps");
|
|
6202
6264
|
let entries;
|
|
6203
6265
|
try {
|
|
6204
|
-
entries = (0,
|
|
6266
|
+
entries = (0, import_node_fs26.readdirSync)(apps);
|
|
6205
6267
|
} catch {
|
|
6206
6268
|
return false;
|
|
6207
6269
|
}
|
|
6208
6270
|
const hasExtension = entries.some((entry) => {
|
|
6209
|
-
const manifestPath = (0,
|
|
6271
|
+
const manifestPath = (0, import_node_path28.join)(apps, entry, "package.json");
|
|
6210
6272
|
if (!fileExists(manifestPath)) {
|
|
6211
6273
|
return false;
|
|
6212
6274
|
}
|
|
6213
6275
|
const tags = readJson(manifestPath).nx?.tags ?? [];
|
|
6214
6276
|
return tags.includes(VSCODE_EXTENSION_TAG);
|
|
6215
6277
|
});
|
|
6216
|
-
const path = (0,
|
|
6217
|
-
if (!hasExtension || fileExists(path) && (0,
|
|
6278
|
+
const path = (0, import_node_path28.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH);
|
|
6279
|
+
if (!hasExtension || fileExists(path) && (0, import_node_fs26.readFileSync)(path, "utf8") === VSCODE_EXTENSION_SCRIPT) {
|
|
6218
6280
|
return false;
|
|
6219
6281
|
}
|
|
6220
6282
|
writeFileEnsured(path, VSCODE_EXTENSION_SCRIPT);
|
|
6221
6283
|
return true;
|
|
6222
6284
|
}
|
|
6223
6285
|
function pinVscodeExtensionProjectNames(workspaceRoot) {
|
|
6224
|
-
const apps = (0,
|
|
6286
|
+
const apps = (0, import_node_path28.join)(workspaceRoot, "apps");
|
|
6225
6287
|
let entries;
|
|
6226
6288
|
try {
|
|
6227
|
-
entries = (0,
|
|
6289
|
+
entries = (0, import_node_fs26.readdirSync)(apps);
|
|
6228
6290
|
} catch {
|
|
6229
6291
|
return [];
|
|
6230
6292
|
}
|
|
6231
6293
|
const updated = [];
|
|
6232
6294
|
for (const entry of entries) {
|
|
6233
|
-
const manifestPath = (0,
|
|
6295
|
+
const manifestPath = (0, import_node_path28.join)(apps, entry, "package.json");
|
|
6234
6296
|
if (!fileExists(manifestPath)) {
|
|
6235
6297
|
continue;
|
|
6236
6298
|
}
|
|
@@ -6250,22 +6312,22 @@ function refreshLockFile(workspaceRoot, name) {
|
|
|
6250
6312
|
}
|
|
6251
6313
|
function addVscodeExtension(workspaceRoot, name, stack, options = {}) {
|
|
6252
6314
|
const { sidecar } = options;
|
|
6253
|
-
if (sidecar !== void 0 && !fileExists((0,
|
|
6315
|
+
if (sidecar !== void 0 && !fileExists((0, import_node_path28.join)(workspaceRoot, "apps", sidecar, "project.json"))) {
|
|
6254
6316
|
throw new Error(`--sidecar ${sidecar}: no Go app at apps/${sidecar}. Add it first with \`mnci add go-app ${sidecar}\`.`);
|
|
6255
6317
|
}
|
|
6256
6318
|
runNodeApp(workspaceRoot, name, stack, "none");
|
|
6257
6319
|
ensureVscodeToolchain(workspaceRoot);
|
|
6258
|
-
const projectRoot = (0,
|
|
6320
|
+
const projectRoot = (0, import_node_path28.join)(workspaceRoot, "apps", name);
|
|
6259
6321
|
reshapeManifest(projectRoot, name, options.publisher ?? defaultPublisher(workspaceRoot));
|
|
6260
|
-
addVscodeTypes((0,
|
|
6261
|
-
addVscodeTypes((0,
|
|
6262
|
-
writeFileEnsured((0,
|
|
6263
|
-
writeFileEnsured((0,
|
|
6264
|
-
writeFileEnsured((0,
|
|
6322
|
+
addVscodeTypes((0, import_node_path28.join)(projectRoot, "tsconfig.app.json"));
|
|
6323
|
+
addVscodeTypes((0, import_node_path28.join)(projectRoot, "tsconfig.spec.json"));
|
|
6324
|
+
writeFileEnsured((0, import_node_path28.join)(projectRoot, "src/main.ts"), vscodeExtensionMain(name));
|
|
6325
|
+
writeFileEnsured((0, import_node_path28.join)(projectRoot, "src/main.spec.ts"), vscodeExtensionMainSpec(name));
|
|
6326
|
+
writeFileEnsured((0, import_node_path28.join)(projectRoot, VSCODE_STUB_PATH), VSCODE_STUB);
|
|
6265
6327
|
mapVscodeToStub(projectRoot, stack.testRunner);
|
|
6266
|
-
writeFileEnsured((0,
|
|
6267
|
-
writeFileEnsured((0,
|
|
6268
|
-
addNxTargets((0,
|
|
6328
|
+
writeFileEnsured((0, import_node_path28.join)(projectRoot, ".vscodeignore"), VSCODE_IGNORE);
|
|
6329
|
+
writeFileEnsured((0, import_node_path28.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH), VSCODE_EXTENSION_SCRIPT);
|
|
6330
|
+
addNxTargets((0, import_node_path28.join)(projectRoot, "package.json"), {
|
|
6269
6331
|
"package": vscodeExtensionPackageTarget(name, sidecar),
|
|
6270
6332
|
"nx-release-publish": vscodeExtensionPublishTarget(name, sidecar)
|
|
6271
6333
|
});
|
|
@@ -6276,12 +6338,12 @@ function addVscodeExtension(workspaceRoot, name, stack, options = {}) {
|
|
|
6276
6338
|
}
|
|
6277
6339
|
|
|
6278
6340
|
// src/dependency-management/install-dependencies.use-case.ts
|
|
6279
|
-
var
|
|
6280
|
-
var
|
|
6341
|
+
var import_node_fs28 = require("fs");
|
|
6342
|
+
var import_node_path30 = require("path");
|
|
6281
6343
|
|
|
6282
6344
|
// src/dependency-management/manifest.repository.ts
|
|
6283
|
-
var
|
|
6284
|
-
var
|
|
6345
|
+
var import_node_fs27 = require("fs");
|
|
6346
|
+
var import_node_path29 = require("path");
|
|
6285
6347
|
var ECOSYSTEMS = ["npm", "pip", "pub", "nuget", "go"];
|
|
6286
6348
|
var ROOT_LABEL = "(root)";
|
|
6287
6349
|
var MANIFEST_GLOBS = {
|
|
@@ -6314,23 +6376,23 @@ function projectOf(manifestRelativePath) {
|
|
|
6314
6376
|
}
|
|
6315
6377
|
function hasEcosystem(workspaceRoot, ecosystem) {
|
|
6316
6378
|
if (ecosystem === "go") {
|
|
6317
|
-
return fileExists((0,
|
|
6379
|
+
return fileExists((0, import_node_path29.join)(workspaceRoot, "go.mod"));
|
|
6318
6380
|
}
|
|
6319
6381
|
if (ecosystem === "nuget") {
|
|
6320
|
-
return (0,
|
|
6382
|
+
return (0, import_node_fs27.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot }).length > 0;
|
|
6321
6383
|
}
|
|
6322
6384
|
const rootMarker = {
|
|
6323
6385
|
npm: "package.json",
|
|
6324
6386
|
pip: "requirements-dev.txt",
|
|
6325
6387
|
pub: "pubspec.yaml"
|
|
6326
6388
|
};
|
|
6327
|
-
return fileExists((0,
|
|
6389
|
+
return fileExists((0, import_node_path29.join)(workspaceRoot, rootMarker[ecosystem])) || (0, import_node_fs27.globSync)(MANIFEST_GLOBS[ecosystem], { cwd: workspaceRoot }).length > 0;
|
|
6328
6390
|
}
|
|
6329
6391
|
function collectNpm(workspaceRoot) {
|
|
6330
6392
|
const sites = [];
|
|
6331
|
-
const relativePaths = ["package.json", ...(0,
|
|
6393
|
+
const relativePaths = ["package.json", ...(0, import_node_fs27.globSync)(MANIFEST_GLOBS.npm, { cwd: workspaceRoot })];
|
|
6332
6394
|
for (const relativePath of relativePaths) {
|
|
6333
|
-
const manifestPath = (0,
|
|
6395
|
+
const manifestPath = (0, import_node_path29.join)(workspaceRoot, relativePath);
|
|
6334
6396
|
try {
|
|
6335
6397
|
const manifest = readJson(manifestPath);
|
|
6336
6398
|
sites.push(...npmManifestSites(manifest, relativePath, manifestPath));
|
|
@@ -6391,17 +6453,17 @@ function collectPip(workspaceRoot) {
|
|
|
6391
6453
|
name: parsed.name,
|
|
6392
6454
|
ecosystem: "pip",
|
|
6393
6455
|
project: projectOf(relativePath),
|
|
6394
|
-
manifestPath: (0,
|
|
6456
|
+
manifestPath: (0, import_node_path29.join)(workspaceRoot, relativePath),
|
|
6395
6457
|
section,
|
|
6396
6458
|
spec: parsed.spec,
|
|
6397
6459
|
rewritable: parsed.rewritable && parsed.spec !== ""
|
|
6398
6460
|
});
|
|
6399
6461
|
};
|
|
6400
|
-
const pyprojectPaths = (0,
|
|
6462
|
+
const pyprojectPaths = (0, import_node_fs27.globSync)(MANIFEST_GLOBS.pip, { cwd: workspaceRoot });
|
|
6401
6463
|
for (const relativePath of pyprojectPaths) {
|
|
6402
6464
|
let content;
|
|
6403
6465
|
try {
|
|
6404
|
-
content = (0,
|
|
6466
|
+
content = (0, import_node_fs27.readFileSync)((0, import_node_path29.join)(workspaceRoot, relativePath), "utf8");
|
|
6405
6467
|
} catch {
|
|
6406
6468
|
continue;
|
|
6407
6469
|
}
|
|
@@ -6412,14 +6474,14 @@ function collectPip(workspaceRoot) {
|
|
|
6412
6474
|
}
|
|
6413
6475
|
const requirementsPaths = [
|
|
6414
6476
|
"requirements-dev.txt",
|
|
6415
|
-
...(0,
|
|
6477
|
+
...(0, import_node_fs27.globSync)("apps/*/requirements.txt", { cwd: workspaceRoot })
|
|
6416
6478
|
];
|
|
6417
6479
|
for (const relativePath of requirementsPaths) {
|
|
6418
|
-
if (!fileExists((0,
|
|
6480
|
+
if (!fileExists((0, import_node_path29.join)(workspaceRoot, relativePath))) {
|
|
6419
6481
|
continue;
|
|
6420
6482
|
}
|
|
6421
6483
|
const section = relativePath === "requirements-dev.txt" ? "devDep" : "dep";
|
|
6422
|
-
const lines = (0,
|
|
6484
|
+
const lines = (0, import_node_fs27.readFileSync)((0, import_node_path29.join)(workspaceRoot, relativePath), "utf8").split(/\r?\n/);
|
|
6423
6485
|
for (const line of lines) {
|
|
6424
6486
|
push(relativePath, section, line);
|
|
6425
6487
|
}
|
|
@@ -6457,11 +6519,11 @@ function pyprojectDependencies(content) {
|
|
|
6457
6519
|
}
|
|
6458
6520
|
function collectPub(workspaceRoot) {
|
|
6459
6521
|
const sites = [];
|
|
6460
|
-
const pubspecPaths = (0,
|
|
6522
|
+
const pubspecPaths = (0, import_node_fs27.globSync)(MANIFEST_GLOBS.pub, { cwd: workspaceRoot });
|
|
6461
6523
|
for (const relativePath of pubspecPaths) {
|
|
6462
6524
|
let content;
|
|
6463
6525
|
try {
|
|
6464
|
-
content = (0,
|
|
6526
|
+
content = (0, import_node_fs27.readFileSync)((0, import_node_path29.join)(workspaceRoot, relativePath), "utf8");
|
|
6465
6527
|
} catch {
|
|
6466
6528
|
continue;
|
|
6467
6529
|
}
|
|
@@ -6471,7 +6533,7 @@ function collectPub(workspaceRoot) {
|
|
|
6471
6533
|
name: entry.name,
|
|
6472
6534
|
ecosystem: "pub",
|
|
6473
6535
|
project: projectOf(relativePath),
|
|
6474
|
-
manifestPath: (0,
|
|
6536
|
+
manifestPath: (0, import_node_path29.join)(workspaceRoot, relativePath),
|
|
6475
6537
|
section: block === "dependencies" ? "dep" : "devDep",
|
|
6476
6538
|
spec: entry.spec,
|
|
6477
6539
|
rewritable: entry.spec !== ""
|
|
@@ -6521,11 +6583,11 @@ function stripQuotes(value) {
|
|
|
6521
6583
|
}
|
|
6522
6584
|
function collectNuget(workspaceRoot) {
|
|
6523
6585
|
const sites = [];
|
|
6524
|
-
const csprojPaths = (0,
|
|
6586
|
+
const csprojPaths = (0, import_node_fs27.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot });
|
|
6525
6587
|
for (const relativePath of csprojPaths) {
|
|
6526
6588
|
let content;
|
|
6527
6589
|
try {
|
|
6528
|
-
content = (0,
|
|
6590
|
+
content = (0, import_node_fs27.readFileSync)((0, import_node_path29.join)(workspaceRoot, relativePath), "utf8");
|
|
6529
6591
|
} catch {
|
|
6530
6592
|
continue;
|
|
6531
6593
|
}
|
|
@@ -6534,7 +6596,7 @@ function collectNuget(workspaceRoot) {
|
|
|
6534
6596
|
name: entry.name,
|
|
6535
6597
|
ecosystem: "nuget",
|
|
6536
6598
|
project: projectOf(relativePath),
|
|
6537
|
-
manifestPath: (0,
|
|
6599
|
+
manifestPath: (0, import_node_path29.join)(workspaceRoot, relativePath),
|
|
6538
6600
|
section: "dep",
|
|
6539
6601
|
spec: entry.spec,
|
|
6540
6602
|
// A plain SemVer string is rewritable; an MSBuild property reference
|
|
@@ -6559,13 +6621,13 @@ function csprojPackageReferences(content) {
|
|
|
6559
6621
|
return entries;
|
|
6560
6622
|
}
|
|
6561
6623
|
function collectGo(workspaceRoot) {
|
|
6562
|
-
const manifestPath = (0,
|
|
6624
|
+
const manifestPath = (0, import_node_path29.join)(workspaceRoot, "go.mod");
|
|
6563
6625
|
if (!fileExists(manifestPath)) {
|
|
6564
6626
|
return [];
|
|
6565
6627
|
}
|
|
6566
6628
|
let content;
|
|
6567
6629
|
try {
|
|
6568
|
-
content = (0,
|
|
6630
|
+
content = (0, import_node_fs27.readFileSync)(manifestPath, "utf8");
|
|
6569
6631
|
} catch {
|
|
6570
6632
|
return [];
|
|
6571
6633
|
}
|
|
@@ -6614,7 +6676,7 @@ var PROJECT_GLOBS = {
|
|
|
6614
6676
|
function locateProjects(workspaceRoot) {
|
|
6615
6677
|
const locations = [];
|
|
6616
6678
|
for (const ecosystem of ECOSYSTEMS) {
|
|
6617
|
-
const relativePaths = (0,
|
|
6679
|
+
const relativePaths = (0, import_node_fs27.globSync)(PROJECT_GLOBS[ecosystem], { cwd: workspaceRoot });
|
|
6618
6680
|
for (const relativePath of relativePaths) {
|
|
6619
6681
|
const posix = toPosix(relativePath);
|
|
6620
6682
|
const dir = posix.slice(0, posix.lastIndexOf("/"));
|
|
@@ -6622,7 +6684,7 @@ function locateProjects(workspaceRoot) {
|
|
|
6622
6684
|
ecosystem,
|
|
6623
6685
|
dir,
|
|
6624
6686
|
name: dir.slice(dir.lastIndexOf("/") + 1),
|
|
6625
|
-
manifestPath: (0,
|
|
6687
|
+
manifestPath: (0, import_node_path29.join)(workspaceRoot, relativePath)
|
|
6626
6688
|
});
|
|
6627
6689
|
}
|
|
6628
6690
|
}
|
|
@@ -6643,7 +6705,7 @@ function rewriteSpec(site, spec) {
|
|
|
6643
6705
|
writeFileEnsured(site.manifestPath, toJson(manifest));
|
|
6644
6706
|
return true;
|
|
6645
6707
|
}
|
|
6646
|
-
const before = (0,
|
|
6708
|
+
const before = (0, import_node_fs27.readFileSync)(site.manifestPath, "utf8");
|
|
6647
6709
|
const after = (() => {
|
|
6648
6710
|
switch (site.ecosystem) {
|
|
6649
6711
|
case "pip": {
|
|
@@ -6734,13 +6796,13 @@ function escapeForRegex(value) {
|
|
|
6734
6796
|
function isWorkspaceProject(workspaceRoot, name) {
|
|
6735
6797
|
const short = name.includes("/") ? name.split("/").at(-1) : name;
|
|
6736
6798
|
return ["apps", "libs", "packages"].some(
|
|
6737
|
-
(directory) => fileExists((0,
|
|
6799
|
+
(directory) => fileExists((0, import_node_path29.join)(workspaceRoot, directory, short ?? name, "package.json"))
|
|
6738
6800
|
);
|
|
6739
6801
|
}
|
|
6740
6802
|
function isAliasedInstall(workspaceRoot, name) {
|
|
6741
6803
|
try {
|
|
6742
6804
|
const installed = readJson(
|
|
6743
|
-
(0,
|
|
6805
|
+
(0, import_node_path29.join)(workspaceRoot, "node_modules", name, "package.json")
|
|
6744
6806
|
);
|
|
6745
6807
|
return installed.name !== void 0 && installed.name !== name;
|
|
6746
6808
|
} catch {
|
|
@@ -6751,14 +6813,14 @@ function resolvedVersion(workspaceRoot, ecosystem, name) {
|
|
|
6751
6813
|
if (ecosystem === "npm") {
|
|
6752
6814
|
try {
|
|
6753
6815
|
return readJson(
|
|
6754
|
-
(0,
|
|
6816
|
+
(0, import_node_path29.join)(workspaceRoot, "node_modules", name, "package.json")
|
|
6755
6817
|
).version;
|
|
6756
6818
|
} catch {
|
|
6757
6819
|
return void 0;
|
|
6758
6820
|
}
|
|
6759
6821
|
}
|
|
6760
6822
|
if (ecosystem === "pub") {
|
|
6761
|
-
const lockPath = (0,
|
|
6823
|
+
const lockPath = (0, import_node_path29.join)(workspaceRoot, "pubspec.lock");
|
|
6762
6824
|
if (!fileExists(lockPath)) {
|
|
6763
6825
|
return void 0;
|
|
6764
6826
|
}
|
|
@@ -6766,7 +6828,7 @@ function resolvedVersion(workspaceRoot, ecosystem, name) {
|
|
|
6766
6828
|
const match = new RegExp(
|
|
6767
6829
|
String.raw`^\s{2}${escapeForRegex(name)}:[^]*?^\s+version:\s*["']?([^"'\s]+)`,
|
|
6768
6830
|
"m"
|
|
6769
|
-
).exec((0,
|
|
6831
|
+
).exec((0, import_node_fs27.readFileSync)(lockPath, "utf8"));
|
|
6770
6832
|
return match?.[1];
|
|
6771
6833
|
} catch {
|
|
6772
6834
|
return void 0;
|
|
@@ -6832,7 +6894,7 @@ function resolveTarget(locations, target) {
|
|
|
6832
6894
|
return byName[0];
|
|
6833
6895
|
}
|
|
6834
6896
|
function installInto(workspaceRoot, location, packages, saveDev) {
|
|
6835
|
-
const projectDir = (0,
|
|
6897
|
+
const projectDir = (0, import_node_path30.join)(workspaceRoot, location.dir);
|
|
6836
6898
|
switch (location.ecosystem) {
|
|
6837
6899
|
case "npm": {
|
|
6838
6900
|
const flags = saveDev ? ["--save-dev"] : [];
|
|
@@ -6885,7 +6947,7 @@ function installInto(workspaceRoot, location, packages, saveDev) {
|
|
|
6885
6947
|
function addPythonDependency(manifestPath, specifier) {
|
|
6886
6948
|
let content;
|
|
6887
6949
|
try {
|
|
6888
|
-
content = (0,
|
|
6950
|
+
content = (0, import_node_fs28.readFileSync)(manifestPath, "utf8");
|
|
6889
6951
|
} catch {
|
|
6890
6952
|
logger.warn(`Could not read ${manifestPath} \u2014 skipped ${specifier}`);
|
|
6891
6953
|
return;
|
|
@@ -6914,7 +6976,7 @@ function installEverything(workspaceRoot, only) {
|
|
|
6914
6976
|
}
|
|
6915
6977
|
function ecosystemPresent(workspaceRoot, ecosystem) {
|
|
6916
6978
|
if (ecosystem === "go") {
|
|
6917
|
-
return fileExists((0,
|
|
6979
|
+
return fileExists((0, import_node_path30.join)(workspaceRoot, "go.work")) || fileExists((0, import_node_path30.join)(workspaceRoot, "go.mod"));
|
|
6918
6980
|
}
|
|
6919
6981
|
return hasEcosystem(workspaceRoot, ecosystem);
|
|
6920
6982
|
}
|
|
@@ -6933,7 +6995,7 @@ function splitAtLast(value, separator) {
|
|
|
6933
6995
|
}
|
|
6934
6996
|
|
|
6935
6997
|
// src/dependency-management/sync-dependencies.use-case.ts
|
|
6936
|
-
var
|
|
6998
|
+
var import_node_path31 = require("path");
|
|
6937
6999
|
|
|
6938
7000
|
// src/dependency-management/semver.algorithm.ts
|
|
6939
7001
|
var UPDATE_KINDS = ["patch", "minor", "major", "non-semver"];
|
|
@@ -7110,7 +7172,7 @@ function describe(finding) {
|
|
|
7110
7172
|
return `${finding.name} \u2192 ${finding.target} (${finding.reason}); disagreeing: ${sites}`;
|
|
7111
7173
|
}
|
|
7112
7174
|
function runSync(workspaceRoot, options) {
|
|
7113
|
-
if (!fileExists((0,
|
|
7175
|
+
if (!fileExists((0, import_node_path31.join)(workspaceRoot, "nx.json"))) {
|
|
7114
7176
|
throw new Error(
|
|
7115
7177
|
`No nx.json found in ${workspaceRoot} \u2014 run 'mnci sync' from the workspace root.`
|
|
7116
7178
|
);
|
|
@@ -7160,7 +7222,7 @@ function runSync(workspaceRoot, options) {
|
|
|
7160
7222
|
}
|
|
7161
7223
|
|
|
7162
7224
|
// src/dependency-management/update-dependencies.use-case.ts
|
|
7163
|
-
var
|
|
7225
|
+
var import_node_path32 = require("path");
|
|
7164
7226
|
var import_prompts2 = require("@inquirer/prompts");
|
|
7165
7227
|
|
|
7166
7228
|
// src/dependency-management/registry.client.ts
|
|
@@ -7443,7 +7505,7 @@ function reinstall(workspaceRoot, ecosystems) {
|
|
|
7443
7505
|
function hasPythonInstallScript(workspaceRoot) {
|
|
7444
7506
|
try {
|
|
7445
7507
|
const manifest = readJson(
|
|
7446
|
-
(0,
|
|
7508
|
+
(0, import_node_path32.join)(workspaceRoot, "package.json")
|
|
7447
7509
|
);
|
|
7448
7510
|
return manifest.scripts?.["python:install"] !== void 0;
|
|
7449
7511
|
} catch {
|
|
@@ -7459,7 +7521,7 @@ function applyGoUpdates(workspaceRoot, entries) {
|
|
|
7459
7521
|
}
|
|
7460
7522
|
}
|
|
7461
7523
|
async function runUp(workspaceRoot, options) {
|
|
7462
|
-
if (!fileExists((0,
|
|
7524
|
+
if (!fileExists((0, import_node_path32.join)(workspaceRoot, "nx.json"))) {
|
|
7463
7525
|
throw new Error(`No nx.json found in ${workspaceRoot} \u2014 run 'mnci up' from the workspace root.`);
|
|
7464
7526
|
}
|
|
7465
7527
|
const ecosystems = resolveEcosystems(options.ecosystem);
|
|
@@ -7536,7 +7598,7 @@ var PROJECT_KINDS = [
|
|
|
7536
7598
|
var EMPTY_KINDS = /* @__PURE__ */ new Set(["npm-lib", "internal-lib", "react-lib", "react-internal-lib", "node-function-app"]);
|
|
7537
7599
|
async function runAdd(kind, name, options) {
|
|
7538
7600
|
const workspaceRoot = process.cwd();
|
|
7539
|
-
if (!fileExists((0,
|
|
7601
|
+
if (!fileExists((0, import_node_path33.join)(workspaceRoot, "nx.json"))) {
|
|
7540
7602
|
throw new Error("No nx.json found here. Run `add` from the workspace root.");
|
|
7541
7603
|
}
|
|
7542
7604
|
const stack = readWorkspaceStack(workspaceRoot);
|
|
@@ -7599,8 +7661,8 @@ async function runAdd(kind, name, options) {
|
|
|
7599
7661
|
],
|
|
7600
7662
|
workspaceRoot
|
|
7601
7663
|
);
|
|
7602
|
-
markPrivate((0,
|
|
7603
|
-
renameScaffoldPlaceholder((0,
|
|
7664
|
+
markPrivate((0, import_node_path33.join)(workspaceRoot, "libs", resolvedName, "package.json"));
|
|
7665
|
+
renameScaffoldPlaceholder((0, import_node_path33.join)(workspaceRoot, "libs", resolvedName), resolvedName, options.empty === true);
|
|
7604
7666
|
removeGeneratedEslintConfig(workspaceRoot, `libs/${resolvedName}`);
|
|
7605
7667
|
registerProjectCommands(workspaceRoot, resolvedName, { build: true });
|
|
7606
7668
|
break;
|
|
@@ -7692,7 +7754,7 @@ async function runAdd(kind, name, options) {
|
|
|
7692
7754
|
}
|
|
7693
7755
|
function readWorkspaceStack(workspaceRoot) {
|
|
7694
7756
|
const nxJson = readJson(
|
|
7695
|
-
(0,
|
|
7757
|
+
(0, import_node_path33.join)(workspaceRoot, "nx.json")
|
|
7696
7758
|
);
|
|
7697
7759
|
const stack = nxJson.mnci?.stack;
|
|
7698
7760
|
return {
|
|
@@ -7741,15 +7803,15 @@ function runKinds(options) {
|
|
|
7741
7803
|
|
|
7742
7804
|
// src/workspace-diagnostics/check-invariants.use-case.ts
|
|
7743
7805
|
var import_node_child_process = require("child_process");
|
|
7744
|
-
var
|
|
7745
|
-
var
|
|
7806
|
+
var import_node_fs29 = require("fs");
|
|
7807
|
+
var import_node_path34 = require("path");
|
|
7746
7808
|
var SUPPORTED_ESLINT_MAJOR = ESLINT_VERSION.replace(/^\D*/, "").split(".", 1)[0];
|
|
7747
7809
|
function toPosix2(path) {
|
|
7748
7810
|
return path.replaceAll("\\", "/");
|
|
7749
7811
|
}
|
|
7750
7812
|
function checkEslintConfigs(workspaceRoot) {
|
|
7751
|
-
const rootConfigs = (0,
|
|
7752
|
-
const projectConfigs = (0,
|
|
7813
|
+
const rootConfigs = (0, import_node_fs29.globSync)("eslint.config.{js,mjs,cjs,ts,mts,cts}", { cwd: workspaceRoot });
|
|
7814
|
+
const projectConfigs = (0, import_node_fs29.globSync)("{apps,libs,packages}/*/eslint.config.{js,mjs,cjs,ts,mts,cts}", {
|
|
7753
7815
|
cwd: workspaceRoot
|
|
7754
7816
|
}).map((config) => toPosix2(config));
|
|
7755
7817
|
return [
|
|
@@ -7769,10 +7831,10 @@ function checkEslintConfigs(workspaceRoot) {
|
|
|
7769
7831
|
];
|
|
7770
7832
|
}
|
|
7771
7833
|
function checkEslintEntryPointReachesTheRules(workspaceRoot) {
|
|
7772
|
-
const rules = (0,
|
|
7773
|
-
if (!(0,
|
|
7774
|
-
const entryPoint = (0,
|
|
7775
|
-
const source = (0,
|
|
7834
|
+
const rules = (0, import_node_path34.join)(workspaceRoot, ESLINT_MNCI_FILENAME);
|
|
7835
|
+
if (!(0, import_node_fs29.existsSync)(rules)) return [];
|
|
7836
|
+
const entryPoint = (0, import_node_path34.join)(workspaceRoot, ESLINT_USER_FILENAME);
|
|
7837
|
+
const source = (0, import_node_fs29.existsSync)(entryPoint) ? (0, import_node_fs29.readFileSync)(entryPoint, "utf8") : "";
|
|
7776
7838
|
return [
|
|
7777
7839
|
{
|
|
7778
7840
|
check: `${ESLINT_USER_FILENAME} imports the mnci rules`,
|
|
@@ -7785,7 +7847,7 @@ function checkEslintEntryPointReachesTheRules(workspaceRoot) {
|
|
|
7785
7847
|
function declaredDevDependencies(workspaceRoot) {
|
|
7786
7848
|
try {
|
|
7787
7849
|
const manifest = readJson(
|
|
7788
|
-
(0,
|
|
7850
|
+
(0, import_node_path34.join)(workspaceRoot, "package.json")
|
|
7789
7851
|
);
|
|
7790
7852
|
return manifest.devDependencies ?? {};
|
|
7791
7853
|
} catch {
|
|
@@ -7793,7 +7855,7 @@ function declaredDevDependencies(workspaceRoot) {
|
|
|
7793
7855
|
}
|
|
7794
7856
|
}
|
|
7795
7857
|
function checkNoRetiredFormatter(workspaceRoot) {
|
|
7796
|
-
const files = RETIRED_FORMATTER_FILES.filter((file) => fileExists((0,
|
|
7858
|
+
const files = RETIRED_FORMATTER_FILES.filter((file) => fileExists((0, import_node_path34.join)(workspaceRoot, file)));
|
|
7797
7859
|
const declared = ["prettier", "eslint-config-prettier", "oxlint", "oxfmt", "@mnci/oxlint-config"].filter((name) => declaredDevDependencies(workspaceRoot)[name] !== void 0);
|
|
7798
7860
|
const stale = [...files, ...declared];
|
|
7799
7861
|
if (stale.length === 0) {
|
|
@@ -7819,7 +7881,7 @@ function checkEslintPlugin(nxJson) {
|
|
|
7819
7881
|
};
|
|
7820
7882
|
}
|
|
7821
7883
|
function checkResolvedEslint(workspaceRoot) {
|
|
7822
|
-
const manifestPath = (0,
|
|
7884
|
+
const manifestPath = (0, import_node_path34.join)(workspaceRoot, "node_modules/eslint/package.json");
|
|
7823
7885
|
if (!fileExists(manifestPath)) {
|
|
7824
7886
|
return void 0;
|
|
7825
7887
|
}
|
|
@@ -7837,11 +7899,11 @@ function checkResolvedEslint(workspaceRoot) {
|
|
|
7837
7899
|
}
|
|
7838
7900
|
}
|
|
7839
7901
|
function checkNpmrc(workspaceRoot, registry, scope) {
|
|
7840
|
-
const npmrcPath = (0,
|
|
7902
|
+
const npmrcPath = (0, import_node_path34.join)(workspaceRoot, ".npmrc");
|
|
7841
7903
|
if (!registry || !fileExists(npmrcPath)) {
|
|
7842
7904
|
return void 0;
|
|
7843
7905
|
}
|
|
7844
|
-
const npmrc = (0,
|
|
7906
|
+
const npmrc = (0, import_node_fs29.readFileSync)(npmrcPath, "utf8");
|
|
7845
7907
|
if (registry.kind === "npm") {
|
|
7846
7908
|
return {
|
|
7847
7909
|
check: ".npmrc authenticates the public registry",
|
|
@@ -7858,11 +7920,11 @@ function checkNpmrc(workspaceRoot, registry, scope) {
|
|
|
7858
7920
|
};
|
|
7859
7921
|
}
|
|
7860
7922
|
function checkNpmrcCredentialResolves(workspaceRoot, environment = process.env) {
|
|
7861
|
-
const npmrcPath = (0,
|
|
7923
|
+
const npmrcPath = (0, import_node_path34.join)(workspaceRoot, ".npmrc");
|
|
7862
7924
|
if (!fileExists(npmrcPath)) {
|
|
7863
7925
|
return void 0;
|
|
7864
7926
|
}
|
|
7865
|
-
const npmrc = (0,
|
|
7927
|
+
const npmrc = (0, import_node_fs29.readFileSync)(npmrcPath, "utf8");
|
|
7866
7928
|
const credentials = npmrc.split("\n").filter((line) => !line.trimStart().startsWith(";") && !line.trimStart().startsWith("#")).filter((line) => /(?:_authToken|_password|_auth)\s*=/u.test(line));
|
|
7867
7929
|
const referenced = [
|
|
7868
7930
|
...new Set(
|
|
@@ -7886,13 +7948,13 @@ function checkNpmrcCredentialResolves(workspaceRoot, environment = process.env)
|
|
|
7886
7948
|
};
|
|
7887
7949
|
}
|
|
7888
7950
|
function checkNpmAuthMatchesPipeline(workspaceRoot, registry) {
|
|
7889
|
-
const npmrcPath = (0,
|
|
7890
|
-
const pipelinePath = (0,
|
|
7951
|
+
const npmrcPath = (0, import_node_path34.join)(workspaceRoot, ".npmrc");
|
|
7952
|
+
const pipelinePath = (0, import_node_path34.join)(workspaceRoot, "azure-pipelines.yml");
|
|
7891
7953
|
if (registry?.kind !== "azure-artifacts" || !fileExists(npmrcPath) || !fileExists(pipelinePath)) {
|
|
7892
7954
|
return void 0;
|
|
7893
7955
|
}
|
|
7894
|
-
const holdsCredentials = (0,
|
|
7895
|
-
const runsTask = (0,
|
|
7956
|
+
const holdsCredentials = (0, import_node_fs29.readFileSync)(npmrcPath, "utf8").split("\n").filter((line) => !line.trimStart().startsWith(";") && !line.trimStart().startsWith("#")).some((line) => /(?:_authToken|_password|_auth)\s*=/u.test(line));
|
|
7957
|
+
const runsTask = (0, import_node_fs29.readFileSync)(pipelinePath, "utf8").includes("npmAuthenticate@0");
|
|
7896
7958
|
if (!holdsCredentials && !runsTask) {
|
|
7897
7959
|
return {
|
|
7898
7960
|
check: "npm auth: .npmrc and azure-pipelines.yml agree",
|
|
@@ -7937,13 +7999,13 @@ function npmjsCredentialShape(credentials, environment) {
|
|
|
7937
7999
|
}
|
|
7938
8000
|
function checkVersionActions(workspaceRoot) {
|
|
7939
8001
|
const candidates = [
|
|
7940
|
-
...(0,
|
|
7941
|
-
...(0,
|
|
7942
|
-
...(0,
|
|
8002
|
+
...(0, import_node_fs29.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }),
|
|
8003
|
+
...(0, import_node_fs29.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }),
|
|
8004
|
+
...(0, import_node_fs29.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot })
|
|
7943
8005
|
].map((manifest) => toPosix2(manifest));
|
|
7944
8006
|
return candidates.flatMap((manifest) => {
|
|
7945
8007
|
const projectRoot = manifest.slice(0, manifest.lastIndexOf("/"));
|
|
7946
|
-
const projectJsonPath = (0,
|
|
8008
|
+
const projectJsonPath = (0, import_node_path34.join)(workspaceRoot, projectRoot, "project.json");
|
|
7947
8009
|
let hasOverride = false;
|
|
7948
8010
|
try {
|
|
7949
8011
|
const projectJson = readJson(projectJsonPath);
|
|
@@ -7972,7 +8034,7 @@ function declaredTargets(workspaceRoot, projectRoot) {
|
|
|
7972
8034
|
]) {
|
|
7973
8035
|
try {
|
|
7974
8036
|
const targets = extract(
|
|
7975
|
-
readJson((0,
|
|
8037
|
+
readJson((0, import_node_path34.join)(workspaceRoot, projectRoot, file))
|
|
7976
8038
|
);
|
|
7977
8039
|
if (targets && typeof targets === "object") {
|
|
7978
8040
|
sources.push({
|
|
@@ -7988,8 +8050,8 @@ function declaredTargets(workspaceRoot, projectRoot) {
|
|
|
7988
8050
|
function checkTargetFilesExist(workspaceRoot) {
|
|
7989
8051
|
const projectRoots = new Set(
|
|
7990
8052
|
[
|
|
7991
|
-
...(0,
|
|
7992
|
-
...(0,
|
|
8053
|
+
...(0, import_node_fs29.globSync)("{apps,libs,packages}/*/project.json", { cwd: workspaceRoot }),
|
|
8054
|
+
...(0, import_node_fs29.globSync)("{apps,libs,packages}/*/package.json", { cwd: workspaceRoot })
|
|
7993
8055
|
].map((manifest) => toPosix2(manifest).split("/").slice(0, 2).join("/"))
|
|
7994
8056
|
);
|
|
7995
8057
|
return [...projectRoots].flatMap(
|
|
@@ -8004,7 +8066,7 @@ function checkOneTargetsFiles(workspaceRoot, source, targetName, target) {
|
|
|
8004
8066
|
return TARGET_FILE_OPTIONS.flatMap((option) => {
|
|
8005
8067
|
const value = target?.options?.[option];
|
|
8006
8068
|
const checkable = typeof value === "string" && !value.includes("{");
|
|
8007
|
-
if (!checkable || fileExists((0,
|
|
8069
|
+
if (!checkable || fileExists((0, import_node_path34.join)(workspaceRoot, value))) {
|
|
8008
8070
|
return [];
|
|
8009
8071
|
}
|
|
8010
8072
|
return [
|
|
@@ -8043,15 +8105,15 @@ function checkGoPluginRegistered(workspaceRoot) {
|
|
|
8043
8105
|
};
|
|
8044
8106
|
}
|
|
8045
8107
|
function checkGoWorkInSync(workspaceRoot) {
|
|
8046
|
-
const goWorkPath = (0,
|
|
8108
|
+
const goWorkPath = (0, import_node_path34.join)(workspaceRoot, "go.work");
|
|
8047
8109
|
if (!fileExists(goWorkPath)) {
|
|
8048
8110
|
return void 0;
|
|
8049
8111
|
}
|
|
8050
|
-
const contents = (0,
|
|
8112
|
+
const contents = (0, import_node_fs29.existsSync)(goWorkPath) ? (0, import_node_fs29.readFileSync)(goWorkPath, "utf8") : "";
|
|
8051
8113
|
const blockEntries = Array.from(contents.matchAll(/(?:^|\n)\s*use\s+\(([^)]*)\)/g), (match) => match[1].split("\n")).flat();
|
|
8052
8114
|
const singleEntries = Array.from(contents.matchAll(/(?:^|\n)\s*use\s+(\.\S+)/g), (match) => match[1]);
|
|
8053
8115
|
const uses = [...blockEntries, ...singleEntries].map((entry) => entry.trim()).filter(Boolean);
|
|
8054
|
-
const stale = uses.filter((entry) => !(0,
|
|
8116
|
+
const stale = uses.filter((entry) => !(0, import_node_fs29.existsSync)((0, import_node_path34.join)(workspaceRoot, entry, "go.mod")));
|
|
8055
8117
|
return {
|
|
8056
8118
|
check: "every go.work `use` entry points to a module that still exists",
|
|
8057
8119
|
ok: stale.length === 0,
|
|
@@ -8067,9 +8129,9 @@ function checkNativeApps(workspaceRoot) {
|
|
|
8067
8129
|
{ file: ".github/workflows/ci.yml", marker: "native (${{ matrix.os }})" },
|
|
8068
8130
|
{ file: "azure-pipelines.yml", marker: "- job: native" }
|
|
8069
8131
|
];
|
|
8070
|
-
const findings = pipelines.filter(({ file }) => fileExists((0,
|
|
8132
|
+
const findings = pipelines.filter(({ file }) => fileExists((0, import_node_path34.join)(workspaceRoot, file))).map(({ file, marker }) => ({
|
|
8071
8133
|
check: `${file} builds the native apps on every OS`,
|
|
8072
|
-
ok: (0,
|
|
8134
|
+
ok: (0, import_node_fs29.readFileSync)((0, import_node_path34.join)(workspaceRoot, file), "utf8").includes(marker),
|
|
8073
8135
|
detail: `${file} has no native job: CI would verify a cgo app on the one agent that cannot build it`,
|
|
8074
8136
|
remedy: "run `mnci upgrade`"
|
|
8075
8137
|
}));
|
|
@@ -8082,7 +8144,7 @@ function checkNativeApps(workspaceRoot) {
|
|
|
8082
8144
|
return findings;
|
|
8083
8145
|
}
|
|
8084
8146
|
function checkNoRootRuntimeDependencies(workspaceRoot) {
|
|
8085
|
-
const manifestPath = (0,
|
|
8147
|
+
const manifestPath = (0, import_node_path34.join)(workspaceRoot, "package.json");
|
|
8086
8148
|
if (!fileExists(manifestPath)) {
|
|
8087
8149
|
return void 0;
|
|
8088
8150
|
}
|
|
@@ -8102,14 +8164,14 @@ function checkNoRootRuntimeDependencies(workspaceRoot) {
|
|
|
8102
8164
|
};
|
|
8103
8165
|
}
|
|
8104
8166
|
function checkRollupSourceMaps(workspaceRoot) {
|
|
8105
|
-
const configs = (0,
|
|
8167
|
+
const configs = (0, import_node_fs29.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
|
|
8106
8168
|
cwd: workspaceRoot
|
|
8107
8169
|
}).map((config) => toPosix2(config));
|
|
8108
8170
|
return configs.flatMap((relativePath) => {
|
|
8109
|
-
const configPath = (0,
|
|
8171
|
+
const configPath = (0, import_node_path34.join)(workspaceRoot, relativePath);
|
|
8110
8172
|
let config;
|
|
8111
8173
|
try {
|
|
8112
|
-
config = (0,
|
|
8174
|
+
config = (0, import_node_fs29.readFileSync)(configPath, "utf8");
|
|
8113
8175
|
} catch {
|
|
8114
8176
|
return [];
|
|
8115
8177
|
}
|
|
@@ -8124,11 +8186,11 @@ function checkRollupSourceMaps(workspaceRoot) {
|
|
|
8124
8186
|
});
|
|
8125
8187
|
}
|
|
8126
8188
|
function checkDeclarationSpecifiers(workspaceRoot) {
|
|
8127
|
-
const configs = (0,
|
|
8189
|
+
const configs = (0, import_node_fs29.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
|
|
8128
8190
|
cwd: workspaceRoot
|
|
8129
8191
|
}).map((config) => toPosix2(config));
|
|
8130
8192
|
return configs.flatMap((relativePath) => {
|
|
8131
|
-
const configPath = (0,
|
|
8193
|
+
const configPath = (0, import_node_path34.join)(workspaceRoot, relativePath);
|
|
8132
8194
|
if (!fileExists(configPath)) {
|
|
8133
8195
|
return [];
|
|
8134
8196
|
}
|
|
@@ -8163,8 +8225,8 @@ function checkDeclarationSpecifiers(workspaceRoot) {
|
|
|
8163
8225
|
}
|
|
8164
8226
|
function checkPipelinePhases(workspaceRoot) {
|
|
8165
8227
|
const files = ["azure-pipelines.yml", ".github/workflows/ci.yml"];
|
|
8166
|
-
return files.filter((file) => fileExists((0,
|
|
8167
|
-
const { verifyActive, switchedOff } = inspectPipeline((0,
|
|
8228
|
+
return files.filter((file) => fileExists((0, import_node_path34.join)(workspaceRoot, file))).flatMap((file) => {
|
|
8229
|
+
const { verifyActive, switchedOff } = inspectPipeline((0, import_node_fs29.readFileSync)((0, import_node_path34.join)(workspaceRoot, file), "utf8"));
|
|
8168
8230
|
const verify = {
|
|
8169
8231
|
check: `${file} runs the enforced verify phase`,
|
|
8170
8232
|
ok: verifyActive,
|
|
@@ -8204,8 +8266,19 @@ function checkDependencyRangesNotPreserved(nxJson) {
|
|
|
8204
8266
|
remedy: "run `mnci upgrade`, or set release.version.preserveMatchingDependencyRanges to false in nx.json"
|
|
8205
8267
|
};
|
|
8206
8268
|
}
|
|
8269
|
+
function checkLockfileHasNoLocalRegistry(workspaceRoot) {
|
|
8270
|
+
if (!fileExists((0, import_node_path34.join)(workspaceRoot, "package-lock.json"))) {
|
|
8271
|
+
return void 0;
|
|
8272
|
+
}
|
|
8273
|
+
return {
|
|
8274
|
+
check: "package-lock.json carries no unused local registry (verdaccio)",
|
|
8275
|
+
ok: !hasStaleLocalRegistry(workspaceRoot),
|
|
8276
|
+
detail: "package-lock.json still holds verdaccio and its chain, which no manifest declares; npm audit reports high advisories (braces has no patched release) on packages nothing uses",
|
|
8277
|
+
remedy: "run `mnci upgrade`, which removes it, then commit package-lock.json"
|
|
8278
|
+
};
|
|
8279
|
+
}
|
|
8207
8280
|
function collectFindings(workspaceRoot) {
|
|
8208
|
-
const nxJsonPath = (0,
|
|
8281
|
+
const nxJsonPath = (0, import_node_path34.join)(workspaceRoot, "nx.json");
|
|
8209
8282
|
if (!fileExists(nxJsonPath)) {
|
|
8210
8283
|
throw new Error(
|
|
8211
8284
|
`No nx.json found in ${workspaceRoot} \u2014 run 'mnci doctor' from the workspace root.`
|
|
@@ -8231,7 +8304,8 @@ function collectFindings(workspaceRoot) {
|
|
|
8231
8304
|
...checkNativeApps(workspaceRoot),
|
|
8232
8305
|
...checkPipelinePhases(workspaceRoot),
|
|
8233
8306
|
...checkNativeBuildConfig(workspaceRoot),
|
|
8234
|
-
checkDependencyRangesNotPreserved(nxJson)
|
|
8307
|
+
checkDependencyRangesNotPreserved(nxJson),
|
|
8308
|
+
checkLockfileHasNoLocalRegistry(workspaceRoot)
|
|
8235
8309
|
].filter((finding) => finding !== void 0);
|
|
8236
8310
|
}
|
|
8237
8311
|
function runDoctor(workspaceRoot, options = {}) {
|
|
@@ -8337,11 +8411,11 @@ function runCommands(program, options) {
|
|
|
8337
8411
|
}
|
|
8338
8412
|
|
|
8339
8413
|
// src/workspace-info/list-projects.use-case.ts
|
|
8340
|
-
var
|
|
8414
|
+
var import_node_path35 = require("path");
|
|
8341
8415
|
var TYPE_TAG_PREFIX = "type:";
|
|
8342
8416
|
function listProjects(workspaceRoot) {
|
|
8343
8417
|
return locateProjects(workspaceRoot).map((location) => {
|
|
8344
|
-
const projectJsonPath = (0,
|
|
8418
|
+
const projectJsonPath = (0, import_node_path35.join)(workspaceRoot, location.dir, "project.json");
|
|
8345
8419
|
const project = fileExists(projectJsonPath) ? readJson(projectJsonPath) : {};
|
|
8346
8420
|
const typeTag = (project.tags ?? []).find((tag) => tag.startsWith(TYPE_TAG_PREFIX));
|
|
8347
8421
|
return {
|
|
@@ -8354,7 +8428,7 @@ function listProjects(workspaceRoot) {
|
|
|
8354
8428
|
}).toSorted((a, b) => a.dir.localeCompare(b.dir));
|
|
8355
8429
|
}
|
|
8356
8430
|
function runProjects(workspaceRoot, options) {
|
|
8357
|
-
if (!fileExists((0,
|
|
8431
|
+
if (!fileExists((0, import_node_path35.join)(workspaceRoot, "nx.json"))) {
|
|
8358
8432
|
throw new Error("No nx.json found here. Run `projects` from the workspace root.");
|
|
8359
8433
|
}
|
|
8360
8434
|
const projects = listProjects(workspaceRoot);
|
|
@@ -8368,11 +8442,11 @@ function runProjects(workspaceRoot, options) {
|
|
|
8368
8442
|
}
|
|
8369
8443
|
|
|
8370
8444
|
// src/workspace-info/read-workspace-info.use-case.ts
|
|
8371
|
-
var
|
|
8445
|
+
var import_node_path37 = require("path");
|
|
8372
8446
|
|
|
8373
8447
|
// src/cli-version/check-for-update.use-case.ts
|
|
8374
|
-
var
|
|
8375
|
-
var
|
|
8448
|
+
var import_node_fs30 = require("fs");
|
|
8449
|
+
var import_node_path36 = require("path");
|
|
8376
8450
|
var import_cross_spawn3 = __toESM(require("cross-spawn"));
|
|
8377
8451
|
var PACKAGE_NAME2 = "@mnci/cli";
|
|
8378
8452
|
var REGISTRY_TIMEOUT_MS = 2e3;
|
|
@@ -8431,8 +8505,8 @@ function releaseTriple(version) {
|
|
|
8431
8505
|
}
|
|
8432
8506
|
function readCliVersion(packageDirectory) {
|
|
8433
8507
|
try {
|
|
8434
|
-
const manifestPath = (0,
|
|
8435
|
-
const manifest = JSON.parse((0,
|
|
8508
|
+
const manifestPath = (0, import_node_path36.join)(packageDirectory, "..", "package.json");
|
|
8509
|
+
const manifest = JSON.parse((0, import_node_fs30.readFileSync)(manifestPath, "utf8"));
|
|
8436
8510
|
return manifest.version ?? "0.0.0";
|
|
8437
8511
|
} catch {
|
|
8438
8512
|
return "0.0.0";
|
|
@@ -8442,7 +8516,7 @@ function readCliVersion(packageDirectory) {
|
|
|
8442
8516
|
// src/workspace-info/read-workspace-info.use-case.ts
|
|
8443
8517
|
function readWorkspaceInfo(workspaceRoot, cliVersion) {
|
|
8444
8518
|
const latest = fetchLatestVersion() ?? null;
|
|
8445
|
-
const isWorkspace = fileExists((0,
|
|
8519
|
+
const isWorkspace = fileExists((0, import_node_path37.join)(workspaceRoot, "nx.json"));
|
|
8446
8520
|
return {
|
|
8447
8521
|
cli: {
|
|
8448
8522
|
version: cliVersion,
|
|
@@ -8463,8 +8537,8 @@ function runInfo(workspaceRoot, cliVersion, options) {
|
|
|
8463
8537
|
}
|
|
8464
8538
|
|
|
8465
8539
|
// src/workspace-creation/adopt-directory.use-case.ts
|
|
8466
|
-
var
|
|
8467
|
-
var
|
|
8540
|
+
var import_node_fs31 = require("fs");
|
|
8541
|
+
var import_node_path38 = require("path");
|
|
8468
8542
|
var NEVER_COPIED = /* @__PURE__ */ new Set([".git", "node_modules"]);
|
|
8469
8543
|
var AGENT_AND_CI_ENTRIES = [
|
|
8470
8544
|
"AGENTS.md",
|
|
@@ -8495,13 +8569,13 @@ var PREFLIGHT_BLOCKERS = [
|
|
|
8495
8569
|
"packages"
|
|
8496
8570
|
];
|
|
8497
8571
|
function assertAdoptableDirectory(target) {
|
|
8498
|
-
if (!(0,
|
|
8572
|
+
if (!(0, import_node_fs31.existsSync)(target)) {
|
|
8499
8573
|
throw new Error(`--into '${target}' does not exist. Create or clone it first.`);
|
|
8500
8574
|
}
|
|
8501
|
-
if (!(0,
|
|
8575
|
+
if (!(0, import_node_fs31.statSync)(target).isDirectory()) {
|
|
8502
8576
|
throw new Error(`--into '${target}' is not a directory.`);
|
|
8503
8577
|
}
|
|
8504
|
-
const blockers = PREFLIGHT_BLOCKERS.filter((entry) => (0,
|
|
8578
|
+
const blockers = PREFLIGHT_BLOCKERS.filter((entry) => (0, import_node_fs31.existsSync)((0, import_node_path38.join)(target, entry)));
|
|
8505
8579
|
if (blockers.length > 0) {
|
|
8506
8580
|
throw new Error(
|
|
8507
8581
|
`--into '${target}' already holds ${blockers.join(", ")}, so it is a project already. Use \`mnci upgrade\` to re-apply the overlay to an existing workspace, or point --into at an empty checkout.`
|
|
@@ -8509,15 +8583,15 @@ function assertAdoptableDirectory(target) {
|
|
|
8509
8583
|
}
|
|
8510
8584
|
}
|
|
8511
8585
|
function mergeGitignore(generatedFile, targetFile) {
|
|
8512
|
-
const existing = (0,
|
|
8586
|
+
const existing = (0, import_node_fs31.readFileSync)(targetFile, "utf8");
|
|
8513
8587
|
const present = new Set(existing.split("\n").map((line) => line.trim()));
|
|
8514
|
-
const additions = (0,
|
|
8588
|
+
const additions = (0, import_node_fs31.readFileSync)(generatedFile, "utf8").split("\n").map((line) => line.trimEnd()).filter((line) => {
|
|
8515
8589
|
const trimmed = line.trim();
|
|
8516
8590
|
return trimmed !== "" && !trimmed.startsWith("#") && !present.has(trimmed);
|
|
8517
8591
|
});
|
|
8518
8592
|
if (additions.length === 0) return false;
|
|
8519
8593
|
const separator = existing.endsWith("\n") ? "" : "\n";
|
|
8520
|
-
(0,
|
|
8594
|
+
(0, import_node_fs31.writeFileSync)(
|
|
8521
8595
|
targetFile,
|
|
8522
8596
|
`${existing}${separator}
|
|
8523
8597
|
# Added by mnci (Nx workspace)
|
|
@@ -8527,9 +8601,9 @@ ${additions.join("\n")}
|
|
|
8527
8601
|
return true;
|
|
8528
8602
|
}
|
|
8529
8603
|
function adoptGeneratedWorkspace(generatedRoot, target) {
|
|
8530
|
-
const entries = (0,
|
|
8604
|
+
const entries = (0, import_node_fs31.readdirSync)(generatedRoot).filter((entry) => !NEVER_COPIED.has(entry));
|
|
8531
8605
|
const collisions = entries.filter(
|
|
8532
|
-
(entry) => (0,
|
|
8606
|
+
(entry) => (0, import_node_fs31.existsSync)((0, import_node_path38.join)(target, entry)) && !EXISTING_WINS.has(entry) && entry !== ".gitignore"
|
|
8533
8607
|
);
|
|
8534
8608
|
if (collisions.length > 0) {
|
|
8535
8609
|
throw new Error(
|
|
@@ -8538,28 +8612,28 @@ function adoptGeneratedWorkspace(generatedRoot, target) {
|
|
|
8538
8612
|
}
|
|
8539
8613
|
const result = { copied: [], kept: [], mergedGitignore: false };
|
|
8540
8614
|
for (const entry of entries) {
|
|
8541
|
-
const from = (0,
|
|
8542
|
-
const to = (0,
|
|
8543
|
-
if (entry === ".gitignore" && (0,
|
|
8615
|
+
const from = (0, import_node_path38.join)(generatedRoot, entry);
|
|
8616
|
+
const to = (0, import_node_path38.join)(target, entry);
|
|
8617
|
+
if (entry === ".gitignore" && (0, import_node_fs31.existsSync)(to)) {
|
|
8544
8618
|
result.mergedGitignore = mergeGitignore(from, to);
|
|
8545
8619
|
result.kept.push(entry);
|
|
8546
8620
|
continue;
|
|
8547
8621
|
}
|
|
8548
|
-
if ((0,
|
|
8622
|
+
if ((0, import_node_fs31.existsSync)(to)) {
|
|
8549
8623
|
result.kept.push(entry);
|
|
8550
8624
|
continue;
|
|
8551
8625
|
}
|
|
8552
|
-
(0,
|
|
8626
|
+
(0, import_node_fs31.cpSync)(from, to, { recursive: true });
|
|
8553
8627
|
result.copied.push(entry);
|
|
8554
8628
|
}
|
|
8555
|
-
(0,
|
|
8629
|
+
(0, import_node_fs31.rmSync)(generatedRoot, { recursive: true, force: true });
|
|
8556
8630
|
return result;
|
|
8557
8631
|
}
|
|
8558
8632
|
|
|
8559
8633
|
// src/workspace-creation/create-workspace.use-case.ts
|
|
8560
|
-
var
|
|
8634
|
+
var import_node_fs32 = require("fs");
|
|
8561
8635
|
var import_node_os2 = require("os");
|
|
8562
|
-
var
|
|
8636
|
+
var import_node_path39 = require("path");
|
|
8563
8637
|
function nxCloudProviderValue(ci) {
|
|
8564
8638
|
return ci === "azure" ? "azure" : "github";
|
|
8565
8639
|
}
|
|
@@ -8602,9 +8676,9 @@ async function resolveRegistry(options) {
|
|
|
8602
8676
|
return await promptRegistry();
|
|
8603
8677
|
}
|
|
8604
8678
|
async function runNew(name, options) {
|
|
8605
|
-
const adoptTarget = options.into === void 0 ? void 0 : (0,
|
|
8679
|
+
const adoptTarget = options.into === void 0 ? void 0 : (0, import_node_path39.resolve)(process.cwd(), options.into);
|
|
8606
8680
|
if (adoptTarget !== void 0) assertAdoptableDirectory(adoptTarget);
|
|
8607
|
-
const workspaceName = name ?? (adoptTarget === void 0 ? await promptText("Workspace name") : (0,
|
|
8681
|
+
const workspaceName = name ?? (adoptTarget === void 0 ? await promptText("Workspace name") : (0, import_node_path39.basename)(adoptTarget));
|
|
8608
8682
|
assertValidProjectName(workspaceName, "Workspace name");
|
|
8609
8683
|
const scope = options.scope ?? (options.yes ? `@${workspaceName}` : await promptText("npm scope for publishable packages", `@${workspaceName}`));
|
|
8610
8684
|
const registry = await resolveRegistry(options);
|
|
@@ -8617,8 +8691,8 @@ async function runNew(name, options) {
|
|
|
8617
8691
|
const npmAuth = resolveNpmAuth(options.npmAuth, registry, ci);
|
|
8618
8692
|
const stack = await resolveStack(options);
|
|
8619
8693
|
const nxCloud = options.nxCloud ?? (options.yes ? false : await promptNxCloud());
|
|
8620
|
-
const stagingParent = adoptTarget === void 0 ? process.cwd() : (0,
|
|
8621
|
-
let workspaceRoot = (0,
|
|
8694
|
+
const stagingParent = adoptTarget === void 0 ? process.cwd() : (0, import_node_fs32.mkdtempSync)((0, import_node_path39.join)((0, import_node_os2.tmpdir)(), "mnci-new-"));
|
|
8695
|
+
let workspaceRoot = (0, import_node_path39.join)(stagingParent, workspaceName);
|
|
8622
8696
|
try {
|
|
8623
8697
|
logger.step(`Creating Nx workspace '${workspaceName}' (preset: ts)`);
|
|
8624
8698
|
runNpx(
|
|
@@ -8641,7 +8715,7 @@ async function runNew(name, options) {
|
|
|
8641
8715
|
workspaceRoot = adoptTarget;
|
|
8642
8716
|
}
|
|
8643
8717
|
} finally {
|
|
8644
|
-
if (adoptTarget !== void 0) (0,
|
|
8718
|
+
if (adoptTarget !== void 0) (0, import_node_fs32.rmSync)(stagingParent, { recursive: true, force: true });
|
|
8645
8719
|
}
|
|
8646
8720
|
logger.step(
|
|
8647
8721
|
"Applying MoNecromanCI overlay (VS Code workspace, release config, .npmrc, commitlint, pipeline, stack)"
|
|
@@ -8651,8 +8725,8 @@ async function runNew(name, options) {
|
|
|
8651
8725
|
{ workspaceName, scope, registry, agent, variableGroup, ci, stack, ...npmAuth && { npmAuth } },
|
|
8652
8726
|
logger.detail
|
|
8653
8727
|
);
|
|
8654
|
-
(0,
|
|
8655
|
-
(0,
|
|
8728
|
+
(0, import_node_fs32.rmSync)((0, import_node_path39.join)(workspaceRoot, "node_modules"), { recursive: true, force: true });
|
|
8729
|
+
(0, import_node_fs32.rmSync)((0, import_node_path39.join)(workspaceRoot, "package-lock.json"), { force: true });
|
|
8656
8730
|
logger.step("Installing the toolchain (commitlint + husky + linting/formatting)");
|
|
8657
8731
|
const installStatus = runShell(
|
|
8658
8732
|
"npm",
|
|
@@ -8690,12 +8764,12 @@ function projectKindHintLines(kinds = PROJECT_KINDS) {
|
|
|
8690
8764
|
}
|
|
8691
8765
|
|
|
8692
8766
|
// src/workspace-creation/interactive-wizard.use-case.ts
|
|
8693
|
-
var
|
|
8767
|
+
var import_node_path41 = require("path");
|
|
8694
8768
|
var import_prompts4 = require("@inquirer/prompts");
|
|
8695
8769
|
|
|
8696
8770
|
// src/workspace-upgrade/upgrade-workspace.use-case.ts
|
|
8697
|
-
var
|
|
8698
|
-
var
|
|
8771
|
+
var import_node_fs33 = require("fs");
|
|
8772
|
+
var import_node_path40 = require("path");
|
|
8699
8773
|
function resolveRegistry2(options, persisted) {
|
|
8700
8774
|
if (options.registry === "azure-artifacts" || options.organization && options.artifactsFeed) {
|
|
8701
8775
|
const persistedAzure = persisted?.kind === "azure-artifacts" ? persisted : void 0;
|
|
@@ -8724,7 +8798,7 @@ function resolveWorkspaceName(workspaceRoot, persisted) {
|
|
|
8724
8798
|
return persisted.workspaceName;
|
|
8725
8799
|
}
|
|
8726
8800
|
try {
|
|
8727
|
-
const existing = (0,
|
|
8801
|
+
const existing = (0, import_node_fs33.readdirSync)(workspaceRoot).find(
|
|
8728
8802
|
(file) => file.endsWith(".code-workspace") && file !== "undefined.code-workspace"
|
|
8729
8803
|
);
|
|
8730
8804
|
if (existing) {
|
|
@@ -8732,11 +8806,11 @@ function resolveWorkspaceName(workspaceRoot, persisted) {
|
|
|
8732
8806
|
}
|
|
8733
8807
|
} catch {
|
|
8734
8808
|
}
|
|
8735
|
-
return (0,
|
|
8809
|
+
return (0, import_node_path40.basename)(workspaceRoot);
|
|
8736
8810
|
}
|
|
8737
8811
|
function detectNpmAuth(workspaceRoot) {
|
|
8738
8812
|
try {
|
|
8739
|
-
return (0,
|
|
8813
|
+
return (0, import_node_fs33.readFileSync)((0, import_node_path40.join)(workspaceRoot, "azure-pipelines.yml"), "utf8").includes("npmAuthenticate@0") ? "build-identity" : void 0;
|
|
8740
8814
|
} catch {
|
|
8741
8815
|
return void 0;
|
|
8742
8816
|
}
|
|
@@ -8783,7 +8857,7 @@ function resolveOverlayOptions(workspaceRoot, options, persisted) {
|
|
|
8783
8857
|
};
|
|
8784
8858
|
}
|
|
8785
8859
|
function runUpgrade(workspaceRoot, options) {
|
|
8786
|
-
if (!fileExists((0,
|
|
8860
|
+
if (!fileExists((0, import_node_path40.join)(workspaceRoot, "nx.json"))) {
|
|
8787
8861
|
throw new Error(
|
|
8788
8862
|
`No nx.json found in ${workspaceRoot} \u2014 this does not look like an Nx workspace. Run 'mnci upgrade' from the workspace root.`
|
|
8789
8863
|
);
|
|
@@ -8806,6 +8880,13 @@ function runUpgrade(workspaceRoot, options) {
|
|
|
8806
8880
|
logger.detail(`updated ${path}`);
|
|
8807
8881
|
}
|
|
8808
8882
|
}
|
|
8883
|
+
const lockfile = pruneStaleLocalRegistry(workspaceRoot);
|
|
8884
|
+
if (lockfile.stale) {
|
|
8885
|
+
logger.step("Dropping the unused local registry (verdaccio) from package-lock.json");
|
|
8886
|
+
if (lockfile.status !== 0) {
|
|
8887
|
+
logger.warn("npm could not re-resolve the lockfile; run `npm install --package-lock-only` once you are online.");
|
|
8888
|
+
}
|
|
8889
|
+
}
|
|
8809
8890
|
const goApps = addGoPlatformTargets(workspaceRoot);
|
|
8810
8891
|
if (goApps.length > 0) {
|
|
8811
8892
|
logger.step("Adding the six-platform build to Go apps (build-all, package-all)");
|
|
@@ -8849,7 +8930,7 @@ function runUpgrade(workspaceRoot, options) {
|
|
|
8849
8930
|
|
|
8850
8931
|
// src/workspace-creation/interactive-wizard.use-case.ts
|
|
8851
8932
|
async function runInteractive() {
|
|
8852
|
-
const inWorkspace = fileExists((0,
|
|
8933
|
+
const inWorkspace = fileExists((0, import_node_path41.join)(process.cwd(), "nx.json"));
|
|
8853
8934
|
const choiceNew = { name: "Create a new monorepo", value: "new" };
|
|
8854
8935
|
const choiceAdd = { name: "Add a project to this workspace", value: "add" };
|
|
8855
8936
|
const choiceUpgrade = {
|