@mnci/cli 4.53.0 → 4.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -18
- package/dist/cli.js +380 -258
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -136,8 +136,8 @@ async function promptStack() {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
// src/nx-workspace/nx.client.ts
|
|
139
|
-
function runShell(command, arguments_, cwd) {
|
|
140
|
-
const result = import_cross_spawn.default.sync(command, arguments_, { stdio: "inherit", cwd });
|
|
139
|
+
function runShell(command, arguments_, cwd, environment) {
|
|
140
|
+
const result = import_cross_spawn.default.sync(command, arguments_, { stdio: "inherit", cwd, env: environment === void 0 ? void 0 : { ...process.env, ...environment } });
|
|
141
141
|
return result.status ?? 1;
|
|
142
142
|
}
|
|
143
143
|
var CAPTURE_TIMEOUT_MS = 6e4;
|
|
@@ -199,10 +199,10 @@ function runNpx(arguments_, cwd) {
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
function runFormatter(cwd, target = ".") {
|
|
202
|
-
const status = runShell("npx", ["eslint", target, "--fix"], cwd);
|
|
202
|
+
const status = runShell("npx", ["eslint", target, "--fix"], cwd, { NODE_OPTIONS: "--max-old-space-size=8192" });
|
|
203
203
|
if (status !== 0) {
|
|
204
204
|
logger.warn(
|
|
205
|
-
`eslint could not format '${target}' (exit code ${status}). The project was generated; run 'npm run format' to
|
|
205
|
+
`eslint could not format '${target}' (exit code ${status}), so formatting was SKIPPED and the tree is not normalised. The project was generated; run 'npm run format' to finish it.`
|
|
206
206
|
);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
@@ -2236,6 +2236,13 @@ updates:
|
|
|
2236
2236
|
directory: "/"
|
|
2237
2237
|
schedule:
|
|
2238
2238
|
interval: weekly
|
|
2239
|
+
# The Nx packages are pinned to one exact version and must move together: a PR for one alone fails resolution
|
|
2240
|
+
# (ERESOLVE between @nx/eslint and @nx/jest) or leaves a second copy of nx in the lockfile (#295).
|
|
2241
|
+
groups:
|
|
2242
|
+
nx:
|
|
2243
|
+
patterns:
|
|
2244
|
+
- "nx"
|
|
2245
|
+
- "@nx/*"
|
|
2239
2246
|
|
|
2240
2247
|
- package-ecosystem: github-actions
|
|
2241
2248
|
directory: "/"
|
|
@@ -3187,7 +3194,7 @@ function runPhase(phase, workspaceRoot, dependencies) {
|
|
|
3187
3194
|
}
|
|
3188
3195
|
|
|
3189
3196
|
// src/project-scaffolding/add-project.use-case.ts
|
|
3190
|
-
var
|
|
3197
|
+
var import_node_path37 = require("path");
|
|
3191
3198
|
var import_prompts3 = require("@inquirer/prompts");
|
|
3192
3199
|
|
|
3193
3200
|
// src/project-name/project-name.validator.ts
|
|
@@ -4090,12 +4097,19 @@ function goModulePrefix(workspaceRoot) {
|
|
|
4090
4097
|
const result = runCapture("git", ["remote", "get-url", "origin"], workspaceRoot);
|
|
4091
4098
|
return result.status === 0 ? modulePrefixFromRemoteUrl(result.stdout) : void 0;
|
|
4092
4099
|
}
|
|
4100
|
+
function rootModulePath(workspaceRoot) {
|
|
4101
|
+
try {
|
|
4102
|
+
return /^module\s+(\S+)/m.exec((0, import_node_fs15.readFileSync)((0, import_node_path14.join)(workspaceRoot, "go.mod"), "utf8"))?.[1];
|
|
4103
|
+
} catch {
|
|
4104
|
+
return void 0;
|
|
4105
|
+
}
|
|
4106
|
+
}
|
|
4093
4107
|
function registerNxGoPlugin(workspaceRoot) {
|
|
4094
4108
|
const nxJsonPath = (0, import_node_path14.join)(workspaceRoot, "nx.json");
|
|
4095
4109
|
if (!fileExists(nxJsonPath)) {
|
|
4096
4110
|
return false;
|
|
4097
4111
|
}
|
|
4098
|
-
const modulePrefix = goModulePrefix(workspaceRoot);
|
|
4112
|
+
const modulePrefix = rootModulePath(workspaceRoot) === void 0 ? goModulePrefix(workspaceRoot) : void 0;
|
|
4099
4113
|
const entry = modulePrefix === void 0 ? NX_GO_PLUGIN : { plugin: NX_GO_PLUGIN, options: { modulePrefix } };
|
|
4100
4114
|
const nxJson = readJson(nxJsonPath);
|
|
4101
4115
|
const plugins = [...nxJson.plugins ?? []];
|
|
@@ -6090,9 +6104,75 @@ function refreshContainerScript(workspaceRoot) {
|
|
|
6090
6104
|
}
|
|
6091
6105
|
|
|
6092
6106
|
// src/project-scaffolding/react-app.use-case.ts
|
|
6107
|
+
var import_node_fs28 = require("fs");
|
|
6108
|
+
var import_node_path30 = require("path");
|
|
6109
|
+
|
|
6110
|
+
// src/react-app-output/find-react-apps-sharing-output.use-case.ts
|
|
6093
6111
|
var import_node_fs27 = require("fs");
|
|
6094
6112
|
var import_node_path28 = require("path");
|
|
6095
6113
|
|
|
6114
|
+
// src/react-app-output/react-app-output.policy.ts
|
|
6115
|
+
var VITE_DEFAULT_OUT_DIR = "dist";
|
|
6116
|
+
var VITE_OUT_DIR = /\boutDir:\s*['"]([^'"]+)['"]/;
|
|
6117
|
+
function normalise(folder) {
|
|
6118
|
+
return folder.replace(/^\.\//, "").replace(/\/+$/, "");
|
|
6119
|
+
}
|
|
6120
|
+
function viteOutputFolder(viteConfig) {
|
|
6121
|
+
return normalise(VITE_OUT_DIR.exec(viteConfig)?.[1] ?? VITE_DEFAULT_OUT_DIR);
|
|
6122
|
+
}
|
|
6123
|
+
function sharesOutputFolder(typescriptOutDir, viteConfig) {
|
|
6124
|
+
return typescriptOutDir !== void 0 && normalise(typescriptOutDir) === viteOutputFolder(viteConfig);
|
|
6125
|
+
}
|
|
6126
|
+
|
|
6127
|
+
// src/react-app-output/find-react-apps-sharing-output.use-case.ts
|
|
6128
|
+
var VITE_CONFIGS = ["vite.config.mts", "vite.config.ts", "vite.config.mjs", "vite.config.js"];
|
|
6129
|
+
function appSharesOutputFolder(appRoot) {
|
|
6130
|
+
const config = VITE_CONFIGS.find((name) => fileExists((0, import_node_path28.join)(appRoot, name)));
|
|
6131
|
+
const tsconfigPath = (0, import_node_path28.join)(appRoot, "tsconfig.app.json");
|
|
6132
|
+
if (config === void 0 || !fileExists(tsconfigPath)) {
|
|
6133
|
+
return false;
|
|
6134
|
+
}
|
|
6135
|
+
try {
|
|
6136
|
+
const outDir = readJson(tsconfigPath).compilerOptions?.outDir;
|
|
6137
|
+
return sharesOutputFolder(outDir, (0, import_node_fs27.readFileSync)((0, import_node_path28.join)(appRoot, config), "utf8"));
|
|
6138
|
+
} catch {
|
|
6139
|
+
return false;
|
|
6140
|
+
}
|
|
6141
|
+
}
|
|
6142
|
+
function findReactAppsSharingOutput(workspaceRoot) {
|
|
6143
|
+
let entries;
|
|
6144
|
+
try {
|
|
6145
|
+
entries = (0, import_node_fs27.readdirSync)((0, import_node_path28.join)(workspaceRoot, "apps"));
|
|
6146
|
+
} catch {
|
|
6147
|
+
return [];
|
|
6148
|
+
}
|
|
6149
|
+
return entries.filter((entry) => appSharesOutputFolder((0, import_node_path28.join)(workspaceRoot, "apps", entry))).map((entry) => `apps/${entry}`).toSorted((a, b) => a.localeCompare(b));
|
|
6150
|
+
}
|
|
6151
|
+
|
|
6152
|
+
// src/react-app-output/separate-react-app-output.use-case.ts
|
|
6153
|
+
var import_node_path29 = require("path");
|
|
6154
|
+
function separateReactAppOutput(appRoot) {
|
|
6155
|
+
if (!appSharesOutputFolder(appRoot)) {
|
|
6156
|
+
return false;
|
|
6157
|
+
}
|
|
6158
|
+
const tsconfigPath = (0, import_node_path29.join)(appRoot, "tsconfig.app.json");
|
|
6159
|
+
const tsconfig = readJson(tsconfigPath);
|
|
6160
|
+
writeFileEnsured(tsconfigPath, toJson({
|
|
6161
|
+
...tsconfig,
|
|
6162
|
+
compilerOptions: { ...tsconfig.compilerOptions, outDir: "out-tsc/app", tsBuildInfoFile: "out-tsc/app/tsconfig.app.tsbuildinfo" }
|
|
6163
|
+
}));
|
|
6164
|
+
return true;
|
|
6165
|
+
}
|
|
6166
|
+
function separateReactAppsOutput(workspaceRoot) {
|
|
6167
|
+
const repaired = [];
|
|
6168
|
+
for (const dir of findReactAppsSharingOutput(workspaceRoot)) {
|
|
6169
|
+
if (separateReactAppOutput((0, import_node_path29.join)(workspaceRoot, dir))) {
|
|
6170
|
+
repaired.push(dir);
|
|
6171
|
+
}
|
|
6172
|
+
}
|
|
6173
|
+
return repaired;
|
|
6174
|
+
}
|
|
6175
|
+
|
|
6096
6176
|
// src/project-scaffolding/react-app-example.algorithm.ts
|
|
6097
6177
|
function reactAppExampleFiles(name) {
|
|
6098
6178
|
return {
|
|
@@ -6217,12 +6297,12 @@ function reactAppTargets(name) {
|
|
|
6217
6297
|
return targets;
|
|
6218
6298
|
}
|
|
6219
6299
|
function allowEnvFiles(workspaceRoot) {
|
|
6220
|
-
const gitignorePath = (0,
|
|
6300
|
+
const gitignorePath = (0, import_node_path30.join)(workspaceRoot, ".gitignore");
|
|
6221
6301
|
if (!fileExists(gitignorePath)) {
|
|
6222
6302
|
return;
|
|
6223
6303
|
}
|
|
6224
6304
|
const marker = "# MoNecromanCI: keep the committed per-environment Vite config (public VITE_ values)";
|
|
6225
|
-
const current = (0,
|
|
6305
|
+
const current = (0, import_node_fs28.readFileSync)(gitignorePath, "utf8");
|
|
6226
6306
|
if (current.includes(marker)) {
|
|
6227
6307
|
return;
|
|
6228
6308
|
}
|
|
@@ -6249,17 +6329,18 @@ function addReactApp(workspaceRoot, name, stack, e2e = false) {
|
|
|
6249
6329
|
workspaceRoot
|
|
6250
6330
|
);
|
|
6251
6331
|
ensureAdmZip(workspaceRoot);
|
|
6252
|
-
const reactAppRoot = (0,
|
|
6332
|
+
const reactAppRoot = (0, import_node_path30.join)(workspaceRoot, "apps", name);
|
|
6253
6333
|
for (const environment of REACT_ENVIRONMENTS) {
|
|
6254
|
-
writeFileEnsured((0,
|
|
6334
|
+
writeFileEnsured((0, import_node_path30.join)(reactAppRoot, `.env.${environment}`), reactEnvironmentFile(environment));
|
|
6255
6335
|
}
|
|
6256
6336
|
allowEnvFiles(workspaceRoot);
|
|
6257
|
-
addNxTargets((0,
|
|
6337
|
+
addNxTargets((0, import_node_path30.join)(reactAppRoot, "package.json"), reactAppTargets(name));
|
|
6258
6338
|
reshapeReactAppScaffold(reactAppRoot);
|
|
6259
|
-
(
|
|
6339
|
+
separateReactAppOutput(reactAppRoot);
|
|
6340
|
+
(0, import_node_fs28.rmSync)((0, import_node_path30.join)(reactAppRoot, "src/app/nx-welcome.component.tsx"), { force: true });
|
|
6260
6341
|
const example = reactAppExampleFiles(name);
|
|
6261
6342
|
for (const [relative, contents] of Object.entries(example)) {
|
|
6262
|
-
writeFileEnsured((0,
|
|
6343
|
+
writeFileEnsured((0, import_node_path30.join)(reactAppRoot, "src", relative), contents);
|
|
6263
6344
|
}
|
|
6264
6345
|
removeGeneratedEslintConfig(workspaceRoot, `apps/${name}`);
|
|
6265
6346
|
registerProjectCommands(workspaceRoot, name, { build: true, start: `nx run ${name}:serve` });
|
|
@@ -6269,9 +6350,9 @@ function addReactApp(workspaceRoot, name, stack, e2e = false) {
|
|
|
6269
6350
|
}
|
|
6270
6351
|
function pairE2eProject(workspaceRoot, name) {
|
|
6271
6352
|
const e2eName = `${name}-e2e`;
|
|
6272
|
-
const e2eRoot = (0,
|
|
6273
|
-
(0,
|
|
6274
|
-
writeFileEnsured((0,
|
|
6353
|
+
const e2eRoot = (0, import_node_path30.join)(workspaceRoot, "apps", e2eName);
|
|
6354
|
+
(0, import_node_fs28.rmSync)((0, import_node_path30.join)(e2eRoot, "src/example.spec.ts"), { force: true });
|
|
6355
|
+
writeFileEnsured((0, import_node_path30.join)(e2eRoot, "src/greeting.e2e.spec.ts"), reactAppE2eSpec(name));
|
|
6275
6356
|
removeGeneratedEslintConfig(workspaceRoot, `apps/${e2eName}`);
|
|
6276
6357
|
registerProjectCommands(workspaceRoot, e2eName, {
|
|
6277
6358
|
build: false,
|
|
@@ -6280,13 +6361,13 @@ function pairE2eProject(workspaceRoot, name) {
|
|
|
6280
6361
|
}
|
|
6281
6362
|
|
|
6282
6363
|
// src/project-scaffolding/react-lib.use-case.ts
|
|
6283
|
-
var
|
|
6364
|
+
var import_node_path31 = require("path");
|
|
6284
6365
|
var REACT_LIB_BUNDLER = "rollup";
|
|
6285
6366
|
async function addReactLib(workspaceRoot, name, options, kindProvided, stack) {
|
|
6286
6367
|
ensurePlugin(workspaceRoot, "@nx/react");
|
|
6287
6368
|
const scope = options.scope ?? (kindProvided ? defaultScope(workspaceRoot) : await promptText("npm scope for the published package", defaultScope(workspaceRoot)));
|
|
6288
|
-
const projectRoot = (0,
|
|
6289
|
-
const publishableManifest = (0,
|
|
6369
|
+
const projectRoot = (0, import_node_path31.join)(workspaceRoot, "packages", name);
|
|
6370
|
+
const publishableManifest = (0, import_node_path31.join)(projectRoot, "package.json");
|
|
6290
6371
|
runGeneratorAndRepair(
|
|
6291
6372
|
workspaceRoot,
|
|
6292
6373
|
[
|
|
@@ -6330,8 +6411,8 @@ function dropNxProjectName(manifestPath) {
|
|
|
6330
6411
|
}
|
|
6331
6412
|
function addReactInternalLib(workspaceRoot, name, stack, empty = false) {
|
|
6332
6413
|
ensurePlugin(workspaceRoot, "@nx/react");
|
|
6333
|
-
const projectRoot = (0,
|
|
6334
|
-
const privateManifest = (0,
|
|
6414
|
+
const projectRoot = (0, import_node_path31.join)(workspaceRoot, "libs", name);
|
|
6415
|
+
const privateManifest = (0, import_node_path31.join)(projectRoot, "package.json");
|
|
6335
6416
|
runGeneratorAndRepair(
|
|
6336
6417
|
workspaceRoot,
|
|
6337
6418
|
[
|
|
@@ -6358,8 +6439,8 @@ function addReactInternalLib(workspaceRoot, name, stack, empty = false) {
|
|
|
6358
6439
|
}
|
|
6359
6440
|
|
|
6360
6441
|
// src/project-scaffolding/vscode-extension.use-case.ts
|
|
6361
|
-
var
|
|
6362
|
-
var
|
|
6442
|
+
var import_node_fs29 = require("fs");
|
|
6443
|
+
var import_node_path32 = require("path");
|
|
6363
6444
|
var VSCODE_EXTENSION_SCRIPT_PATH = "tools/vscode-extension.cjs";
|
|
6364
6445
|
var VSCODE_ENGINE_FLOOR = "1.96.0";
|
|
6365
6446
|
var VSCODE_SIDECAR_TARGETS = {
|
|
@@ -6544,8 +6625,8 @@ export const window = {
|
|
|
6544
6625
|
var VSCODE_STUB_PATH = "test/vscode.stub.ts";
|
|
6545
6626
|
function mapVscodeToStub(projectRoot, testRunner) {
|
|
6546
6627
|
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}\` },`];
|
|
6547
|
-
const path = (0,
|
|
6548
|
-
const content = fileExists(path) ? (0,
|
|
6628
|
+
const path = (0, import_node_path32.join)(projectRoot, file);
|
|
6629
|
+
const content = fileExists(path) ? (0, import_node_fs29.readFileSync)(path, "utf8") : "";
|
|
6549
6630
|
const line = content.split("\n").find((candidate) => candidate.trim() === anchor);
|
|
6550
6631
|
if (line === void 0) {
|
|
6551
6632
|
throw new Error(`${file} has no "${anchor}" line to map the vscode module after; map 'vscode' to ${VSCODE_STUB_PATH} by hand.`);
|
|
@@ -6565,11 +6646,11 @@ function ensureVscodeToolchain(workspaceRoot) {
|
|
|
6565
6646
|
}
|
|
6566
6647
|
}
|
|
6567
6648
|
function defaultPublisher(workspaceRoot) {
|
|
6568
|
-
const { name } = readJson((0,
|
|
6649
|
+
const { name } = readJson((0, import_node_path32.join)(workspaceRoot, "package.json"));
|
|
6569
6650
|
return (name ?? "publisher").replace(/^@/, "").split("/", 1)[0];
|
|
6570
6651
|
}
|
|
6571
6652
|
function reshapeManifest(projectRoot, name, publisher) {
|
|
6572
|
-
const manifestPath = (0,
|
|
6653
|
+
const manifestPath = (0, import_node_path32.join)(projectRoot, "package.json");
|
|
6573
6654
|
const manifest = readJson(manifestPath);
|
|
6574
6655
|
const { nx = {}, ...rest } = manifest;
|
|
6575
6656
|
const targets = { ...nx.targets };
|
|
@@ -6633,11 +6714,11 @@ function vscodeExtensionPublishTarget(name, sidecar) {
|
|
|
6633
6714
|
};
|
|
6634
6715
|
}
|
|
6635
6716
|
function addDebugLaunch(workspaceRoot, name) {
|
|
6636
|
-
const file = (0,
|
|
6717
|
+
const file = (0, import_node_fs29.readdirSync)(workspaceRoot).find((entry) => entry.endsWith(".code-workspace"));
|
|
6637
6718
|
if (file === void 0) {
|
|
6638
6719
|
return;
|
|
6639
6720
|
}
|
|
6640
|
-
const path = (0,
|
|
6721
|
+
const path = (0, import_node_path32.join)(workspaceRoot, file);
|
|
6641
6722
|
const workspace = readCodeWorkspace(path) ?? {};
|
|
6642
6723
|
const folder = `\${workspaceFolder:${workspace.folders?.[0]?.name ?? file.replace(/\.code-workspace$/, "")}}`;
|
|
6643
6724
|
const taskLabel = `${name}: build (development)`;
|
|
@@ -6670,39 +6751,39 @@ function addDebugLaunch(workspaceRoot, name) {
|
|
|
6670
6751
|
);
|
|
6671
6752
|
}
|
|
6672
6753
|
function refreshVscodeExtensionScript(workspaceRoot) {
|
|
6673
|
-
const apps = (0,
|
|
6754
|
+
const apps = (0, import_node_path32.join)(workspaceRoot, "apps");
|
|
6674
6755
|
let entries;
|
|
6675
6756
|
try {
|
|
6676
|
-
entries = (0,
|
|
6757
|
+
entries = (0, import_node_fs29.readdirSync)(apps);
|
|
6677
6758
|
} catch {
|
|
6678
6759
|
return false;
|
|
6679
6760
|
}
|
|
6680
6761
|
const hasExtension = entries.some((entry) => {
|
|
6681
|
-
const manifestPath = (0,
|
|
6762
|
+
const manifestPath = (0, import_node_path32.join)(apps, entry, "package.json");
|
|
6682
6763
|
if (!fileExists(manifestPath)) {
|
|
6683
6764
|
return false;
|
|
6684
6765
|
}
|
|
6685
6766
|
const tags = readJson(manifestPath).nx?.tags ?? [];
|
|
6686
6767
|
return tags.includes(VSCODE_EXTENSION_TAG);
|
|
6687
6768
|
});
|
|
6688
|
-
const path = (0,
|
|
6689
|
-
if (!hasExtension || fileExists(path) && (0,
|
|
6769
|
+
const path = (0, import_node_path32.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH);
|
|
6770
|
+
if (!hasExtension || fileExists(path) && (0, import_node_fs29.readFileSync)(path, "utf8") === VSCODE_EXTENSION_SCRIPT) {
|
|
6690
6771
|
return false;
|
|
6691
6772
|
}
|
|
6692
6773
|
writeFileEnsured(path, VSCODE_EXTENSION_SCRIPT);
|
|
6693
6774
|
return true;
|
|
6694
6775
|
}
|
|
6695
6776
|
function pinVscodeExtensionProjectNames(workspaceRoot) {
|
|
6696
|
-
const apps = (0,
|
|
6777
|
+
const apps = (0, import_node_path32.join)(workspaceRoot, "apps");
|
|
6697
6778
|
let entries;
|
|
6698
6779
|
try {
|
|
6699
|
-
entries = (0,
|
|
6780
|
+
entries = (0, import_node_fs29.readdirSync)(apps);
|
|
6700
6781
|
} catch {
|
|
6701
6782
|
return [];
|
|
6702
6783
|
}
|
|
6703
6784
|
const updated = [];
|
|
6704
6785
|
for (const entry of entries) {
|
|
6705
|
-
const manifestPath = (0,
|
|
6786
|
+
const manifestPath = (0, import_node_path32.join)(apps, entry, "package.json");
|
|
6706
6787
|
if (!fileExists(manifestPath)) {
|
|
6707
6788
|
continue;
|
|
6708
6789
|
}
|
|
@@ -6722,22 +6803,22 @@ function refreshLockFile(workspaceRoot, name) {
|
|
|
6722
6803
|
}
|
|
6723
6804
|
function addVscodeExtension(workspaceRoot, name, stack, options = {}) {
|
|
6724
6805
|
const { sidecar } = options;
|
|
6725
|
-
if (sidecar !== void 0 && !fileExists((0,
|
|
6806
|
+
if (sidecar !== void 0 && !fileExists((0, import_node_path32.join)(workspaceRoot, "apps", sidecar, "project.json"))) {
|
|
6726
6807
|
throw new Error(`--sidecar ${sidecar}: no Go app at apps/${sidecar}. Add it first with \`mnci add go-app ${sidecar}\`.`);
|
|
6727
6808
|
}
|
|
6728
6809
|
runNodeApp(workspaceRoot, name, stack, "none");
|
|
6729
6810
|
ensureVscodeToolchain(workspaceRoot);
|
|
6730
|
-
const projectRoot = (0,
|
|
6811
|
+
const projectRoot = (0, import_node_path32.join)(workspaceRoot, "apps", name);
|
|
6731
6812
|
reshapeManifest(projectRoot, name, options.publisher ?? defaultPublisher(workspaceRoot));
|
|
6732
|
-
addVscodeTypes((0,
|
|
6733
|
-
addVscodeTypes((0,
|
|
6734
|
-
writeFileEnsured((0,
|
|
6735
|
-
writeFileEnsured((0,
|
|
6736
|
-
writeFileEnsured((0,
|
|
6813
|
+
addVscodeTypes((0, import_node_path32.join)(projectRoot, "tsconfig.app.json"));
|
|
6814
|
+
addVscodeTypes((0, import_node_path32.join)(projectRoot, "tsconfig.spec.json"));
|
|
6815
|
+
writeFileEnsured((0, import_node_path32.join)(projectRoot, "src/main.ts"), vscodeExtensionMain(name));
|
|
6816
|
+
writeFileEnsured((0, import_node_path32.join)(projectRoot, "src/main.spec.ts"), vscodeExtensionMainSpec(name));
|
|
6817
|
+
writeFileEnsured((0, import_node_path32.join)(projectRoot, VSCODE_STUB_PATH), VSCODE_STUB);
|
|
6737
6818
|
mapVscodeToStub(projectRoot, stack.testRunner);
|
|
6738
|
-
writeFileEnsured((0,
|
|
6739
|
-
writeFileEnsured((0,
|
|
6740
|
-
addNxTargets((0,
|
|
6819
|
+
writeFileEnsured((0, import_node_path32.join)(projectRoot, ".vscodeignore"), VSCODE_IGNORE);
|
|
6820
|
+
writeFileEnsured((0, import_node_path32.join)(workspaceRoot, VSCODE_EXTENSION_SCRIPT_PATH), VSCODE_EXTENSION_SCRIPT);
|
|
6821
|
+
addNxTargets((0, import_node_path32.join)(projectRoot, "package.json"), {
|
|
6741
6822
|
"package": vscodeExtensionPackageTarget(name, sidecar),
|
|
6742
6823
|
"nx-release-publish": vscodeExtensionPublishTarget(name, sidecar)
|
|
6743
6824
|
});
|
|
@@ -6748,12 +6829,12 @@ function addVscodeExtension(workspaceRoot, name, stack, options = {}) {
|
|
|
6748
6829
|
}
|
|
6749
6830
|
|
|
6750
6831
|
// src/dependency-management/install-dependencies.use-case.ts
|
|
6751
|
-
var
|
|
6752
|
-
var
|
|
6832
|
+
var import_node_fs31 = require("fs");
|
|
6833
|
+
var import_node_path34 = require("path");
|
|
6753
6834
|
|
|
6754
6835
|
// src/dependency-management/manifest.repository.ts
|
|
6755
|
-
var
|
|
6756
|
-
var
|
|
6836
|
+
var import_node_fs30 = require("fs");
|
|
6837
|
+
var import_node_path33 = require("path");
|
|
6757
6838
|
var ECOSYSTEMS = ["npm", "pip", "pub", "nuget", "go"];
|
|
6758
6839
|
var ROOT_LABEL = "(root)";
|
|
6759
6840
|
var MANIFEST_GLOBS = {
|
|
@@ -6786,23 +6867,23 @@ function projectOf(manifestRelativePath) {
|
|
|
6786
6867
|
}
|
|
6787
6868
|
function hasEcosystem(workspaceRoot, ecosystem) {
|
|
6788
6869
|
if (ecosystem === "go") {
|
|
6789
|
-
return fileExists((0,
|
|
6870
|
+
return fileExists((0, import_node_path33.join)(workspaceRoot, "go.mod"));
|
|
6790
6871
|
}
|
|
6791
6872
|
if (ecosystem === "nuget") {
|
|
6792
|
-
return (0,
|
|
6873
|
+
return (0, import_node_fs30.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot }).length > 0;
|
|
6793
6874
|
}
|
|
6794
6875
|
const rootMarker = {
|
|
6795
6876
|
npm: "package.json",
|
|
6796
6877
|
pip: "requirements-dev.txt",
|
|
6797
6878
|
pub: "pubspec.yaml"
|
|
6798
6879
|
};
|
|
6799
|
-
return fileExists((0,
|
|
6880
|
+
return fileExists((0, import_node_path33.join)(workspaceRoot, rootMarker[ecosystem])) || (0, import_node_fs30.globSync)(MANIFEST_GLOBS[ecosystem], { cwd: workspaceRoot }).length > 0;
|
|
6800
6881
|
}
|
|
6801
6882
|
function collectNpm(workspaceRoot) {
|
|
6802
6883
|
const sites = [];
|
|
6803
|
-
const relativePaths = ["package.json", ...(0,
|
|
6884
|
+
const relativePaths = ["package.json", ...(0, import_node_fs30.globSync)(MANIFEST_GLOBS.npm, { cwd: workspaceRoot })];
|
|
6804
6885
|
for (const relativePath of relativePaths) {
|
|
6805
|
-
const manifestPath = (0,
|
|
6886
|
+
const manifestPath = (0, import_node_path33.join)(workspaceRoot, relativePath);
|
|
6806
6887
|
try {
|
|
6807
6888
|
const manifest = readJson(manifestPath);
|
|
6808
6889
|
sites.push(...npmManifestSites(manifest, relativePath, manifestPath));
|
|
@@ -6863,17 +6944,17 @@ function collectPip(workspaceRoot) {
|
|
|
6863
6944
|
name: parsed.name,
|
|
6864
6945
|
ecosystem: "pip",
|
|
6865
6946
|
project: projectOf(relativePath),
|
|
6866
|
-
manifestPath: (0,
|
|
6947
|
+
manifestPath: (0, import_node_path33.join)(workspaceRoot, relativePath),
|
|
6867
6948
|
section,
|
|
6868
6949
|
spec: parsed.spec,
|
|
6869
6950
|
rewritable: parsed.rewritable && parsed.spec !== ""
|
|
6870
6951
|
});
|
|
6871
6952
|
};
|
|
6872
|
-
const pyprojectPaths = (0,
|
|
6953
|
+
const pyprojectPaths = (0, import_node_fs30.globSync)(MANIFEST_GLOBS.pip, { cwd: workspaceRoot });
|
|
6873
6954
|
for (const relativePath of pyprojectPaths) {
|
|
6874
6955
|
let content;
|
|
6875
6956
|
try {
|
|
6876
|
-
content = (0,
|
|
6957
|
+
content = (0, import_node_fs30.readFileSync)((0, import_node_path33.join)(workspaceRoot, relativePath), "utf8");
|
|
6877
6958
|
} catch {
|
|
6878
6959
|
continue;
|
|
6879
6960
|
}
|
|
@@ -6884,14 +6965,14 @@ function collectPip(workspaceRoot) {
|
|
|
6884
6965
|
}
|
|
6885
6966
|
const requirementsPaths = [
|
|
6886
6967
|
"requirements-dev.txt",
|
|
6887
|
-
...(0,
|
|
6968
|
+
...(0, import_node_fs30.globSync)("apps/*/requirements.txt", { cwd: workspaceRoot })
|
|
6888
6969
|
];
|
|
6889
6970
|
for (const relativePath of requirementsPaths) {
|
|
6890
|
-
if (!fileExists((0,
|
|
6971
|
+
if (!fileExists((0, import_node_path33.join)(workspaceRoot, relativePath))) {
|
|
6891
6972
|
continue;
|
|
6892
6973
|
}
|
|
6893
6974
|
const section = relativePath === "requirements-dev.txt" ? "devDep" : "dep";
|
|
6894
|
-
const lines = (0,
|
|
6975
|
+
const lines = (0, import_node_fs30.readFileSync)((0, import_node_path33.join)(workspaceRoot, relativePath), "utf8").split(/\r?\n/);
|
|
6895
6976
|
for (const line of lines) {
|
|
6896
6977
|
push(relativePath, section, line);
|
|
6897
6978
|
}
|
|
@@ -6929,11 +7010,11 @@ function pyprojectDependencies(content) {
|
|
|
6929
7010
|
}
|
|
6930
7011
|
function collectPub(workspaceRoot) {
|
|
6931
7012
|
const sites = [];
|
|
6932
|
-
const pubspecPaths = (0,
|
|
7013
|
+
const pubspecPaths = (0, import_node_fs30.globSync)(MANIFEST_GLOBS.pub, { cwd: workspaceRoot });
|
|
6933
7014
|
for (const relativePath of pubspecPaths) {
|
|
6934
7015
|
let content;
|
|
6935
7016
|
try {
|
|
6936
|
-
content = (0,
|
|
7017
|
+
content = (0, import_node_fs30.readFileSync)((0, import_node_path33.join)(workspaceRoot, relativePath), "utf8");
|
|
6937
7018
|
} catch {
|
|
6938
7019
|
continue;
|
|
6939
7020
|
}
|
|
@@ -6943,7 +7024,7 @@ function collectPub(workspaceRoot) {
|
|
|
6943
7024
|
name: entry.name,
|
|
6944
7025
|
ecosystem: "pub",
|
|
6945
7026
|
project: projectOf(relativePath),
|
|
6946
|
-
manifestPath: (0,
|
|
7027
|
+
manifestPath: (0, import_node_path33.join)(workspaceRoot, relativePath),
|
|
6947
7028
|
section: block === "dependencies" ? "dep" : "devDep",
|
|
6948
7029
|
spec: entry.spec,
|
|
6949
7030
|
rewritable: entry.spec !== ""
|
|
@@ -6993,11 +7074,11 @@ function stripQuotes(value) {
|
|
|
6993
7074
|
}
|
|
6994
7075
|
function collectNuget(workspaceRoot) {
|
|
6995
7076
|
const sites = [];
|
|
6996
|
-
const csprojPaths = (0,
|
|
7077
|
+
const csprojPaths = (0, import_node_fs30.globSync)(MANIFEST_GLOBS.nuget, { cwd: workspaceRoot });
|
|
6997
7078
|
for (const relativePath of csprojPaths) {
|
|
6998
7079
|
let content;
|
|
6999
7080
|
try {
|
|
7000
|
-
content = (0,
|
|
7081
|
+
content = (0, import_node_fs30.readFileSync)((0, import_node_path33.join)(workspaceRoot, relativePath), "utf8");
|
|
7001
7082
|
} catch {
|
|
7002
7083
|
continue;
|
|
7003
7084
|
}
|
|
@@ -7006,7 +7087,7 @@ function collectNuget(workspaceRoot) {
|
|
|
7006
7087
|
name: entry.name,
|
|
7007
7088
|
ecosystem: "nuget",
|
|
7008
7089
|
project: projectOf(relativePath),
|
|
7009
|
-
manifestPath: (0,
|
|
7090
|
+
manifestPath: (0, import_node_path33.join)(workspaceRoot, relativePath),
|
|
7010
7091
|
section: "dep",
|
|
7011
7092
|
spec: entry.spec,
|
|
7012
7093
|
// A plain SemVer string is rewritable; an MSBuild property reference
|
|
@@ -7031,13 +7112,13 @@ function csprojPackageReferences(content) {
|
|
|
7031
7112
|
return entries;
|
|
7032
7113
|
}
|
|
7033
7114
|
function collectGo(workspaceRoot) {
|
|
7034
|
-
const manifestPath = (0,
|
|
7115
|
+
const manifestPath = (0, import_node_path33.join)(workspaceRoot, "go.mod");
|
|
7035
7116
|
if (!fileExists(manifestPath)) {
|
|
7036
7117
|
return [];
|
|
7037
7118
|
}
|
|
7038
7119
|
let content;
|
|
7039
7120
|
try {
|
|
7040
|
-
content = (0,
|
|
7121
|
+
content = (0, import_node_fs30.readFileSync)(manifestPath, "utf8");
|
|
7041
7122
|
} catch {
|
|
7042
7123
|
return [];
|
|
7043
7124
|
}
|
|
@@ -7086,7 +7167,7 @@ var PROJECT_GLOBS = {
|
|
|
7086
7167
|
function locateProjects(workspaceRoot) {
|
|
7087
7168
|
const locations = [];
|
|
7088
7169
|
for (const ecosystem of ECOSYSTEMS) {
|
|
7089
|
-
const relativePaths = (0,
|
|
7170
|
+
const relativePaths = (0, import_node_fs30.globSync)(PROJECT_GLOBS[ecosystem], { cwd: workspaceRoot });
|
|
7090
7171
|
for (const relativePath of relativePaths) {
|
|
7091
7172
|
const posix = toPosix(relativePath);
|
|
7092
7173
|
const dir = posix.slice(0, posix.lastIndexOf("/"));
|
|
@@ -7094,7 +7175,7 @@ function locateProjects(workspaceRoot) {
|
|
|
7094
7175
|
ecosystem,
|
|
7095
7176
|
dir,
|
|
7096
7177
|
name: dir.slice(dir.lastIndexOf("/") + 1),
|
|
7097
|
-
manifestPath: (0,
|
|
7178
|
+
manifestPath: (0, import_node_path33.join)(workspaceRoot, relativePath)
|
|
7098
7179
|
});
|
|
7099
7180
|
}
|
|
7100
7181
|
}
|
|
@@ -7115,7 +7196,7 @@ function rewriteSpec(site, spec) {
|
|
|
7115
7196
|
writeFileEnsured(site.manifestPath, toJson(manifest));
|
|
7116
7197
|
return true;
|
|
7117
7198
|
}
|
|
7118
|
-
const before = (0,
|
|
7199
|
+
const before = (0, import_node_fs30.readFileSync)(site.manifestPath, "utf8");
|
|
7119
7200
|
const after = (() => {
|
|
7120
7201
|
switch (site.ecosystem) {
|
|
7121
7202
|
case "pip": {
|
|
@@ -7206,13 +7287,13 @@ function escapeForRegex(value) {
|
|
|
7206
7287
|
function isWorkspaceProject(workspaceRoot, name) {
|
|
7207
7288
|
const short = name.includes("/") ? name.split("/").at(-1) : name;
|
|
7208
7289
|
return ["apps", "libs", "packages"].some(
|
|
7209
|
-
(directory) => fileExists((0,
|
|
7290
|
+
(directory) => fileExists((0, import_node_path33.join)(workspaceRoot, directory, short ?? name, "package.json"))
|
|
7210
7291
|
);
|
|
7211
7292
|
}
|
|
7212
7293
|
function isAliasedInstall(workspaceRoot, name) {
|
|
7213
7294
|
try {
|
|
7214
7295
|
const installed = readJson(
|
|
7215
|
-
(0,
|
|
7296
|
+
(0, import_node_path33.join)(workspaceRoot, "node_modules", name, "package.json")
|
|
7216
7297
|
);
|
|
7217
7298
|
return installed.name !== void 0 && installed.name !== name;
|
|
7218
7299
|
} catch {
|
|
@@ -7223,14 +7304,14 @@ function resolvedVersion(workspaceRoot, ecosystem, name) {
|
|
|
7223
7304
|
if (ecosystem === "npm") {
|
|
7224
7305
|
try {
|
|
7225
7306
|
return readJson(
|
|
7226
|
-
(0,
|
|
7307
|
+
(0, import_node_path33.join)(workspaceRoot, "node_modules", name, "package.json")
|
|
7227
7308
|
).version;
|
|
7228
7309
|
} catch {
|
|
7229
7310
|
return void 0;
|
|
7230
7311
|
}
|
|
7231
7312
|
}
|
|
7232
7313
|
if (ecosystem === "pub") {
|
|
7233
|
-
const lockPath = (0,
|
|
7314
|
+
const lockPath = (0, import_node_path33.join)(workspaceRoot, "pubspec.lock");
|
|
7234
7315
|
if (!fileExists(lockPath)) {
|
|
7235
7316
|
return void 0;
|
|
7236
7317
|
}
|
|
@@ -7238,7 +7319,7 @@ function resolvedVersion(workspaceRoot, ecosystem, name) {
|
|
|
7238
7319
|
const match = new RegExp(
|
|
7239
7320
|
String.raw`^\s{2}${escapeForRegex(name)}:[^]*?^\s+version:\s*["']?([^"'\s]+)`,
|
|
7240
7321
|
"m"
|
|
7241
|
-
).exec((0,
|
|
7322
|
+
).exec((0, import_node_fs30.readFileSync)(lockPath, "utf8"));
|
|
7242
7323
|
return match?.[1];
|
|
7243
7324
|
} catch {
|
|
7244
7325
|
return void 0;
|
|
@@ -7304,7 +7385,7 @@ function resolveTarget(locations, target) {
|
|
|
7304
7385
|
return byName[0];
|
|
7305
7386
|
}
|
|
7306
7387
|
function installInto(workspaceRoot, location, packages, saveDev) {
|
|
7307
|
-
const projectDir = (0,
|
|
7388
|
+
const projectDir = (0, import_node_path34.join)(workspaceRoot, location.dir);
|
|
7308
7389
|
switch (location.ecosystem) {
|
|
7309
7390
|
case "npm": {
|
|
7310
7391
|
const flags = saveDev ? ["--save-dev"] : [];
|
|
@@ -7357,7 +7438,7 @@ function installInto(workspaceRoot, location, packages, saveDev) {
|
|
|
7357
7438
|
function addPythonDependency(manifestPath, specifier) {
|
|
7358
7439
|
let content;
|
|
7359
7440
|
try {
|
|
7360
|
-
content = (0,
|
|
7441
|
+
content = (0, import_node_fs31.readFileSync)(manifestPath, "utf8");
|
|
7361
7442
|
} catch {
|
|
7362
7443
|
logger.warn(`Could not read ${manifestPath} \u2014 skipped ${specifier}`);
|
|
7363
7444
|
return;
|
|
@@ -7386,7 +7467,7 @@ function installEverything(workspaceRoot, only) {
|
|
|
7386
7467
|
}
|
|
7387
7468
|
function ecosystemPresent(workspaceRoot, ecosystem) {
|
|
7388
7469
|
if (ecosystem === "go") {
|
|
7389
|
-
return fileExists((0,
|
|
7470
|
+
return fileExists((0, import_node_path34.join)(workspaceRoot, "go.work")) || fileExists((0, import_node_path34.join)(workspaceRoot, "go.mod"));
|
|
7390
7471
|
}
|
|
7391
7472
|
return hasEcosystem(workspaceRoot, ecosystem);
|
|
7392
7473
|
}
|
|
@@ -7405,7 +7486,7 @@ function splitAtLast(value, separator) {
|
|
|
7405
7486
|
}
|
|
7406
7487
|
|
|
7407
7488
|
// src/dependency-management/sync-dependencies.use-case.ts
|
|
7408
|
-
var
|
|
7489
|
+
var import_node_path35 = require("path");
|
|
7409
7490
|
|
|
7410
7491
|
// src/dependency-management/semver.algorithm.ts
|
|
7411
7492
|
var UPDATE_KINDS = ["patch", "minor", "major", "non-semver"];
|
|
@@ -7582,7 +7663,7 @@ function describe(finding) {
|
|
|
7582
7663
|
return `${finding.name} \u2192 ${finding.target} (${finding.reason}); disagreeing: ${sites}`;
|
|
7583
7664
|
}
|
|
7584
7665
|
function runSync(workspaceRoot, options) {
|
|
7585
|
-
if (!fileExists((0,
|
|
7666
|
+
if (!fileExists((0, import_node_path35.join)(workspaceRoot, "nx.json"))) {
|
|
7586
7667
|
throw new Error(
|
|
7587
7668
|
`No nx.json found in ${workspaceRoot} \u2014 run 'mnci sync' from the workspace root.`
|
|
7588
7669
|
);
|
|
@@ -7632,7 +7713,7 @@ function runSync(workspaceRoot, options) {
|
|
|
7632
7713
|
}
|
|
7633
7714
|
|
|
7634
7715
|
// src/dependency-management/update-dependencies.use-case.ts
|
|
7635
|
-
var
|
|
7716
|
+
var import_node_path36 = require("path");
|
|
7636
7717
|
var import_prompts2 = require("@inquirer/prompts");
|
|
7637
7718
|
|
|
7638
7719
|
// src/dependency-management/registry.client.ts
|
|
@@ -7915,7 +7996,7 @@ function reinstall(workspaceRoot, ecosystems) {
|
|
|
7915
7996
|
function hasPythonInstallScript(workspaceRoot) {
|
|
7916
7997
|
try {
|
|
7917
7998
|
const manifest = readJson(
|
|
7918
|
-
(0,
|
|
7999
|
+
(0, import_node_path36.join)(workspaceRoot, "package.json")
|
|
7919
8000
|
);
|
|
7920
8001
|
return manifest.scripts?.["python:install"] !== void 0;
|
|
7921
8002
|
} catch {
|
|
@@ -7931,7 +8012,7 @@ function applyGoUpdates(workspaceRoot, entries) {
|
|
|
7931
8012
|
}
|
|
7932
8013
|
}
|
|
7933
8014
|
async function runUp(workspaceRoot, options) {
|
|
7934
|
-
if (!fileExists((0,
|
|
8015
|
+
if (!fileExists((0, import_node_path36.join)(workspaceRoot, "nx.json"))) {
|
|
7935
8016
|
throw new Error(`No nx.json found in ${workspaceRoot} \u2014 run 'mnci up' from the workspace root.`);
|
|
7936
8017
|
}
|
|
7937
8018
|
const ecosystems = resolveEcosystems(options.ecosystem);
|
|
@@ -8009,7 +8090,7 @@ var PROJECT_KINDS = [
|
|
|
8009
8090
|
var EMPTY_KINDS = /* @__PURE__ */ new Set(["npm-lib", "internal-lib", "react-lib", "react-internal-lib", "node-function-app"]);
|
|
8010
8091
|
async function runAdd(kind, name, options) {
|
|
8011
8092
|
const workspaceRoot = process.cwd();
|
|
8012
|
-
if (!fileExists((0,
|
|
8093
|
+
if (!fileExists((0, import_node_path37.join)(workspaceRoot, "nx.json"))) {
|
|
8013
8094
|
throw new Error("No nx.json found here. Run `add` from the workspace root.");
|
|
8014
8095
|
}
|
|
8015
8096
|
const stack = readWorkspaceStack(workspaceRoot);
|
|
@@ -8094,8 +8175,8 @@ async function runAdd(kind, name, options) {
|
|
|
8094
8175
|
],
|
|
8095
8176
|
workspaceRoot
|
|
8096
8177
|
);
|
|
8097
|
-
markPrivate((0,
|
|
8098
|
-
renameScaffoldPlaceholder((0,
|
|
8178
|
+
markPrivate((0, import_node_path37.join)(workspaceRoot, "libs", resolvedName, "package.json"));
|
|
8179
|
+
renameScaffoldPlaceholder((0, import_node_path37.join)(workspaceRoot, "libs", resolvedName), resolvedName, options.empty === true);
|
|
8099
8180
|
removeGeneratedEslintConfig(workspaceRoot, `libs/${resolvedName}`);
|
|
8100
8181
|
registerProjectCommands(workspaceRoot, resolvedName, { build: true });
|
|
8101
8182
|
break;
|
|
@@ -8191,7 +8272,7 @@ async function runAdd(kind, name, options) {
|
|
|
8191
8272
|
}
|
|
8192
8273
|
function readWorkspaceStack(workspaceRoot) {
|
|
8193
8274
|
const nxJson = readJson(
|
|
8194
|
-
(0,
|
|
8275
|
+
(0, import_node_path37.join)(workspaceRoot, "nx.json")
|
|
8195
8276
|
);
|
|
8196
8277
|
const stack = nxJson.mnci?.stack;
|
|
8197
8278
|
return {
|
|
@@ -8280,11 +8361,11 @@ function spawnProject(workspaceRoot, project, target, onLine) {
|
|
|
8280
8361
|
}
|
|
8281
8362
|
|
|
8282
8363
|
// src/dev-servers/startable-projects.use-case.ts
|
|
8283
|
-
var
|
|
8364
|
+
var import_node_path38 = require("path");
|
|
8284
8365
|
var START_SUFFIX = ":start";
|
|
8285
8366
|
var NX_RUN = /\bnx run [^\s:]+:(\S+)/;
|
|
8286
8367
|
function listStartableProjects(workspaceRoot) {
|
|
8287
|
-
const manifestPath = (0,
|
|
8368
|
+
const manifestPath = (0, import_node_path38.join)(workspaceRoot, "package.json");
|
|
8288
8369
|
if (!fileExists(manifestPath)) {
|
|
8289
8370
|
return [];
|
|
8290
8371
|
}
|
|
@@ -8357,8 +8438,22 @@ async function runDev(workspaceRoot, named, options = {}, dependencies = {}) {
|
|
|
8357
8438
|
|
|
8358
8439
|
// src/workspace-diagnostics/check-invariants.use-case.ts
|
|
8359
8440
|
var import_node_child_process2 = require("child_process");
|
|
8360
|
-
var
|
|
8361
|
-
var
|
|
8441
|
+
var import_node_fs33 = require("fs");
|
|
8442
|
+
var import_node_path40 = require("path");
|
|
8443
|
+
|
|
8444
|
+
// src/workspace-diagnostics/check-react-app-output.use-case.ts
|
|
8445
|
+
function checkReactAppOutput(workspaceRoot) {
|
|
8446
|
+
const apps = findReactAppsSharingOutput(workspaceRoot);
|
|
8447
|
+
if (apps.length === 0) {
|
|
8448
|
+
return void 0;
|
|
8449
|
+
}
|
|
8450
|
+
return {
|
|
8451
|
+
check: "React apps' tsc output is not the folder Vite builds into",
|
|
8452
|
+
ok: false,
|
|
8453
|
+
detail: `${apps.join(", ")}: tsconfig.app.json writes to the same folder as the Vite bundle, which Vite empties on each build, so build and typecheck running together fail intermittently with TS6305`,
|
|
8454
|
+
remedy: "run `mnci upgrade`, which moves tsc output to out-tsc/app"
|
|
8455
|
+
};
|
|
8456
|
+
}
|
|
8362
8457
|
|
|
8363
8458
|
// src/release-tag-lineage/create-baseline-tags.use-case.ts
|
|
8364
8459
|
function createBaselineTags(repositoryRoot, stranded) {
|
|
@@ -8376,8 +8471,8 @@ function createBaselineTags(repositoryRoot, stranded) {
|
|
|
8376
8471
|
}
|
|
8377
8472
|
|
|
8378
8473
|
// src/release-tag-lineage/locate-stranded-release-tags.use-case.ts
|
|
8379
|
-
var
|
|
8380
|
-
var
|
|
8474
|
+
var import_node_fs32 = require("fs");
|
|
8475
|
+
var import_node_path39 = require("path");
|
|
8381
8476
|
|
|
8382
8477
|
// src/release-tag-lineage/stranded-release-tags.algorithm.ts
|
|
8383
8478
|
function compareVersions2(left, right) {
|
|
@@ -8414,7 +8509,7 @@ function locateStrandedReleaseTags(workspaceRoot, tagPattern) {
|
|
|
8414
8509
|
if (listed.status !== 0) {
|
|
8415
8510
|
return [];
|
|
8416
8511
|
}
|
|
8417
|
-
const projects = (0,
|
|
8512
|
+
const projects = (0, import_node_fs32.globSync)("{apps,libs,packages}/*/package.json", { cwd: workspaceRoot }).map((path) => readJson((0, import_node_path39.join)(workspaceRoot, path))).filter((manifest) => manifest.private !== true && manifest.name !== void 0).map((manifest) => manifest.name);
|
|
8418
8513
|
return findStrandedReleaseTags(projects, listed.stdout.split(/\r?\n/).filter(Boolean));
|
|
8419
8514
|
}
|
|
8420
8515
|
|
|
@@ -8435,8 +8530,8 @@ function toPosix2(path) {
|
|
|
8435
8530
|
return path.replaceAll("\\", "/");
|
|
8436
8531
|
}
|
|
8437
8532
|
function checkEslintConfigs(workspaceRoot) {
|
|
8438
|
-
const rootConfigs = (0,
|
|
8439
|
-
const projectConfigs = (0,
|
|
8533
|
+
const rootConfigs = (0, import_node_fs33.globSync)("eslint.config.{js,mjs,cjs,ts,mts,cts}", { cwd: workspaceRoot });
|
|
8534
|
+
const projectConfigs = (0, import_node_fs33.globSync)("{apps,libs,packages}/*/eslint.config.{js,mjs,cjs,ts,mts,cts}", {
|
|
8440
8535
|
cwd: workspaceRoot
|
|
8441
8536
|
}).map((config) => toPosix2(config));
|
|
8442
8537
|
return [
|
|
@@ -8456,10 +8551,10 @@ function checkEslintConfigs(workspaceRoot) {
|
|
|
8456
8551
|
];
|
|
8457
8552
|
}
|
|
8458
8553
|
function checkEslintEntryPointReachesTheRules(workspaceRoot) {
|
|
8459
|
-
const rules = (0,
|
|
8460
|
-
if (!(0,
|
|
8461
|
-
const entryPoint = (0,
|
|
8462
|
-
const source = (0,
|
|
8554
|
+
const rules = (0, import_node_path40.join)(workspaceRoot, ESLINT_MNCI_FILENAME);
|
|
8555
|
+
if (!(0, import_node_fs33.existsSync)(rules)) return [];
|
|
8556
|
+
const entryPoint = (0, import_node_path40.join)(workspaceRoot, ESLINT_USER_FILENAME);
|
|
8557
|
+
const source = (0, import_node_fs33.existsSync)(entryPoint) ? (0, import_node_fs33.readFileSync)(entryPoint, "utf8") : "";
|
|
8463
8558
|
return [
|
|
8464
8559
|
{
|
|
8465
8560
|
check: `${ESLINT_USER_FILENAME} imports the mnci rules`,
|
|
@@ -8472,7 +8567,7 @@ function checkEslintEntryPointReachesTheRules(workspaceRoot) {
|
|
|
8472
8567
|
function declaredDevDependencies(workspaceRoot) {
|
|
8473
8568
|
try {
|
|
8474
8569
|
const manifest = readJson(
|
|
8475
|
-
(0,
|
|
8570
|
+
(0, import_node_path40.join)(workspaceRoot, "package.json")
|
|
8476
8571
|
);
|
|
8477
8572
|
return manifest.devDependencies ?? {};
|
|
8478
8573
|
} catch {
|
|
@@ -8480,7 +8575,7 @@ function declaredDevDependencies(workspaceRoot) {
|
|
|
8480
8575
|
}
|
|
8481
8576
|
}
|
|
8482
8577
|
function checkNoRetiredFormatter(workspaceRoot) {
|
|
8483
|
-
const files = RETIRED_FORMATTER_FILES.filter((file) => fileExists((0,
|
|
8578
|
+
const files = RETIRED_FORMATTER_FILES.filter((file) => fileExists((0, import_node_path40.join)(workspaceRoot, file)));
|
|
8484
8579
|
const declared = ["prettier", "eslint-config-prettier", "oxlint", "oxfmt", "@mnci/oxlint-config"].filter((name) => declaredDevDependencies(workspaceRoot)[name] !== void 0);
|
|
8485
8580
|
const stale = [...files, ...declared];
|
|
8486
8581
|
if (stale.length === 0) {
|
|
@@ -8506,7 +8601,7 @@ function checkEslintPlugin(nxJson) {
|
|
|
8506
8601
|
};
|
|
8507
8602
|
}
|
|
8508
8603
|
function checkResolvedEslint(workspaceRoot) {
|
|
8509
|
-
const manifestPath = (0,
|
|
8604
|
+
const manifestPath = (0, import_node_path40.join)(workspaceRoot, "node_modules/eslint/package.json");
|
|
8510
8605
|
if (!fileExists(manifestPath)) {
|
|
8511
8606
|
return void 0;
|
|
8512
8607
|
}
|
|
@@ -8524,11 +8619,11 @@ function checkResolvedEslint(workspaceRoot) {
|
|
|
8524
8619
|
}
|
|
8525
8620
|
}
|
|
8526
8621
|
function checkNpmrc(workspaceRoot, registry, scope) {
|
|
8527
|
-
const npmrcPath = (0,
|
|
8622
|
+
const npmrcPath = (0, import_node_path40.join)(workspaceRoot, ".npmrc");
|
|
8528
8623
|
if (!registry || !fileExists(npmrcPath)) {
|
|
8529
8624
|
return void 0;
|
|
8530
8625
|
}
|
|
8531
|
-
const npmrc = (0,
|
|
8626
|
+
const npmrc = (0, import_node_fs33.readFileSync)(npmrcPath, "utf8");
|
|
8532
8627
|
if (registry.kind === "npm") {
|
|
8533
8628
|
return {
|
|
8534
8629
|
check: ".npmrc authenticates the public registry",
|
|
@@ -8545,11 +8640,11 @@ function checkNpmrc(workspaceRoot, registry, scope) {
|
|
|
8545
8640
|
};
|
|
8546
8641
|
}
|
|
8547
8642
|
function checkNpmrcCredentialResolves(workspaceRoot, environment = process.env) {
|
|
8548
|
-
const npmrcPath = (0,
|
|
8643
|
+
const npmrcPath = (0, import_node_path40.join)(workspaceRoot, ".npmrc");
|
|
8549
8644
|
if (!fileExists(npmrcPath)) {
|
|
8550
8645
|
return void 0;
|
|
8551
8646
|
}
|
|
8552
|
-
const npmrc = (0,
|
|
8647
|
+
const npmrc = (0, import_node_fs33.readFileSync)(npmrcPath, "utf8");
|
|
8553
8648
|
const credentials = npmrc.split("\n").filter((line) => !line.trimStart().startsWith(";") && !line.trimStart().startsWith("#")).filter((line) => /(?:_authToken|_password|_auth)\s*=/u.test(line));
|
|
8554
8649
|
const referenced = [
|
|
8555
8650
|
...new Set(
|
|
@@ -8573,13 +8668,13 @@ function checkNpmrcCredentialResolves(workspaceRoot, environment = process.env)
|
|
|
8573
8668
|
};
|
|
8574
8669
|
}
|
|
8575
8670
|
function checkNpmAuthMatchesPipeline(workspaceRoot, registry) {
|
|
8576
|
-
const npmrcPath = (0,
|
|
8577
|
-
const pipelinePath = (0,
|
|
8671
|
+
const npmrcPath = (0, import_node_path40.join)(workspaceRoot, ".npmrc");
|
|
8672
|
+
const pipelinePath = (0, import_node_path40.join)(workspaceRoot, "azure-pipelines.yml");
|
|
8578
8673
|
if (registry?.kind !== "azure-artifacts" || !fileExists(npmrcPath) || !fileExists(pipelinePath)) {
|
|
8579
8674
|
return void 0;
|
|
8580
8675
|
}
|
|
8581
|
-
const holdsCredentials = (0,
|
|
8582
|
-
const runsTask = (0,
|
|
8676
|
+
const holdsCredentials = (0, import_node_fs33.readFileSync)(npmrcPath, "utf8").split("\n").filter((line) => !line.trimStart().startsWith(";") && !line.trimStart().startsWith("#")).some((line) => /(?:_authToken|_password|_auth)\s*=/u.test(line));
|
|
8677
|
+
const runsTask = (0, import_node_fs33.readFileSync)(pipelinePath, "utf8").includes("npmAuthenticate@0");
|
|
8583
8678
|
if (!holdsCredentials && !runsTask) {
|
|
8584
8679
|
return {
|
|
8585
8680
|
check: "npm auth: .npmrc and azure-pipelines.yml agree",
|
|
@@ -8619,18 +8714,18 @@ function npmjsCredentialShape(credentials, environment) {
|
|
|
8619
8714
|
check: "the credential bound for npmjs.org looks like an npm token",
|
|
8620
8715
|
ok: false,
|
|
8621
8716
|
detail: `\${${variable}} is set (${value.length} characters) but does not start with '${NPM_TOKEN_PREFIX}' and is not a legacy UUID token, so it is probably a credential for somewhere else \u2014 '${variable}' is a generic name that other tooling also sets, and inside this workspace it is sent to the PUBLIC registry. A write then fails as a 404 on the PUT, which reads like a missing package`,
|
|
8622
|
-
remedy:
|
|
8717
|
+
remedy: `find where \`${variable}\` is set (shell profile, CI secret, another tool) and whether it is meant for npm. If it is not, unset \`${variable}\` for local work. If it is meant to be an npm token, check it with \`npm whoami\` run OUTSIDE this workspace (the project .npmrc would send it to the public registry from in here), or set it to a real npm token`
|
|
8623
8718
|
};
|
|
8624
8719
|
}
|
|
8625
8720
|
function checkVersionActions(workspaceRoot) {
|
|
8626
8721
|
const candidates = [
|
|
8627
|
-
...(0,
|
|
8628
|
-
...(0,
|
|
8629
|
-
...(0,
|
|
8722
|
+
...(0, import_node_fs33.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }),
|
|
8723
|
+
...(0, import_node_fs33.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }),
|
|
8724
|
+
...(0, import_node_fs33.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot })
|
|
8630
8725
|
].map((manifest) => toPosix2(manifest));
|
|
8631
8726
|
return candidates.flatMap((manifest) => {
|
|
8632
8727
|
const projectRoot = manifest.slice(0, manifest.lastIndexOf("/"));
|
|
8633
|
-
const projectJsonPath = (0,
|
|
8728
|
+
const projectJsonPath = (0, import_node_path40.join)(workspaceRoot, projectRoot, "project.json");
|
|
8634
8729
|
let hasOverride = false;
|
|
8635
8730
|
try {
|
|
8636
8731
|
const projectJson = readJson(projectJsonPath);
|
|
@@ -8659,7 +8754,7 @@ function declaredTargets(workspaceRoot, projectRoot) {
|
|
|
8659
8754
|
]) {
|
|
8660
8755
|
try {
|
|
8661
8756
|
const targets = extract(
|
|
8662
|
-
readJson((0,
|
|
8757
|
+
readJson((0, import_node_path40.join)(workspaceRoot, projectRoot, file))
|
|
8663
8758
|
);
|
|
8664
8759
|
if (targets && typeof targets === "object") {
|
|
8665
8760
|
sources.push({
|
|
@@ -8675,8 +8770,8 @@ function declaredTargets(workspaceRoot, projectRoot) {
|
|
|
8675
8770
|
function checkTargetFilesExist(workspaceRoot) {
|
|
8676
8771
|
const projectRoots = new Set(
|
|
8677
8772
|
[
|
|
8678
|
-
...(0,
|
|
8679
|
-
...(0,
|
|
8773
|
+
...(0, import_node_fs33.globSync)("{apps,libs,packages}/*/project.json", { cwd: workspaceRoot }),
|
|
8774
|
+
...(0, import_node_fs33.globSync)("{apps,libs,packages}/*/package.json", { cwd: workspaceRoot })
|
|
8680
8775
|
].map((manifest) => toPosix2(manifest).split("/").slice(0, 2).join("/"))
|
|
8681
8776
|
);
|
|
8682
8777
|
return [...projectRoots].flatMap(
|
|
@@ -8691,7 +8786,7 @@ function checkOneTargetsFiles(workspaceRoot, source, targetName, target) {
|
|
|
8691
8786
|
return TARGET_FILE_OPTIONS.flatMap((option) => {
|
|
8692
8787
|
const value = target?.options?.[option];
|
|
8693
8788
|
const checkable = typeof value === "string" && !value.includes("{");
|
|
8694
|
-
if (!checkable || fileExists((0,
|
|
8789
|
+
if (!checkable || fileExists((0, import_node_path40.join)(workspaceRoot, value))) {
|
|
8695
8790
|
return [];
|
|
8696
8791
|
}
|
|
8697
8792
|
return [
|
|
@@ -8730,15 +8825,15 @@ function checkGoPluginRegistered(workspaceRoot) {
|
|
|
8730
8825
|
};
|
|
8731
8826
|
}
|
|
8732
8827
|
function checkGoWorkInSync(workspaceRoot) {
|
|
8733
|
-
const goWorkPath = (0,
|
|
8828
|
+
const goWorkPath = (0, import_node_path40.join)(workspaceRoot, "go.work");
|
|
8734
8829
|
if (!fileExists(goWorkPath)) {
|
|
8735
8830
|
return void 0;
|
|
8736
8831
|
}
|
|
8737
|
-
const contents = (0,
|
|
8832
|
+
const contents = (0, import_node_fs33.existsSync)(goWorkPath) ? (0, import_node_fs33.readFileSync)(goWorkPath, "utf8") : "";
|
|
8738
8833
|
const blockEntries = Array.from(contents.matchAll(/(?:^|\n)\s*use\s+\(([^)]*)\)/g), (match) => match[1].split("\n")).flat();
|
|
8739
8834
|
const singleEntries = Array.from(contents.matchAll(/(?:^|\n)\s*use\s+(\.\S+)/g), (match) => match[1]);
|
|
8740
8835
|
const uses = [...blockEntries, ...singleEntries].map((entry) => entry.trim()).filter(Boolean);
|
|
8741
|
-
const stale = uses.filter((entry) => !(0,
|
|
8836
|
+
const stale = uses.filter((entry) => !(0, import_node_fs33.existsSync)((0, import_node_path40.join)(workspaceRoot, entry, "go.mod")));
|
|
8742
8837
|
return {
|
|
8743
8838
|
check: "every go.work `use` entry points to a module that still exists",
|
|
8744
8839
|
ok: stale.length === 0,
|
|
@@ -8754,9 +8849,9 @@ function checkNativeApps(workspaceRoot) {
|
|
|
8754
8849
|
{ file: ".github/workflows/ci.yml", marker: "native (${{ matrix.os }})" },
|
|
8755
8850
|
{ file: "azure-pipelines.yml", marker: "- job: native" }
|
|
8756
8851
|
];
|
|
8757
|
-
const findings = pipelines.filter(({ file }) => fileExists((0,
|
|
8852
|
+
const findings = pipelines.filter(({ file }) => fileExists((0, import_node_path40.join)(workspaceRoot, file))).map(({ file, marker }) => ({
|
|
8758
8853
|
check: `${file} builds the native apps on every OS`,
|
|
8759
|
-
ok: (0,
|
|
8854
|
+
ok: (0, import_node_fs33.readFileSync)((0, import_node_path40.join)(workspaceRoot, file), "utf8").includes(marker),
|
|
8760
8855
|
detail: `${file} has no native job: CI would verify a cgo app on the one agent that cannot build it`,
|
|
8761
8856
|
remedy: "run `mnci upgrade`"
|
|
8762
8857
|
}));
|
|
@@ -8769,7 +8864,7 @@ function checkNativeApps(workspaceRoot) {
|
|
|
8769
8864
|
return findings;
|
|
8770
8865
|
}
|
|
8771
8866
|
function checkNoRootRuntimeDependencies(workspaceRoot) {
|
|
8772
|
-
const manifestPath = (0,
|
|
8867
|
+
const manifestPath = (0, import_node_path40.join)(workspaceRoot, "package.json");
|
|
8773
8868
|
if (!fileExists(manifestPath)) {
|
|
8774
8869
|
return void 0;
|
|
8775
8870
|
}
|
|
@@ -8789,14 +8884,14 @@ function checkNoRootRuntimeDependencies(workspaceRoot) {
|
|
|
8789
8884
|
};
|
|
8790
8885
|
}
|
|
8791
8886
|
function checkRollupSourceMaps(workspaceRoot) {
|
|
8792
|
-
const configs = (0,
|
|
8887
|
+
const configs = (0, import_node_fs33.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
|
|
8793
8888
|
cwd: workspaceRoot
|
|
8794
8889
|
}).map((config) => toPosix2(config));
|
|
8795
8890
|
return configs.flatMap((relativePath) => {
|
|
8796
|
-
const configPath = (0,
|
|
8891
|
+
const configPath = (0, import_node_path40.join)(workspaceRoot, relativePath);
|
|
8797
8892
|
let config;
|
|
8798
8893
|
try {
|
|
8799
|
-
config = (0,
|
|
8894
|
+
config = (0, import_node_fs33.readFileSync)(configPath, "utf8");
|
|
8800
8895
|
} catch {
|
|
8801
8896
|
return [];
|
|
8802
8897
|
}
|
|
@@ -8811,11 +8906,11 @@ function checkRollupSourceMaps(workspaceRoot) {
|
|
|
8811
8906
|
});
|
|
8812
8907
|
}
|
|
8813
8908
|
function checkDeclarationSpecifiers(workspaceRoot) {
|
|
8814
|
-
const configs = (0,
|
|
8909
|
+
const configs = (0, import_node_fs33.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
|
|
8815
8910
|
cwd: workspaceRoot
|
|
8816
8911
|
}).map((config) => toPosix2(config));
|
|
8817
8912
|
return configs.flatMap((relativePath) => {
|
|
8818
|
-
const configPath = (0,
|
|
8913
|
+
const configPath = (0, import_node_path40.join)(workspaceRoot, relativePath);
|
|
8819
8914
|
if (!fileExists(configPath)) {
|
|
8820
8915
|
return [];
|
|
8821
8916
|
}
|
|
@@ -8830,7 +8925,7 @@ function checkDeclarationSpecifiers(workspaceRoot) {
|
|
|
8830
8925
|
// `plugins` array (what @nx/react:library writes). For any other shape it would no-op, and
|
|
8831
8926
|
// naming a command that silently does nothing is the failure mode the source-map check
|
|
8832
8927
|
// above goes out of its way to avoid, so the remedy depends on the shape.
|
|
8833
|
-
remedy: canAddDeclarationSpecifierPlugin((0,
|
|
8928
|
+
remedy: canAddDeclarationSpecifierPlugin((0, import_node_fs33.readFileSync)(configPath, "utf8")) ? "run `mnci upgrade`, which adds the plugin to the plugins array of withNx's second argument" : "add the plugin to withNx's second argument by hand (copy it from a freshly `mnci add npm-lib`'d project) \u2014 mnci does not recognise the shape of this config, so `mnci upgrade` cannot add it"
|
|
8834
8929
|
}
|
|
8835
8930
|
];
|
|
8836
8931
|
}
|
|
@@ -8846,8 +8941,8 @@ function checkDeclarationSpecifiers(workspaceRoot) {
|
|
|
8846
8941
|
}
|
|
8847
8942
|
function checkPipelinePhases(workspaceRoot) {
|
|
8848
8943
|
const files = ["azure-pipelines.yml", ".github/workflows/ci.yml"];
|
|
8849
|
-
return files.filter((file) => fileExists((0,
|
|
8850
|
-
const { verifyActive, switchedOff } = inspectPipeline((0,
|
|
8944
|
+
return files.filter((file) => fileExists((0, import_node_path40.join)(workspaceRoot, file))).flatMap((file) => {
|
|
8945
|
+
const { verifyActive, switchedOff } = inspectPipeline((0, import_node_fs33.readFileSync)((0, import_node_path40.join)(workspaceRoot, file), "utf8"));
|
|
8851
8946
|
const verify = {
|
|
8852
8947
|
check: `${file} runs the enforced verify phase`,
|
|
8853
8948
|
ok: verifyActive,
|
|
@@ -8888,7 +8983,7 @@ function checkDependencyRangesNotPreserved(nxJson) {
|
|
|
8888
8983
|
};
|
|
8889
8984
|
}
|
|
8890
8985
|
function checkLockfileHasNoLocalRegistry(workspaceRoot) {
|
|
8891
|
-
if (!fileExists((0,
|
|
8986
|
+
if (!fileExists((0, import_node_path40.join)(workspaceRoot, "package-lock.json"))) {
|
|
8892
8987
|
return void 0;
|
|
8893
8988
|
}
|
|
8894
8989
|
return {
|
|
@@ -8899,7 +8994,7 @@ function checkLockfileHasNoLocalRegistry(workspaceRoot) {
|
|
|
8899
8994
|
};
|
|
8900
8995
|
}
|
|
8901
8996
|
function collectFindings(workspaceRoot) {
|
|
8902
|
-
const nxJsonPath = (0,
|
|
8997
|
+
const nxJsonPath = (0, import_node_path40.join)(workspaceRoot, "nx.json");
|
|
8903
8998
|
if (!fileExists(nxJsonPath)) {
|
|
8904
8999
|
throw new Error(
|
|
8905
9000
|
`No nx.json found in ${workspaceRoot} \u2014 run 'mnci doctor' from the workspace root.`
|
|
@@ -8927,7 +9022,8 @@ function collectFindings(workspaceRoot) {
|
|
|
8927
9022
|
...checkNativeBuildConfig(workspaceRoot),
|
|
8928
9023
|
checkDependencyRangesNotPreserved(nxJson),
|
|
8929
9024
|
checkLockfileHasNoLocalRegistry(workspaceRoot),
|
|
8930
|
-
checkReleaseTagsResolve(workspaceRoot, nxJson)
|
|
9025
|
+
checkReleaseTagsResolve(workspaceRoot, nxJson),
|
|
9026
|
+
checkReactAppOutput(workspaceRoot)
|
|
8931
9027
|
].filter((finding) => finding !== void 0);
|
|
8932
9028
|
}
|
|
8933
9029
|
function runDoctor(workspaceRoot, options = {}) {
|
|
@@ -8964,8 +9060,8 @@ function runDoctor(workspaceRoot, options = {}) {
|
|
|
8964
9060
|
}
|
|
8965
9061
|
|
|
8966
9062
|
// src/dependency-adoption/adopt-dependencies.use-case.ts
|
|
8967
|
-
var
|
|
8968
|
-
var
|
|
9063
|
+
var import_node_fs34 = require("fs");
|
|
9064
|
+
var import_node_path41 = require("path");
|
|
8969
9065
|
|
|
8970
9066
|
// src/clean-working-tree/clean-working-tree.validator.ts
|
|
8971
9067
|
function requireCleanWorkingTree(repositoryRoot, capture = runCapture) {
|
|
@@ -9036,7 +9132,7 @@ var SOURCE_FILE = /\.(?:[cm]?[jt]s|[jt]sx)$/;
|
|
|
9036
9132
|
var TEST_FILE = /\.(?:spec|test)\.[^.]+$|[\\/](?:__tests__|tests?|e2e)[\\/]/;
|
|
9037
9133
|
var SKIPPED_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage", "out", ".git", ".nx", "tmp"]);
|
|
9038
9134
|
function sourceFiles(directory, relative = "") {
|
|
9039
|
-
const entries = (0,
|
|
9135
|
+
const entries = (0, import_node_fs34.readdirSync)((0, import_node_path41.join)(directory, relative), { withFileTypes: true });
|
|
9040
9136
|
const found = [];
|
|
9041
9137
|
for (const entry of entries) {
|
|
9042
9138
|
const path = relative === "" ? entry.name : `${relative}/${entry.name}`;
|
|
@@ -9052,7 +9148,7 @@ function sourceFiles(directory, relative = "") {
|
|
|
9052
9148
|
}
|
|
9053
9149
|
function wantedImportsOf(path, wanted) {
|
|
9054
9150
|
try {
|
|
9055
|
-
const imported = [...extractImportedPackages((0,
|
|
9151
|
+
const imported = [...extractImportedPackages((0, import_node_fs34.readFileSync)(path, "utf8"))];
|
|
9056
9152
|
return imported.filter((name) => wanted.has(name));
|
|
9057
9153
|
} catch {
|
|
9058
9154
|
return [];
|
|
@@ -9063,7 +9159,7 @@ function importsOfProject(projectDirectory, wanted) {
|
|
|
9063
9159
|
const tested = /* @__PURE__ */ new Set();
|
|
9064
9160
|
const files = sourceFiles(projectDirectory);
|
|
9065
9161
|
for (const file of files) {
|
|
9066
|
-
const names = wantedImportsOf((0,
|
|
9162
|
+
const names = wantedImportsOf((0, import_node_path41.join)(projectDirectory, file), wanted);
|
|
9067
9163
|
const target = TEST_FILE.test(file) ? tested : shipped;
|
|
9068
9164
|
for (const name of names) {
|
|
9069
9165
|
target.add(name);
|
|
@@ -9075,7 +9171,7 @@ function importsOfProject(projectDirectory, wanted) {
|
|
|
9075
9171
|
function findUsage(repositoryRoot, projectDirectories, wanted) {
|
|
9076
9172
|
const usage = {};
|
|
9077
9173
|
for (const dir of projectDirectories) {
|
|
9078
|
-
const { shipped, testsOnly } = importsOfProject((0,
|
|
9174
|
+
const { shipped, testsOnly } = importsOfProject((0, import_node_path41.join)(repositoryRoot, dir), wanted);
|
|
9079
9175
|
for (const name of shipped) {
|
|
9080
9176
|
usage[name] ??= { runtime: [], testsOnly: [] };
|
|
9081
9177
|
usage[name].runtime.push(dir);
|
|
@@ -9090,7 +9186,7 @@ function findUsage(repositoryRoot, projectDirectories, wanted) {
|
|
|
9090
9186
|
function adoptDependencies(repositoryRoot, dependencies = {}) {
|
|
9091
9187
|
const run = dependencies.run ?? runShell;
|
|
9092
9188
|
requireCleanWorkingTree(repositoryRoot, dependencies.capture ?? runCapture);
|
|
9093
|
-
const rootPath = (0,
|
|
9189
|
+
const rootPath = (0, import_node_path41.join)(repositoryRoot, "package.json");
|
|
9094
9190
|
if (!fileExists(rootPath)) {
|
|
9095
9191
|
throw new Error("No package.json at the repository root.");
|
|
9096
9192
|
}
|
|
@@ -9125,8 +9221,8 @@ function adoptDependencies(repositoryRoot, dependencies = {}) {
|
|
|
9125
9221
|
}
|
|
9126
9222
|
|
|
9127
9223
|
// src/kind-adoption/adopt-kinds.use-case.ts
|
|
9128
|
-
var
|
|
9129
|
-
var
|
|
9224
|
+
var import_node_fs35 = require("fs");
|
|
9225
|
+
var import_node_path42 = require("path");
|
|
9130
9226
|
|
|
9131
9227
|
// src/kind-adoption/infer-project-kind.algorithm.ts
|
|
9132
9228
|
var SERVER_FRAMEWORKS = ["express", "koa", "fastify", "@nestjs/core"];
|
|
@@ -9227,32 +9323,32 @@ function inferProjectKind(evidence) {
|
|
|
9227
9323
|
// src/kind-adoption/adopt-kinds.use-case.ts
|
|
9228
9324
|
var TYPE_TAG = "type:";
|
|
9229
9325
|
function readEvidence(repositoryRoot, location) {
|
|
9230
|
-
const directory = (0,
|
|
9231
|
-
const files = (0,
|
|
9326
|
+
const directory = (0, import_node_path42.join)(repositoryRoot, location.dir);
|
|
9327
|
+
const files = (0, import_node_fs35.readdirSync)(directory);
|
|
9232
9328
|
const manifest = location.ecosystem === "npm" ? readJson(location.manifestPath) : {};
|
|
9233
|
-
const text = location.ecosystem === "npm" ? "" : (0,
|
|
9329
|
+
const text = location.ecosystem === "npm" ? "" : (0, import_node_fs35.readFileSync)(location.manifestPath, "utf8");
|
|
9234
9330
|
let hasProgram = false;
|
|
9235
9331
|
if (location.ecosystem === "go") {
|
|
9236
|
-
hasProgram = files.filter((file) => file.endsWith(".go")).some((file) => /^package main\b/m.test((0,
|
|
9332
|
+
hasProgram = files.filter((file) => file.endsWith(".go")).some((file) => /^package main\b/m.test((0, import_node_fs35.readFileSync)((0, import_node_path42.join)(directory, file), "utf8")));
|
|
9237
9333
|
} else if (location.ecosystem === "pub") {
|
|
9238
|
-
hasProgram = (0,
|
|
9334
|
+
hasProgram = (0, import_node_fs35.existsSync)((0, import_node_path42.join)(directory, "lib", "main.dart"));
|
|
9239
9335
|
}
|
|
9240
9336
|
return { ecosystem: location.ecosystem, manifest, text, files, hasProgram };
|
|
9241
9337
|
}
|
|
9242
9338
|
function existingKind(directory) {
|
|
9243
9339
|
const sources = [];
|
|
9244
|
-
if (fileExists((0,
|
|
9245
|
-
sources.push(readJson((0,
|
|
9340
|
+
if (fileExists((0, import_node_path42.join)(directory, "project.json"))) {
|
|
9341
|
+
sources.push(readJson((0, import_node_path42.join)(directory, "project.json")).tags ?? []);
|
|
9246
9342
|
}
|
|
9247
|
-
if (fileExists((0,
|
|
9248
|
-
sources.push(readJson((0,
|
|
9343
|
+
if (fileExists((0, import_node_path42.join)(directory, "package.json"))) {
|
|
9344
|
+
sources.push(readJson((0, import_node_path42.join)(directory, "package.json")).nx?.tags ?? []);
|
|
9249
9345
|
}
|
|
9250
9346
|
return sources.flat().find((tag) => tag.startsWith(TYPE_TAG))?.slice(TYPE_TAG.length);
|
|
9251
9347
|
}
|
|
9252
9348
|
function writeKindTag(directory, name, kind) {
|
|
9253
9349
|
const tag = `${TYPE_TAG}${kind}`;
|
|
9254
|
-
const projectJson = (0,
|
|
9255
|
-
const packageJson = (0,
|
|
9350
|
+
const projectJson = (0, import_node_path42.join)(directory, "project.json");
|
|
9351
|
+
const packageJson = (0, import_node_path42.join)(directory, "package.json");
|
|
9256
9352
|
if (fileExists(projectJson)) {
|
|
9257
9353
|
const project = readJson(projectJson);
|
|
9258
9354
|
writeFileEnsured(projectJson, toJson({ ...project, tags: [...project.tags ?? [], tag] }));
|
|
@@ -9276,7 +9372,7 @@ function adoptKinds(repositoryRoot, overrides = {}, dependencies = {}) {
|
|
|
9276
9372
|
}
|
|
9277
9373
|
}
|
|
9278
9374
|
return locations.map((location) => {
|
|
9279
|
-
const directory = (0,
|
|
9375
|
+
const directory = (0, import_node_path42.join)(repositoryRoot, location.dir);
|
|
9280
9376
|
const present = existingKind(directory);
|
|
9281
9377
|
if (present !== void 0) {
|
|
9282
9378
|
return { dir: location.dir, outcome: "already", kind: present, reason: PROJECT_KINDS.includes(present) ? "it already has a type tag" : "it already has a type tag of its own, which is not an mnci kind name; left as it is" };
|
|
@@ -9292,12 +9388,12 @@ function adoptKinds(repositoryRoot, overrides = {}, dependencies = {}) {
|
|
|
9292
9388
|
}
|
|
9293
9389
|
|
|
9294
9390
|
// src/repository-adoption/adopt-overlay.use-case.ts
|
|
9295
|
-
var
|
|
9296
|
-
var
|
|
9391
|
+
var import_node_fs37 = require("fs");
|
|
9392
|
+
var import_node_path44 = require("path");
|
|
9297
9393
|
|
|
9298
9394
|
// src/workspace-upgrade/upgrade-workspace.use-case.ts
|
|
9299
|
-
var
|
|
9300
|
-
var
|
|
9395
|
+
var import_node_fs36 = require("fs");
|
|
9396
|
+
var import_node_path43 = require("path");
|
|
9301
9397
|
function resolveRegistry(options, persisted) {
|
|
9302
9398
|
if (options.registry === "azure-artifacts" || options.organization && options.artifactsFeed) {
|
|
9303
9399
|
const persistedAzure = persisted?.kind === "azure-artifacts" ? persisted : void 0;
|
|
@@ -9326,7 +9422,7 @@ function resolveWorkspaceName(workspaceRoot, persisted) {
|
|
|
9326
9422
|
return persisted.workspaceName;
|
|
9327
9423
|
}
|
|
9328
9424
|
try {
|
|
9329
|
-
const existing = (0,
|
|
9425
|
+
const existing = (0, import_node_fs36.readdirSync)(workspaceRoot).find(
|
|
9330
9426
|
(file) => file.endsWith(".code-workspace") && file !== "undefined.code-workspace"
|
|
9331
9427
|
);
|
|
9332
9428
|
if (existing) {
|
|
@@ -9334,11 +9430,11 @@ function resolveWorkspaceName(workspaceRoot, persisted) {
|
|
|
9334
9430
|
}
|
|
9335
9431
|
} catch {
|
|
9336
9432
|
}
|
|
9337
|
-
return (0,
|
|
9433
|
+
return (0, import_node_path43.basename)(workspaceRoot);
|
|
9338
9434
|
}
|
|
9339
9435
|
function detectNpmAuth(workspaceRoot) {
|
|
9340
9436
|
try {
|
|
9341
|
-
return (0,
|
|
9437
|
+
return (0, import_node_fs36.readFileSync)((0, import_node_path43.join)(workspaceRoot, "azure-pipelines.yml"), "utf8").includes("npmAuthenticate@0") ? "build-identity" : void 0;
|
|
9342
9438
|
} catch {
|
|
9343
9439
|
return void 0;
|
|
9344
9440
|
}
|
|
@@ -9385,7 +9481,7 @@ function resolveOverlayOptions(workspaceRoot, options, persisted) {
|
|
|
9385
9481
|
};
|
|
9386
9482
|
}
|
|
9387
9483
|
function runUpgrade(workspaceRoot, options) {
|
|
9388
|
-
if (!fileExists((0,
|
|
9484
|
+
if (!fileExists((0, import_node_path43.join)(workspaceRoot, "nx.json"))) {
|
|
9389
9485
|
throw new Error(
|
|
9390
9486
|
`No nx.json found in ${workspaceRoot} \u2014 this does not look like an Nx workspace. Run 'mnci upgrade' from the workspace root.`
|
|
9391
9487
|
);
|
|
@@ -9433,6 +9529,13 @@ function runUpgrade(workspaceRoot, options) {
|
|
|
9433
9529
|
logger.step("Updating the VS Code extension packaging script");
|
|
9434
9530
|
logger.detail(`updated ${VSCODE_EXTENSION_SCRIPT_PATH}`);
|
|
9435
9531
|
}
|
|
9532
|
+
const separatedApps = separateReactAppsOutput(workspaceRoot);
|
|
9533
|
+
if (separatedApps.length > 0) {
|
|
9534
|
+
logger.step("Moving tsc output out of the folder Vite builds into (build and typecheck raced, TS6305)");
|
|
9535
|
+
for (const dir of separatedApps) {
|
|
9536
|
+
logger.detail(`updated ${dir}/tsconfig.app.json`);
|
|
9537
|
+
}
|
|
9538
|
+
}
|
|
9436
9539
|
if (refreshContainerScript(workspaceRoot)) {
|
|
9437
9540
|
logger.step("Updating the container image script");
|
|
9438
9541
|
logger.detail("updated tools/container-image.cjs");
|
|
@@ -9463,7 +9566,7 @@ function runUpgrade(workspaceRoot, options) {
|
|
|
9463
9566
|
"Formatting the workspace (eslint --fix) \u2014 the slowest step, minutes on a large workspace"
|
|
9464
9567
|
);
|
|
9465
9568
|
runFormatter(workspaceRoot);
|
|
9466
|
-
const nxJson = readJson((0,
|
|
9569
|
+
const nxJson = readJson((0, import_node_path43.join)(workspaceRoot, "nx.json"));
|
|
9467
9570
|
const stranded = locateStrandedReleaseTags(workspaceRoot, nxJson.release?.releaseTag?.pattern);
|
|
9468
9571
|
for (const entry of stranded) {
|
|
9469
9572
|
logger.warn(`${entry.project} has release tags only under ${entry.oldTag}: nx release would restart it from its disk version. Run \`mnci adopt --tags\` before the next release to create ${entry.newTag} locally (\`mnci doctor\` lists them all).`);
|
|
@@ -9474,9 +9577,9 @@ function runUpgrade(workspaceRoot, options) {
|
|
|
9474
9577
|
|
|
9475
9578
|
// src/repository-adoption/adopt-overlay.use-case.ts
|
|
9476
9579
|
function detectCiProvider(repositoryRoot) {
|
|
9477
|
-
const azure = (0,
|
|
9478
|
-
const workflows = (0,
|
|
9479
|
-
const github = (0,
|
|
9580
|
+
const azure = (0, import_node_fs37.existsSync)((0, import_node_path44.join)(repositoryRoot, "azure-pipelines.yml"));
|
|
9581
|
+
const workflows = (0, import_node_path44.join)(repositoryRoot, ".github", "workflows");
|
|
9582
|
+
const github = (0, import_node_fs37.existsSync)(workflows) && (0, import_node_fs37.readdirSync)(workflows).some((file) => /\.ya?ml$/.test(file));
|
|
9480
9583
|
if (azure && github) {
|
|
9481
9584
|
return "both";
|
|
9482
9585
|
}
|
|
@@ -9486,7 +9589,7 @@ function detectCiProvider(repositoryRoot) {
|
|
|
9486
9589
|
return github ? "github" : void 0;
|
|
9487
9590
|
}
|
|
9488
9591
|
function detectTestRunner(repositoryRoot) {
|
|
9489
|
-
const manifestPath = (0,
|
|
9592
|
+
const manifestPath = (0, import_node_path44.join)(repositoryRoot, "package.json");
|
|
9490
9593
|
if (!fileExists(manifestPath)) {
|
|
9491
9594
|
return void 0;
|
|
9492
9595
|
}
|
|
@@ -9499,7 +9602,7 @@ function detectTestRunner(repositoryRoot) {
|
|
|
9499
9602
|
}
|
|
9500
9603
|
function adoptOverlay(repositoryRoot, options, dependencies = {}) {
|
|
9501
9604
|
requireCleanWorkingTree(repositoryRoot, dependencies.capture ?? runCapture);
|
|
9502
|
-
if (!fileExists((0,
|
|
9605
|
+
if (!fileExists((0, import_node_path44.join)(repositoryRoot, "nx.json"))) {
|
|
9503
9606
|
throw new Error("There is no nx.json, so Nx is not set up here. Run `mnci adopt --toolchain` first: it sets Nx up (nx init, then nx add), and the overlay needs that.");
|
|
9504
9607
|
}
|
|
9505
9608
|
const persisted = readMnciConfig(repositoryRoot);
|
|
@@ -9512,7 +9615,7 @@ function adoptOverlay(repositoryRoot, options, dependencies = {}) {
|
|
|
9512
9615
|
}
|
|
9513
9616
|
|
|
9514
9617
|
// src/toolchain-adoption/adopt-toolchain.use-case.ts
|
|
9515
|
-
var
|
|
9618
|
+
var import_node_path47 = require("path");
|
|
9516
9619
|
|
|
9517
9620
|
// src/toolchain-adoption/align-nx-family.algorithm.ts
|
|
9518
9621
|
var VERSION = /^[\^~]?(\d+)\.(\d+)\.(\d+)$/;
|
|
@@ -9550,7 +9653,7 @@ function alignNxFamily(dependencies, version) {
|
|
|
9550
9653
|
}
|
|
9551
9654
|
|
|
9552
9655
|
// src/toolchain-adoption/bootstrap-nx.use-case.ts
|
|
9553
|
-
var
|
|
9656
|
+
var import_node_path45 = require("path");
|
|
9554
9657
|
var BASE_PLUGIN = "@nx/js";
|
|
9555
9658
|
var TOOL_PLUGINS = [
|
|
9556
9659
|
["eslint", "@nx/eslint"],
|
|
@@ -9558,13 +9661,13 @@ var TOOL_PLUGINS = [
|
|
|
9558
9661
|
["vitest", "@nx/vite"]
|
|
9559
9662
|
];
|
|
9560
9663
|
function pluginsFor(repositoryRoot) {
|
|
9561
|
-
const manifestPath = (0,
|
|
9664
|
+
const manifestPath = (0, import_node_path45.join)(repositoryRoot, "package.json");
|
|
9562
9665
|
const manifest = fileExists(manifestPath) ? readJson(manifestPath) : {};
|
|
9563
9666
|
const declared = Object.keys({ ...manifest.dependencies, ...manifest.devDependencies });
|
|
9564
9667
|
return [BASE_PLUGIN, ...TOOL_PLUGINS.filter(([tool]) => declared.includes(tool)).map(([, plugin]) => plugin)];
|
|
9565
9668
|
}
|
|
9566
9669
|
function bootstrapNx(repositoryRoot, nxVersion, dependencies) {
|
|
9567
|
-
if (fileExists((0,
|
|
9670
|
+
if (fileExists((0, import_node_path45.join)(repositoryRoot, "nx.json"))) {
|
|
9568
9671
|
return { bootstrapped: false, plugins: [] };
|
|
9569
9672
|
}
|
|
9570
9673
|
const initialised = dependencies.run("npx", ["--yes", `nx@${nxVersion ?? "latest"}`, "init", "--interactive=false", "--nxCloud=skip", "--plugins=skip"], repositoryRoot);
|
|
@@ -9581,24 +9684,24 @@ function bootstrapNx(repositoryRoot, nxVersion, dependencies) {
|
|
|
9581
9684
|
}
|
|
9582
9685
|
|
|
9583
9686
|
// src/toolchain-adoption/retire-tooling.use-case.ts
|
|
9584
|
-
var
|
|
9585
|
-
var
|
|
9687
|
+
var import_node_fs38 = require("fs");
|
|
9688
|
+
var import_node_path46 = require("path");
|
|
9586
9689
|
var RETIRED_COMMAND = /\b(?:prettier|oxfmt|oxlint)\b/;
|
|
9587
9690
|
function retireTooling(repositoryRoot) {
|
|
9588
9691
|
const removed = [];
|
|
9589
9692
|
for (const file of RETIRED_FORMATTER_FILES) {
|
|
9590
|
-
if (!fileExists((0,
|
|
9693
|
+
if (!fileExists((0, import_node_path46.join)(repositoryRoot, file))) {
|
|
9591
9694
|
continue;
|
|
9592
9695
|
}
|
|
9593
|
-
(0,
|
|
9696
|
+
(0, import_node_fs38.rmSync)((0, import_node_path46.join)(repositoryRoot, file), { force: true });
|
|
9594
9697
|
removed.push(file);
|
|
9595
9698
|
}
|
|
9596
|
-
const hadRegistry = fileExists((0,
|
|
9699
|
+
const hadRegistry = fileExists((0, import_node_path46.join)(repositoryRoot, ".verdaccio"));
|
|
9597
9700
|
removeLocalRegistryScaffolding(repositoryRoot);
|
|
9598
9701
|
if (hadRegistry) {
|
|
9599
9702
|
removed.push(".verdaccio, its dependency and the local-registry target");
|
|
9600
9703
|
}
|
|
9601
|
-
const manifestPath = (0,
|
|
9704
|
+
const manifestPath = (0, import_node_path46.join)(repositoryRoot, "package.json");
|
|
9602
9705
|
if (!fileExists(manifestPath)) {
|
|
9603
9706
|
return removed;
|
|
9604
9707
|
}
|
|
@@ -9645,7 +9748,7 @@ function adoptToolchain(repositoryRoot, options = {}, dependencies = {}) {
|
|
|
9645
9748
|
console.log(message);
|
|
9646
9749
|
});
|
|
9647
9750
|
requireCleanWorkingTree(repositoryRoot, capture);
|
|
9648
|
-
const manifestPath = (0,
|
|
9751
|
+
const manifestPath = (0, import_node_path47.join)(repositoryRoot, "package.json");
|
|
9649
9752
|
if (!fileExists(manifestPath)) {
|
|
9650
9753
|
throw new Error("No package.json at the repository root.");
|
|
9651
9754
|
}
|
|
@@ -9684,8 +9787,8 @@ function adoptToolchain(repositoryRoot, options = {}, dependencies = {}) {
|
|
|
9684
9787
|
}
|
|
9685
9788
|
|
|
9686
9789
|
// src/adoption-report/inspect-repository.use-case.ts
|
|
9687
|
-
var
|
|
9688
|
-
var
|
|
9790
|
+
var import_node_fs39 = require("fs");
|
|
9791
|
+
var import_node_path48 = require("path");
|
|
9689
9792
|
var LOCKFILES = [
|
|
9690
9793
|
["package-lock.json", "npm"],
|
|
9691
9794
|
["pnpm-lock.yaml", "pnpm"],
|
|
@@ -9706,25 +9809,25 @@ function inspectRepository(repositoryRoot) {
|
|
|
9706
9809
|
const isGitRepo = inside.status === 0 && inside.stdout.trim() === "true";
|
|
9707
9810
|
const dirty = isGitRepo && runCapture("git", ["status", "--porcelain"], repositoryRoot).stdout.trim() !== "";
|
|
9708
9811
|
const tags = isGitRepo ? runCapture("git", ["tag", "--list"], repositoryRoot).stdout.split(/\r?\n/).filter(Boolean) : [];
|
|
9709
|
-
const manifestPath = (0,
|
|
9812
|
+
const manifestPath = (0, import_node_path48.join)(repositoryRoot, "package.json");
|
|
9710
9813
|
const manifest = fileExists(manifestPath) ? readJson(manifestPath) : {};
|
|
9711
|
-
const nxJsonPath = (0,
|
|
9814
|
+
const nxJsonPath = (0, import_node_path48.join)(repositoryRoot, "nx.json");
|
|
9712
9815
|
const nxJson = fileExists(nxJsonPath) ? readJson(nxJsonPath) : {};
|
|
9713
9816
|
const ci = [];
|
|
9714
9817
|
const pipelines = [];
|
|
9715
|
-
if ((0,
|
|
9818
|
+
if ((0, import_node_fs39.existsSync)((0, import_node_path48.join)(repositoryRoot, "azure-pipelines.yml"))) {
|
|
9716
9819
|
ci.push("azure");
|
|
9717
|
-
pipelines.push((0,
|
|
9820
|
+
pipelines.push((0, import_node_path48.join)(repositoryRoot, "azure-pipelines.yml"));
|
|
9718
9821
|
}
|
|
9719
|
-
const workflows = (0,
|
|
9720
|
-
if ((0,
|
|
9721
|
-
const files = (0,
|
|
9822
|
+
const workflows = (0, import_node_path48.join)(repositoryRoot, ".github", "workflows");
|
|
9823
|
+
if ((0, import_node_fs39.existsSync)(workflows)) {
|
|
9824
|
+
const files = (0, import_node_fs39.readdirSync)(workflows).filter((file) => /\.ya?ml$/.test(file));
|
|
9722
9825
|
if (files.length > 0) {
|
|
9723
9826
|
ci.push("github");
|
|
9724
|
-
pipelines.push(...files.map((file) => (0,
|
|
9827
|
+
pipelines.push(...files.map((file) => (0, import_node_path48.join)(workflows, file)));
|
|
9725
9828
|
}
|
|
9726
9829
|
}
|
|
9727
|
-
const rootFiles = (0,
|
|
9830
|
+
const rootFiles = (0, import_node_fs39.readdirSync)(repositoryRoot);
|
|
9728
9831
|
return {
|
|
9729
9832
|
isGitRepo,
|
|
9730
9833
|
dirty,
|
|
@@ -9735,7 +9838,7 @@ function inspectRepository(repositoryRoot) {
|
|
|
9735
9838
|
tagCount: tags.length,
|
|
9736
9839
|
strandedTags: isGitRepo ? locateStrandedReleaseTags(repositoryRoot, nxJson.release?.releaseTag?.pattern) : [],
|
|
9737
9840
|
ci,
|
|
9738
|
-
pipelineUsesMnci: pipelines.some((file) => /\bmnci ci\b/.test((0,
|
|
9841
|
+
pipelineUsesMnci: pipelines.some((file) => /\bmnci ci\b/.test((0, import_node_fs39.readFileSync)(file, "utf8"))),
|
|
9739
9842
|
retiredTooling: [.../* @__PURE__ */ new Set([...rootFiles.filter((file) => RETIRED_FILE_PATTERN.test(file) || file === ".verdaccio"), ...retiredNamesIn(manifest)])],
|
|
9740
9843
|
personalFiles: PERSONAL_FILES.filter((file) => rootFiles.includes(file))
|
|
9741
9844
|
};
|
|
@@ -10038,13 +10141,13 @@ function runCommands(program, options) {
|
|
|
10038
10141
|
}
|
|
10039
10142
|
|
|
10040
10143
|
// src/workspace-info/list-projects.use-case.ts
|
|
10041
|
-
var
|
|
10144
|
+
var import_node_path49 = require("path");
|
|
10042
10145
|
var TYPE_TAG_PREFIX = "type:";
|
|
10043
10146
|
function listProjects(workspaceRoot) {
|
|
10044
10147
|
return locateProjects(workspaceRoot).map((location) => {
|
|
10045
|
-
const projectJsonPath = (0,
|
|
10148
|
+
const projectJsonPath = (0, import_node_path49.join)(workspaceRoot, location.dir, "project.json");
|
|
10046
10149
|
const project = fileExists(projectJsonPath) ? readJson(projectJsonPath) : {};
|
|
10047
|
-
const manifestPath = (0,
|
|
10150
|
+
const manifestPath = (0, import_node_path49.join)(workspaceRoot, location.dir, "package.json");
|
|
10048
10151
|
const manifestTags = fileExists(manifestPath) ? readJson(manifestPath).nx?.tags ?? [] : [];
|
|
10049
10152
|
const typeTag = [...project.tags ?? [], ...manifestTags].find((tag) => tag.startsWith(TYPE_TAG_PREFIX));
|
|
10050
10153
|
return {
|
|
@@ -10057,7 +10160,7 @@ function listProjects(workspaceRoot) {
|
|
|
10057
10160
|
}).toSorted((a, b) => a.dir.localeCompare(b.dir));
|
|
10058
10161
|
}
|
|
10059
10162
|
function runProjects(workspaceRoot, options) {
|
|
10060
|
-
if (!fileExists((0,
|
|
10163
|
+
if (!fileExists((0, import_node_path49.join)(workspaceRoot, "nx.json"))) {
|
|
10061
10164
|
throw new Error("No nx.json found here. Run `projects` from the workspace root.");
|
|
10062
10165
|
}
|
|
10063
10166
|
const projects = listProjects(workspaceRoot);
|
|
@@ -10071,11 +10174,11 @@ function runProjects(workspaceRoot, options) {
|
|
|
10071
10174
|
}
|
|
10072
10175
|
|
|
10073
10176
|
// src/workspace-info/read-workspace-info.use-case.ts
|
|
10074
|
-
var
|
|
10177
|
+
var import_node_path51 = require("path");
|
|
10075
10178
|
|
|
10076
10179
|
// src/cli-version/check-for-update.use-case.ts
|
|
10077
|
-
var
|
|
10078
|
-
var
|
|
10180
|
+
var import_node_fs40 = require("fs");
|
|
10181
|
+
var import_node_path50 = require("path");
|
|
10079
10182
|
var import_cross_spawn4 = __toESM(require("cross-spawn"));
|
|
10080
10183
|
var PACKAGE_NAME2 = "@mnci/cli";
|
|
10081
10184
|
var REGISTRY_TIMEOUT_MS = 2e3;
|
|
@@ -10134,8 +10237,8 @@ function releaseTriple(version) {
|
|
|
10134
10237
|
}
|
|
10135
10238
|
function readCliVersion(packageDirectory) {
|
|
10136
10239
|
try {
|
|
10137
|
-
const manifestPath = (0,
|
|
10138
|
-
const manifest = JSON.parse((0,
|
|
10240
|
+
const manifestPath = (0, import_node_path50.join)(packageDirectory, "..", "package.json");
|
|
10241
|
+
const manifest = JSON.parse((0, import_node_fs40.readFileSync)(manifestPath, "utf8"));
|
|
10139
10242
|
return manifest.version ?? "0.0.0";
|
|
10140
10243
|
} catch {
|
|
10141
10244
|
return "0.0.0";
|
|
@@ -10145,7 +10248,7 @@ function readCliVersion(packageDirectory) {
|
|
|
10145
10248
|
// src/workspace-info/read-workspace-info.use-case.ts
|
|
10146
10249
|
function readWorkspaceInfo(workspaceRoot, cliVersion) {
|
|
10147
10250
|
const latest = fetchLatestVersion() ?? null;
|
|
10148
|
-
const isWorkspace = fileExists((0,
|
|
10251
|
+
const isWorkspace = fileExists((0, import_node_path51.join)(workspaceRoot, "nx.json"));
|
|
10149
10252
|
return {
|
|
10150
10253
|
cli: {
|
|
10151
10254
|
version: cliVersion,
|
|
@@ -10166,7 +10269,7 @@ function runInfo(workspaceRoot, cliVersion, options) {
|
|
|
10166
10269
|
}
|
|
10167
10270
|
|
|
10168
10271
|
// src/interactive-wizard/interactive-wizard.use-case.ts
|
|
10169
|
-
var
|
|
10272
|
+
var import_node_path52 = require("path");
|
|
10170
10273
|
|
|
10171
10274
|
// src/interactive-wizard/adopt-steps.config.ts
|
|
10172
10275
|
var ADOPT_GLOBAL_OPTIONS = ["json"];
|
|
@@ -10347,7 +10450,7 @@ function wizardMenu(commands, inWorkspace) {
|
|
|
10347
10450
|
}
|
|
10348
10451
|
async function runInteractive(program, prompter = createInquirerPrompter(), workingDirectory = process.cwd()) {
|
|
10349
10452
|
const commands = describeCommands(program);
|
|
10350
|
-
const inWorkspace = fileExists((0,
|
|
10453
|
+
const inWorkspace = fileExists((0, import_node_path52.join)(workingDirectory, "nx.json"));
|
|
10351
10454
|
const name = await prompter.select("What would you like to do?", wizardMenu(commands, inWorkspace));
|
|
10352
10455
|
const command = commands.find((candidate) => candidate.name === name);
|
|
10353
10456
|
const argv = buildArgv(command, await askCommand(command, prompter));
|
|
@@ -10374,8 +10477,8 @@ var PRESETS = [
|
|
|
10374
10477
|
var PRESET_IDS = PRESETS.map((preset) => preset.id);
|
|
10375
10478
|
|
|
10376
10479
|
// src/workspace-presets/wire-web-api.use-case.ts
|
|
10377
|
-
var
|
|
10378
|
-
var
|
|
10480
|
+
var import_node_fs41 = require("fs");
|
|
10481
|
+
var import_node_path53 = require("path");
|
|
10379
10482
|
|
|
10380
10483
|
// src/workspace-presets/web-api-wiring.algorithm.ts
|
|
10381
10484
|
function apiHandler(shared) {
|
|
@@ -10547,18 +10650,18 @@ function declareDependency(manifestPath, name) {
|
|
|
10547
10650
|
}
|
|
10548
10651
|
function removeFiles(slice, files) {
|
|
10549
10652
|
for (const file of files) {
|
|
10550
|
-
(0,
|
|
10653
|
+
(0, import_node_fs41.rmSync)((0, import_node_path53.join)(slice, file), { force: true });
|
|
10551
10654
|
}
|
|
10552
10655
|
}
|
|
10553
10656
|
function replaceOnce(path, anchor, replacement) {
|
|
10554
|
-
const text = (0,
|
|
10657
|
+
const text = (0, import_node_fs41.readFileSync)(path, "utf8");
|
|
10555
10658
|
if (!text.includes(anchor)) {
|
|
10556
10659
|
throw new Error(`${path} has no ${anchor}; the generator's output changed, so the preset cannot wire it.`);
|
|
10557
10660
|
}
|
|
10558
10661
|
writeFileEnsured(path, text.replace(anchor, () => replacement));
|
|
10559
10662
|
}
|
|
10560
10663
|
function proxyApi(viteConfigPath) {
|
|
10561
|
-
const text = (0,
|
|
10664
|
+
const text = (0, import_node_fs41.readFileSync)(viteConfigPath, "utf8");
|
|
10562
10665
|
const proxied = withApiProxy(text, API_ORIGIN);
|
|
10563
10666
|
if (proxied === text && !text.includes("proxy:")) {
|
|
10564
10667
|
throw new Error(`${viteConfigPath} has no server block to add the /api proxy to; the generator's output changed, so the preset cannot wire it.`);
|
|
@@ -10566,30 +10669,30 @@ function proxyApi(viteConfigPath) {
|
|
|
10566
10669
|
writeFileEnsured(viteConfigPath, proxied);
|
|
10567
10670
|
}
|
|
10568
10671
|
function wireWebApi(workspaceRoot, projects) {
|
|
10569
|
-
const sharedManifest = (0,
|
|
10672
|
+
const sharedManifest = (0, import_node_path53.join)(workspaceRoot, "libs", projects.shared, "package.json");
|
|
10570
10673
|
if (!fileExists(sharedManifest)) {
|
|
10571
10674
|
throw new Error(`The shared library was not added at libs/${projects.shared}, so there is nothing to wire the API and the frontend to.`);
|
|
10572
10675
|
}
|
|
10573
10676
|
const shared = readJson(sharedManifest).name;
|
|
10574
|
-
const api = (0,
|
|
10575
|
-
declareDependency((0,
|
|
10576
|
-
const hello = (0,
|
|
10577
|
-
writeFileEnsured((0,
|
|
10578
|
-
writeFileEnsured((0,
|
|
10579
|
-
writeFileEnsured((0,
|
|
10677
|
+
const api = (0, import_node_path53.join)(workspaceRoot, "apps", projects.api);
|
|
10678
|
+
declareDependency((0, import_node_path53.join)(api, "package.json"), shared);
|
|
10679
|
+
const hello = (0, import_node_path53.join)(api, "src", "hello");
|
|
10680
|
+
writeFileEnsured((0, import_node_path53.join)(hello, "hello.handler.ts"), apiHandler(shared));
|
|
10681
|
+
writeFileEnsured((0, import_node_path53.join)(hello, "hello.handler.spec.ts"), apiHandlerSpec(shared));
|
|
10682
|
+
writeFileEnsured((0, import_node_path53.join)(hello, "index.ts"), apiBarrel());
|
|
10580
10683
|
removeFiles(hello, ["greet.use-case.ts", "greet.use-case.spec.ts", "greeting.contract.ts"]);
|
|
10581
|
-
replaceOnce((0,
|
|
10582
|
-
const web = (0,
|
|
10583
|
-
declareDependency((0,
|
|
10584
|
-
const greeting = (0,
|
|
10585
|
-
writeFileEnsured((0,
|
|
10586
|
-
writeFileEnsured((0,
|
|
10587
|
-
writeFileEnsured((0,
|
|
10588
|
-
writeFileEnsured((0,
|
|
10589
|
-
writeFileEnsured((0,
|
|
10684
|
+
replaceOnce((0, import_node_path53.join)(api, "src", "main.ts"), "app.get('/', helloHandler)", "app.get('/api/greeting', helloHandler)");
|
|
10685
|
+
const web = (0, import_node_path53.join)(workspaceRoot, "apps", projects.web);
|
|
10686
|
+
declareDependency((0, import_node_path53.join)(web, "package.json"), shared);
|
|
10687
|
+
const greeting = (0, import_node_path53.join)(web, "src", "greeting");
|
|
10688
|
+
writeFileEnsured((0, import_node_path53.join)(greeting, "greeting.client.ts"), webGreetingClient(shared));
|
|
10689
|
+
writeFileEnsured((0, import_node_path53.join)(greeting, "greeting.client.spec.ts"), webGreetingClientSpec());
|
|
10690
|
+
writeFileEnsured((0, import_node_path53.join)(greeting, "greeting.component.tsx"), webGreetingComponent(shared));
|
|
10691
|
+
writeFileEnsured((0, import_node_path53.join)(greeting, "greeting.component.spec.tsx"), webGreetingSpec());
|
|
10692
|
+
writeFileEnsured((0, import_node_path53.join)(greeting, "index.ts"), webGreetingBarrel());
|
|
10590
10693
|
removeFiles(greeting, ["greet.use-case.ts", "greet.use-case.spec.ts", "greeting.contract.ts"]);
|
|
10591
|
-
writeFileEnsured((0,
|
|
10592
|
-
proxyApi((0,
|
|
10694
|
+
writeFileEnsured((0, import_node_path53.join)(web, "src", "app", "app.component.spec.tsx"), webAppSpec());
|
|
10695
|
+
proxyApi((0, import_node_path53.join)(web, "vite.config.mts"));
|
|
10593
10696
|
}
|
|
10594
10697
|
|
|
10595
10698
|
// src/workspace-presets/apply-preset.use-case.ts
|
|
@@ -10632,8 +10735,8 @@ async function applyPreset(workspaceRoot, presetId, dependencies = {}) {
|
|
|
10632
10735
|
}
|
|
10633
10736
|
|
|
10634
10737
|
// src/workspace-creation/adopt-directory.use-case.ts
|
|
10635
|
-
var
|
|
10636
|
-
var
|
|
10738
|
+
var import_node_fs42 = require("fs");
|
|
10739
|
+
var import_node_path54 = require("path");
|
|
10637
10740
|
var NEVER_COPIED = /* @__PURE__ */ new Set([".git", "node_modules"]);
|
|
10638
10741
|
var AGENT_AND_CI_ENTRIES = [
|
|
10639
10742
|
"AGENTS.md",
|
|
@@ -10664,13 +10767,13 @@ var PREFLIGHT_BLOCKERS = [
|
|
|
10664
10767
|
"packages"
|
|
10665
10768
|
];
|
|
10666
10769
|
function assertAdoptableDirectory(target) {
|
|
10667
|
-
if (!(0,
|
|
10770
|
+
if (!(0, import_node_fs42.existsSync)(target)) {
|
|
10668
10771
|
throw new Error(`--into '${target}' does not exist. Create or clone it first.`);
|
|
10669
10772
|
}
|
|
10670
|
-
if (!(0,
|
|
10773
|
+
if (!(0, import_node_fs42.statSync)(target).isDirectory()) {
|
|
10671
10774
|
throw new Error(`--into '${target}' is not a directory.`);
|
|
10672
10775
|
}
|
|
10673
|
-
const blockers = PREFLIGHT_BLOCKERS.filter((entry) => (0,
|
|
10776
|
+
const blockers = PREFLIGHT_BLOCKERS.filter((entry) => (0, import_node_fs42.existsSync)((0, import_node_path54.join)(target, entry)));
|
|
10674
10777
|
if (blockers.length > 0) {
|
|
10675
10778
|
throw new Error(
|
|
10676
10779
|
`--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.`
|
|
@@ -10678,15 +10781,15 @@ function assertAdoptableDirectory(target) {
|
|
|
10678
10781
|
}
|
|
10679
10782
|
}
|
|
10680
10783
|
function mergeGitignore(generatedFile, targetFile) {
|
|
10681
|
-
const existing = (0,
|
|
10784
|
+
const existing = (0, import_node_fs42.readFileSync)(targetFile, "utf8");
|
|
10682
10785
|
const present = new Set(existing.split("\n").map((line) => line.trim()));
|
|
10683
|
-
const additions = (0,
|
|
10786
|
+
const additions = (0, import_node_fs42.readFileSync)(generatedFile, "utf8").split("\n").map((line) => line.trimEnd()).filter((line) => {
|
|
10684
10787
|
const trimmed = line.trim();
|
|
10685
10788
|
return trimmed !== "" && !trimmed.startsWith("#") && !present.has(trimmed);
|
|
10686
10789
|
});
|
|
10687
10790
|
if (additions.length === 0) return false;
|
|
10688
10791
|
const separator = existing.endsWith("\n") ? "" : "\n";
|
|
10689
|
-
(0,
|
|
10792
|
+
(0, import_node_fs42.writeFileSync)(
|
|
10690
10793
|
targetFile,
|
|
10691
10794
|
`${existing}${separator}
|
|
10692
10795
|
# Added by mnci (Nx workspace)
|
|
@@ -10696,9 +10799,9 @@ ${additions.join("\n")}
|
|
|
10696
10799
|
return true;
|
|
10697
10800
|
}
|
|
10698
10801
|
function adoptGeneratedWorkspace(generatedRoot, target) {
|
|
10699
|
-
const entries = (0,
|
|
10802
|
+
const entries = (0, import_node_fs42.readdirSync)(generatedRoot).filter((entry) => !NEVER_COPIED.has(entry));
|
|
10700
10803
|
const collisions = entries.filter(
|
|
10701
|
-
(entry) => (0,
|
|
10804
|
+
(entry) => (0, import_node_fs42.existsSync)((0, import_node_path54.join)(target, entry)) && !EXISTING_WINS.has(entry) && entry !== ".gitignore"
|
|
10702
10805
|
);
|
|
10703
10806
|
if (collisions.length > 0) {
|
|
10704
10807
|
throw new Error(
|
|
@@ -10707,28 +10810,46 @@ function adoptGeneratedWorkspace(generatedRoot, target) {
|
|
|
10707
10810
|
}
|
|
10708
10811
|
const result = { copied: [], kept: [], mergedGitignore: false };
|
|
10709
10812
|
for (const entry of entries) {
|
|
10710
|
-
const from = (0,
|
|
10711
|
-
const to = (0,
|
|
10712
|
-
if (entry === ".gitignore" && (0,
|
|
10813
|
+
const from = (0, import_node_path54.join)(generatedRoot, entry);
|
|
10814
|
+
const to = (0, import_node_path54.join)(target, entry);
|
|
10815
|
+
if (entry === ".gitignore" && (0, import_node_fs42.existsSync)(to)) {
|
|
10713
10816
|
result.mergedGitignore = mergeGitignore(from, to);
|
|
10714
10817
|
result.kept.push(entry);
|
|
10715
10818
|
continue;
|
|
10716
10819
|
}
|
|
10717
|
-
if ((0,
|
|
10820
|
+
if ((0, import_node_fs42.existsSync)(to)) {
|
|
10718
10821
|
result.kept.push(entry);
|
|
10719
10822
|
continue;
|
|
10720
10823
|
}
|
|
10721
|
-
(0,
|
|
10824
|
+
(0, import_node_fs42.cpSync)(from, to, { recursive: true });
|
|
10722
10825
|
result.copied.push(entry);
|
|
10723
10826
|
}
|
|
10724
|
-
(0,
|
|
10827
|
+
(0, import_node_fs42.rmSync)(generatedRoot, { recursive: true, force: true });
|
|
10725
10828
|
return result;
|
|
10726
10829
|
}
|
|
10727
10830
|
|
|
10728
10831
|
// src/workspace-creation/create-workspace.use-case.ts
|
|
10729
|
-
var
|
|
10832
|
+
var import_node_fs44 = require("fs");
|
|
10730
10833
|
var import_node_os2 = require("os");
|
|
10731
|
-
var
|
|
10834
|
+
var import_node_path56 = require("path");
|
|
10835
|
+
|
|
10836
|
+
// src/workspace-creation/remove-generated-pipelines.use-case.ts
|
|
10837
|
+
var import_node_fs43 = require("fs");
|
|
10838
|
+
var import_node_path55 = require("path");
|
|
10839
|
+
var NX_GENERATED_PIPELINES = [".github/workflows/ci.yml", "azure-pipelines.yml"];
|
|
10840
|
+
function removeGeneratedPipelines(generatedRoot) {
|
|
10841
|
+
const removed = [];
|
|
10842
|
+
for (const file of NX_GENERATED_PIPELINES) {
|
|
10843
|
+
if (!fileExists((0, import_node_path55.join)(generatedRoot, file))) {
|
|
10844
|
+
continue;
|
|
10845
|
+
}
|
|
10846
|
+
(0, import_node_fs43.rmSync)((0, import_node_path55.join)(generatedRoot, file), { force: true });
|
|
10847
|
+
removed.push(file);
|
|
10848
|
+
}
|
|
10849
|
+
return removed;
|
|
10850
|
+
}
|
|
10851
|
+
|
|
10852
|
+
// src/workspace-creation/create-workspace.use-case.ts
|
|
10732
10853
|
function nxCloudProviderValue(ci) {
|
|
10733
10854
|
return ci === "azure" ? "azure" : "github";
|
|
10734
10855
|
}
|
|
@@ -10771,10 +10892,10 @@ async function resolveRegistry2(options) {
|
|
|
10771
10892
|
return await promptRegistry();
|
|
10772
10893
|
}
|
|
10773
10894
|
async function runNew(name, options) {
|
|
10774
|
-
const adoptTarget = options.into === void 0 ? void 0 : (0,
|
|
10895
|
+
const adoptTarget = options.into === void 0 ? void 0 : (0, import_node_path56.resolve)(process.cwd(), options.into);
|
|
10775
10896
|
if (adoptTarget !== void 0) assertAdoptableDirectory(adoptTarget);
|
|
10776
10897
|
if (options.preset !== void 0) findPreset(options.preset);
|
|
10777
|
-
const workspaceName = name ?? (adoptTarget === void 0 ? await promptText("Workspace name") : (0,
|
|
10898
|
+
const workspaceName = name ?? (adoptTarget === void 0 ? await promptText("Workspace name") : (0, import_node_path56.basename)(adoptTarget));
|
|
10778
10899
|
assertValidProjectName(workspaceName, "Workspace name");
|
|
10779
10900
|
const scope = options.scope ?? (options.yes ? `@${workspaceName}` : await promptText("npm scope for publishable packages", `@${workspaceName}`));
|
|
10780
10901
|
const registry = await resolveRegistry2(options);
|
|
@@ -10787,8 +10908,8 @@ async function runNew(name, options) {
|
|
|
10787
10908
|
const npmAuth = resolveNpmAuth(options.npmAuth, registry, ci);
|
|
10788
10909
|
const stack = await resolveStack(options);
|
|
10789
10910
|
const nxCloud = options.nxCloud ?? (options.yes ? false : await promptNxCloud());
|
|
10790
|
-
const stagingParent = adoptTarget === void 0 ? process.cwd() : (0,
|
|
10791
|
-
let workspaceRoot = (0,
|
|
10911
|
+
const stagingParent = adoptTarget === void 0 ? process.cwd() : (0, import_node_fs44.mkdtempSync)((0, import_node_path56.join)((0, import_node_os2.tmpdir)(), "mnci-new-"));
|
|
10912
|
+
let workspaceRoot = (0, import_node_path56.join)(stagingParent, workspaceName);
|
|
10792
10913
|
try {
|
|
10793
10914
|
logger.step(`Creating Nx workspace '${workspaceName}' (preset: ts)`);
|
|
10794
10915
|
runNpx(
|
|
@@ -10803,6 +10924,7 @@ async function runNew(name, options) {
|
|
|
10803
10924
|
],
|
|
10804
10925
|
stagingParent
|
|
10805
10926
|
);
|
|
10927
|
+
removeGeneratedPipelines(workspaceRoot);
|
|
10806
10928
|
if (adoptTarget !== void 0) {
|
|
10807
10929
|
logger.step(`Adopting ${adoptTarget} (keeping its .git)`);
|
|
10808
10930
|
const adoption = adoptGeneratedWorkspace(workspaceRoot, adoptTarget);
|
|
@@ -10811,7 +10933,7 @@ async function runNew(name, options) {
|
|
|
10811
10933
|
workspaceRoot = adoptTarget;
|
|
10812
10934
|
}
|
|
10813
10935
|
} finally {
|
|
10814
|
-
if (adoptTarget !== void 0) (0,
|
|
10936
|
+
if (adoptTarget !== void 0) (0, import_node_fs44.rmSync)(stagingParent, { recursive: true, force: true });
|
|
10815
10937
|
}
|
|
10816
10938
|
logger.step(
|
|
10817
10939
|
"Applying MoNecromanCI overlay (VS Code workspace, release config, .npmrc, commitlint, pipeline, stack)"
|
|
@@ -10821,8 +10943,8 @@ async function runNew(name, options) {
|
|
|
10821
10943
|
{ workspaceName, scope, registry, agent, variableGroup, ci, stack, ...npmAuth && { npmAuth } },
|
|
10822
10944
|
logger.detail
|
|
10823
10945
|
);
|
|
10824
|
-
(0,
|
|
10825
|
-
(0,
|
|
10946
|
+
(0, import_node_fs44.rmSync)((0, import_node_path56.join)(workspaceRoot, "node_modules"), { recursive: true, force: true });
|
|
10947
|
+
(0, import_node_fs44.rmSync)((0, import_node_path56.join)(workspaceRoot, "package-lock.json"), { force: true });
|
|
10826
10948
|
logger.step("Installing the toolchain (commitlint + husky + linting/formatting)");
|
|
10827
10949
|
const installStatus = runShell(
|
|
10828
10950
|
"npm",
|