@mnci/cli 1.12.2 → 1.13.0
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 +2 -0
- package/dist/cli.js +126 -55
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,6 +38,8 @@ mnci add node-app api --framework express # ...or fastify | koa | nest
|
|
|
38
38
|
mnci add node-function-app api # @nx/node + an Azure Functions v4 overlay
|
|
39
39
|
mnci add npm-lib sdk # @nx/js publishable lib -> packages/
|
|
40
40
|
mnci add internal-lib utils # @nx/js private lib -> libs/
|
|
41
|
+
mnci add react-lib ui # @nx/react publishable component lib -> packages/
|
|
42
|
+
mnci add react-internal-lib design # @nx/react private component lib -> libs/
|
|
41
43
|
|
|
42
44
|
# Python (@mnci/nx-python-pip — pip + Ruff + pytest + PyPA build/twine, no uv)
|
|
43
45
|
mnci add python-app svc # app -> apps/ (wheel, zipped into the drop)
|
package/dist/cli.js
CHANGED
|
@@ -38,8 +38,8 @@ module.exports = __toCommonJS(cli_exports);
|
|
|
38
38
|
var import_commander = require("commander");
|
|
39
39
|
|
|
40
40
|
// src/commands/add.ts
|
|
41
|
-
var
|
|
42
|
-
var
|
|
41
|
+
var import_node_path10 = require("path");
|
|
42
|
+
var import_prompts5 = require("@inquirer/prompts");
|
|
43
43
|
|
|
44
44
|
// src/nx.ts
|
|
45
45
|
var import_cross_spawn = __toESM(require("cross-spawn"));
|
|
@@ -192,6 +192,21 @@ function hasPlugin(workspaceRoot, packageName) {
|
|
|
192
192
|
const installed = { ...manifest.dependencies, ...manifest.devDependencies };
|
|
193
193
|
return Object.hasOwn(installed, packageName);
|
|
194
194
|
}
|
|
195
|
+
function ensurePlugin(workspaceRoot, packageName) {
|
|
196
|
+
if (hasPlugin(workspaceRoot, packageName)) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
logger.step(`Installing Nx plugin ${packageName}`);
|
|
200
|
+
runNx(["add", packageName], workspaceRoot);
|
|
201
|
+
}
|
|
202
|
+
function markPrivate(manifestPath) {
|
|
203
|
+
const manifest = readJson(manifestPath);
|
|
204
|
+
writeFileEnsured(manifestPath, toJson({ ...manifest, private: true }));
|
|
205
|
+
}
|
|
206
|
+
function markPublic(manifestPath) {
|
|
207
|
+
const manifest = readJson(manifestPath);
|
|
208
|
+
writeFileEnsured(manifestPath, toJson({ ...manifest, publishConfig: { access: "public" } }));
|
|
209
|
+
}
|
|
195
210
|
function ensureAdmZip(workspaceRoot) {
|
|
196
211
|
if (hasPlugin(workspaceRoot, "adm-zip")) {
|
|
197
212
|
return;
|
|
@@ -525,7 +540,7 @@ function addGoInternalLib(workspaceRoot, name) {
|
|
|
525
540
|
|
|
526
541
|
// src/commands/add/node.ts
|
|
527
542
|
var import_node_path5 = require("path");
|
|
528
|
-
function
|
|
543
|
+
function ensurePlugin2(workspaceRoot, packageName) {
|
|
529
544
|
if (hasPlugin(workspaceRoot, packageName)) {
|
|
530
545
|
return;
|
|
531
546
|
}
|
|
@@ -533,7 +548,7 @@ function ensurePlugin(workspaceRoot, packageName) {
|
|
|
533
548
|
runNx(["add", packageName], workspaceRoot);
|
|
534
549
|
}
|
|
535
550
|
function runNodeApp(workspaceRoot, name, stack, framework) {
|
|
536
|
-
|
|
551
|
+
ensurePlugin2(workspaceRoot, "@nx/node");
|
|
537
552
|
runNx(
|
|
538
553
|
[
|
|
539
554
|
"g",
|
|
@@ -699,10 +714,6 @@ async function addNpmLib(workspaceRoot, name, options, kindProvided, stack) {
|
|
|
699
714
|
removeGeneratedEslintConfig(workspaceRoot, `packages/${name}`);
|
|
700
715
|
registerProjectCommands(workspaceRoot, name, { build: true });
|
|
701
716
|
}
|
|
702
|
-
function markPublic(manifestPath) {
|
|
703
|
-
const manifest = readJson(manifestPath);
|
|
704
|
-
writeFileEnsured(manifestPath, toJson({ ...manifest, publishConfig: { access: "public" } }));
|
|
705
|
-
}
|
|
706
717
|
|
|
707
718
|
// src/commands/add/python.ts
|
|
708
719
|
var import_node_fs4 = require("fs");
|
|
@@ -926,13 +937,6 @@ async function addPythonVendor(workspaceRoot, consumer, options, kindProvided) {
|
|
|
926
937
|
// src/commands/add/reactApp.ts
|
|
927
938
|
var import_node_fs5 = require("fs");
|
|
928
939
|
var import_node_path8 = require("path");
|
|
929
|
-
function ensurePlugin2(workspaceRoot, packageName) {
|
|
930
|
-
if (hasPlugin(workspaceRoot, packageName)) {
|
|
931
|
-
return;
|
|
932
|
-
}
|
|
933
|
-
logger.step(`Installing Nx plugin ${packageName}`);
|
|
934
|
-
runNx(["add", packageName], workspaceRoot);
|
|
935
|
-
}
|
|
936
940
|
var REACT_ENVIRONMENTS = ["dev", "uat", "prod"];
|
|
937
941
|
function reactEnvironmentFile(environment) {
|
|
938
942
|
return `# Vite compiles VITE_-prefixed vars into the '${environment}' bundle at build time.
|
|
@@ -985,7 +989,7 @@ ${allow}
|
|
|
985
989
|
`);
|
|
986
990
|
}
|
|
987
991
|
function addReactApp(workspaceRoot, name, stack) {
|
|
988
|
-
|
|
992
|
+
ensurePlugin(workspaceRoot, "@nx/react");
|
|
989
993
|
runNx(
|
|
990
994
|
[
|
|
991
995
|
"g",
|
|
@@ -1011,9 +1015,73 @@ function addReactApp(workspaceRoot, name, stack) {
|
|
|
1011
1015
|
registerProjectCommands(workspaceRoot, name, { build: true, start: `nx run ${name}:serve` });
|
|
1012
1016
|
}
|
|
1013
1017
|
|
|
1018
|
+
// src/commands/add/reactLib.ts
|
|
1019
|
+
var import_node_path9 = require("path");
|
|
1020
|
+
var WRONG_TYPES_PATH = "./dist/index.esm.d.ts";
|
|
1021
|
+
var ACTUAL_TYPES_PATH = "./dist/index.d.ts";
|
|
1022
|
+
function repairTypesPath(manifestPath) {
|
|
1023
|
+
const manifest = readJson(manifestPath);
|
|
1024
|
+
if (manifest.types === WRONG_TYPES_PATH) {
|
|
1025
|
+
manifest.types = ACTUAL_TYPES_PATH;
|
|
1026
|
+
}
|
|
1027
|
+
const dot = manifest.exports?.["."];
|
|
1028
|
+
if (typeof dot === "object" && dot.types === WRONG_TYPES_PATH) {
|
|
1029
|
+
dot.types = ACTUAL_TYPES_PATH;
|
|
1030
|
+
}
|
|
1031
|
+
writeFileEnsured(manifestPath, toJson(manifest));
|
|
1032
|
+
}
|
|
1033
|
+
var REACT_LIB_BUNDLER = "rollup";
|
|
1034
|
+
async function addReactLib(workspaceRoot, name, options, kindProvided, stack) {
|
|
1035
|
+
ensurePlugin(workspaceRoot, "@nx/react");
|
|
1036
|
+
const scope = options.scope ?? (kindProvided ? defaultScope(workspaceRoot) : await promptText("npm scope for the published package", defaultScope(workspaceRoot)));
|
|
1037
|
+
runNx(
|
|
1038
|
+
[
|
|
1039
|
+
"g",
|
|
1040
|
+
"@nx/react:library",
|
|
1041
|
+
`packages/${name}`,
|
|
1042
|
+
`--name=${name}`,
|
|
1043
|
+
"--publishable",
|
|
1044
|
+
`--importPath=${scope}/${name}`,
|
|
1045
|
+
`--bundler=${REACT_LIB_BUNDLER}`,
|
|
1046
|
+
`--unitTestRunner=${stack.testRunner}`,
|
|
1047
|
+
"--linter=none",
|
|
1048
|
+
"--no-interactive"
|
|
1049
|
+
],
|
|
1050
|
+
workspaceRoot
|
|
1051
|
+
);
|
|
1052
|
+
const publishableManifest = (0, import_node_path9.join)(workspaceRoot, "packages", name, "package.json");
|
|
1053
|
+
markPublic(publishableManifest);
|
|
1054
|
+
repairTypesPath(publishableManifest);
|
|
1055
|
+
removeGeneratedEslintConfig(workspaceRoot, `packages/${name}`);
|
|
1056
|
+
registerProjectCommands(workspaceRoot, name, { build: true });
|
|
1057
|
+
}
|
|
1058
|
+
function addReactInternalLib(workspaceRoot, name, stack) {
|
|
1059
|
+
ensurePlugin(workspaceRoot, "@nx/react");
|
|
1060
|
+
runNx(
|
|
1061
|
+
[
|
|
1062
|
+
"g",
|
|
1063
|
+
"@nx/react:library",
|
|
1064
|
+
`libs/${name}`,
|
|
1065
|
+
`--name=${name}`,
|
|
1066
|
+
`--bundler=${REACT_LIB_BUNDLER}`,
|
|
1067
|
+
`--unitTestRunner=${stack.testRunner}`,
|
|
1068
|
+
"--linter=none",
|
|
1069
|
+
"--no-interactive"
|
|
1070
|
+
],
|
|
1071
|
+
workspaceRoot
|
|
1072
|
+
);
|
|
1073
|
+
const privateManifest = (0, import_node_path9.join)(workspaceRoot, "libs", name, "package.json");
|
|
1074
|
+
markPrivate(privateManifest);
|
|
1075
|
+
repairTypesPath(privateManifest);
|
|
1076
|
+
removeGeneratedEslintConfig(workspaceRoot, `libs/${name}`);
|
|
1077
|
+
registerProjectCommands(workspaceRoot, name, { build: true });
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1014
1080
|
// src/commands/add.ts
|
|
1015
1081
|
var PROJECT_KINDS = [
|
|
1016
1082
|
"react-app",
|
|
1083
|
+
"react-lib",
|
|
1084
|
+
"react-internal-lib",
|
|
1017
1085
|
"node-app",
|
|
1018
1086
|
"node-function-app",
|
|
1019
1087
|
"npm-lib",
|
|
@@ -1033,12 +1101,12 @@ var PROJECT_KINDS = [
|
|
|
1033
1101
|
];
|
|
1034
1102
|
async function runAdd(kind, name, options) {
|
|
1035
1103
|
const workspaceRoot = process.cwd();
|
|
1036
|
-
if (!fileExists((0,
|
|
1104
|
+
if (!fileExists((0, import_node_path10.join)(workspaceRoot, "nx.json"))) {
|
|
1037
1105
|
throw new Error("No nx.json found here. Run `add` from the workspace root.");
|
|
1038
1106
|
}
|
|
1039
1107
|
const stack = readWorkspaceStack(workspaceRoot);
|
|
1040
1108
|
const kindProvided = kind !== void 0;
|
|
1041
|
-
const resolvedKind = kind ?? await (0,
|
|
1109
|
+
const resolvedKind = kind ?? await (0, import_prompts5.select)({
|
|
1042
1110
|
message: "What kind of project?",
|
|
1043
1111
|
choices: PROJECT_KINDS.map((value) => ({ name: value, value }))
|
|
1044
1112
|
});
|
|
@@ -1049,6 +1117,14 @@ async function runAdd(kind, name, options) {
|
|
|
1049
1117
|
addReactApp(workspaceRoot, resolvedName, stack);
|
|
1050
1118
|
break;
|
|
1051
1119
|
}
|
|
1120
|
+
case "react-lib": {
|
|
1121
|
+
await addReactLib(workspaceRoot, resolvedName, options, kindProvided, stack);
|
|
1122
|
+
break;
|
|
1123
|
+
}
|
|
1124
|
+
case "react-internal-lib": {
|
|
1125
|
+
addReactInternalLib(workspaceRoot, resolvedName, stack);
|
|
1126
|
+
break;
|
|
1127
|
+
}
|
|
1052
1128
|
case "node-app": {
|
|
1053
1129
|
addNodeApp(workspaceRoot, resolvedName, stack, options.framework);
|
|
1054
1130
|
break;
|
|
@@ -1074,7 +1150,7 @@ async function runAdd(kind, name, options) {
|
|
|
1074
1150
|
],
|
|
1075
1151
|
workspaceRoot
|
|
1076
1152
|
);
|
|
1077
|
-
markPrivate((0,
|
|
1153
|
+
markPrivate((0, import_node_path10.join)(workspaceRoot, "libs", resolvedName, "package.json"));
|
|
1078
1154
|
removeGeneratedEslintConfig(workspaceRoot, `libs/${resolvedName}`);
|
|
1079
1155
|
registerProjectCommands(workspaceRoot, resolvedName, { build: true });
|
|
1080
1156
|
break;
|
|
@@ -1150,28 +1226,24 @@ function syncProjectReferences(workspaceRoot) {
|
|
|
1150
1226
|
}
|
|
1151
1227
|
function readWorkspaceStack(workspaceRoot) {
|
|
1152
1228
|
const nxJson = readJson(
|
|
1153
|
-
(0,
|
|
1229
|
+
(0, import_node_path10.join)(workspaceRoot, "nx.json")
|
|
1154
1230
|
);
|
|
1155
1231
|
const stack = nxJson.mnci?.stack;
|
|
1156
1232
|
return {
|
|
1157
1233
|
testRunner: stack?.testRunner === "vitest" ? "vitest" : "jest"
|
|
1158
1234
|
};
|
|
1159
1235
|
}
|
|
1160
|
-
function markPrivate(manifestPath) {
|
|
1161
|
-
const manifest = readJson(manifestPath);
|
|
1162
|
-
writeFileEnsured(manifestPath, toJson({ ...manifest, private: true }));
|
|
1163
|
-
}
|
|
1164
1236
|
|
|
1165
1237
|
// src/commands/interactive.ts
|
|
1166
|
-
var
|
|
1167
|
-
var
|
|
1238
|
+
var import_node_path14 = require("path");
|
|
1239
|
+
var import_prompts8 = require("@inquirer/prompts");
|
|
1168
1240
|
|
|
1169
1241
|
// src/commands/new.ts
|
|
1170
|
-
var
|
|
1242
|
+
var import_node_path12 = require("path");
|
|
1171
1243
|
|
|
1172
1244
|
// src/overlay.ts
|
|
1173
1245
|
var import_node_fs6 = require("fs");
|
|
1174
|
-
var
|
|
1246
|
+
var import_node_path11 = require("path");
|
|
1175
1247
|
var DEFAULT_STACK = { testRunner: "jest" };
|
|
1176
1248
|
var PRETTIER_VERSION = "^3.8.1";
|
|
1177
1249
|
var TS_COMPILER_DEPENDENCIES = {
|
|
@@ -1378,7 +1450,7 @@ function mnciConfig(options) {
|
|
|
1378
1450
|
};
|
|
1379
1451
|
}
|
|
1380
1452
|
function readMnciConfig(workspaceRoot) {
|
|
1381
|
-
const nxJson = readJson((0,
|
|
1453
|
+
const nxJson = readJson((0, import_node_path11.join)(workspaceRoot, "nx.json"));
|
|
1382
1454
|
return nxJson.mnci ?? {};
|
|
1383
1455
|
}
|
|
1384
1456
|
function pythonPublishUrl(registry) {
|
|
@@ -1828,7 +1900,7 @@ updates:
|
|
|
1828
1900
|
var NX_SCAFFOLDING_TO_REMOVE = [".prettierrc", ".vscode"];
|
|
1829
1901
|
function removeNxScaffolding(workspaceRoot) {
|
|
1830
1902
|
for (const entry of NX_SCAFFOLDING_TO_REMOVE) {
|
|
1831
|
-
(0, import_node_fs6.rmSync)((0,
|
|
1903
|
+
(0, import_node_fs6.rmSync)((0, import_node_path11.join)(workspaceRoot, entry), { recursive: true, force: true });
|
|
1832
1904
|
}
|
|
1833
1905
|
removeProjectEslintConfigs(workspaceRoot);
|
|
1834
1906
|
}
|
|
@@ -1837,11 +1909,11 @@ function removeProjectEslintConfigs(workspaceRoot) {
|
|
|
1837
1909
|
cwd: workspaceRoot
|
|
1838
1910
|
});
|
|
1839
1911
|
for (const match of matches) {
|
|
1840
|
-
(0, import_node_fs6.rmSync)((0,
|
|
1912
|
+
(0, import_node_fs6.rmSync)((0, import_node_path11.join)(workspaceRoot, match), { force: true });
|
|
1841
1913
|
}
|
|
1842
1914
|
}
|
|
1843
1915
|
function applyOverlay(workspaceRoot, options) {
|
|
1844
|
-
const nxJsonPath = (0,
|
|
1916
|
+
const nxJsonPath = (0, import_node_path11.join)(workspaceRoot, "nx.json");
|
|
1845
1917
|
const nxJson = readJson(nxJsonPath);
|
|
1846
1918
|
const generators = {
|
|
1847
1919
|
...nxJson.generators,
|
|
@@ -1851,7 +1923,7 @@ function applyOverlay(workspaceRoot, options) {
|
|
|
1851
1923
|
const mnci = { ...nxJson.mnci, ...mnciConfig(options) };
|
|
1852
1924
|
const patched = withEslintPlugin(withReleaseConfig(nxJson, options.ci));
|
|
1853
1925
|
writeFileEnsured(nxJsonPath, toJson({ ...patched, generators, sync, mnci }));
|
|
1854
|
-
const manifestPath = (0,
|
|
1926
|
+
const manifestPath = (0, import_node_path11.join)(workspaceRoot, "package.json");
|
|
1855
1927
|
const manifest = readJson(manifestPath);
|
|
1856
1928
|
const scripts = {
|
|
1857
1929
|
...manifest.scripts,
|
|
@@ -1869,34 +1941,34 @@ function applyOverlay(workspaceRoot, options) {
|
|
|
1869
1941
|
manifestPath,
|
|
1870
1942
|
toJson({ ...manifest, name: `${options.scope}/source`, scripts, devDependencies: devDeps })
|
|
1871
1943
|
);
|
|
1872
|
-
writeFileEnsured((0,
|
|
1873
|
-
writeFileEnsured((0,
|
|
1874
|
-
const hookPath = (0,
|
|
1944
|
+
writeFileEnsured((0, import_node_path11.join)(workspaceRoot, ".npmrc"), npmrcContent(options.registry, options.scope));
|
|
1945
|
+
writeFileEnsured((0, import_node_path11.join)(workspaceRoot, "commitlint.config.mjs"), COMMITLINT_CONFIG);
|
|
1946
|
+
const hookPath = (0, import_node_path11.join)(workspaceRoot, ".husky/commit-msg");
|
|
1875
1947
|
writeFileEnsured(hookPath, COMMIT_MSG_HOOK);
|
|
1876
1948
|
markExecutable(hookPath);
|
|
1877
|
-
writeFileEnsured((0,
|
|
1878
|
-
writeFileEnsured((0,
|
|
1879
|
-
writeFileEnsured((0,
|
|
1949
|
+
writeFileEnsured((0, import_node_path11.join)(workspaceRoot, "eslint.config.mjs"), ESLINT_CONFIG);
|
|
1950
|
+
writeFileEnsured((0, import_node_path11.join)(workspaceRoot, ".prettierrc.json"), PRETTIER_CONFIG);
|
|
1951
|
+
writeFileEnsured((0, import_node_path11.join)(workspaceRoot, ".prettierignore"), PRETTIER_IGNORE);
|
|
1880
1952
|
removeNxScaffolding(workspaceRoot);
|
|
1881
|
-
const codeWorkspacePath = (0,
|
|
1953
|
+
const codeWorkspacePath = (0, import_node_path11.join)(workspaceRoot, `${options.workspaceName}.code-workspace`);
|
|
1882
1954
|
const existing = readCodeWorkspace(codeWorkspacePath);
|
|
1883
1955
|
writeFileEnsured(codeWorkspacePath, vscodeWorkspace(options.workspaceName, existing?.tasks));
|
|
1884
1956
|
if (options.workspaceName !== "undefined") {
|
|
1885
|
-
(0, import_node_fs6.rmSync)((0,
|
|
1957
|
+
(0, import_node_fs6.rmSync)((0, import_node_path11.join)(workspaceRoot, "undefined.code-workspace"), { force: true });
|
|
1886
1958
|
}
|
|
1887
1959
|
const publishUrl = pythonPublishUrl(options.registry);
|
|
1888
1960
|
if (options.ci === "azure" || options.ci === "both") {
|
|
1889
1961
|
writeFileEnsured(
|
|
1890
|
-
(0,
|
|
1962
|
+
(0, import_node_path11.join)(workspaceRoot, "azure-pipelines.yml"),
|
|
1891
1963
|
azurePipelinesYaml(options.agent, options.variableGroup, publishUrl, options.registry.kind)
|
|
1892
1964
|
);
|
|
1893
1965
|
}
|
|
1894
1966
|
if (options.ci === "github" || options.ci === "both") {
|
|
1895
1967
|
writeFileEnsured(
|
|
1896
|
-
(0,
|
|
1968
|
+
(0, import_node_path11.join)(workspaceRoot, ".github/workflows/ci.yml"),
|
|
1897
1969
|
githubActionsYaml(options.agent, publishUrl, options.registry.kind, options.ci)
|
|
1898
1970
|
);
|
|
1899
|
-
writeFileEnsured((0,
|
|
1971
|
+
writeFileEnsured((0, import_node_path11.join)(workspaceRoot, ".github/dependabot.yml"), DEPENDABOT_CONFIG);
|
|
1900
1972
|
}
|
|
1901
1973
|
}
|
|
1902
1974
|
|
|
@@ -1965,7 +2037,7 @@ async function runNew(name, options) {
|
|
|
1965
2037
|
],
|
|
1966
2038
|
process.cwd()
|
|
1967
2039
|
);
|
|
1968
|
-
const workspaceRoot = (0,
|
|
2040
|
+
const workspaceRoot = (0, import_node_path12.join)(process.cwd(), workspaceName);
|
|
1969
2041
|
logger.step(
|
|
1970
2042
|
"Applying MoNecromanCI overlay (VS Code workspace, release config, .npmrc, commitlint, pipeline, stack)"
|
|
1971
2043
|
);
|
|
@@ -1984,9 +2056,8 @@ async function runNew(name, options) {
|
|
|
1984
2056
|
runPrettier(workspaceRoot);
|
|
1985
2057
|
logger.success("Done. Next steps:");
|
|
1986
2058
|
logger.info(` cd ${workspaceName}`);
|
|
1987
|
-
logger.info(
|
|
1988
|
-
|
|
1989
|
-
);
|
|
2059
|
+
logger.info(" mnci add react-app web # or: react-lib, react-internal-lib, node-app,");
|
|
2060
|
+
logger.info(" # node-function-app, npm-lib, internal-lib,");
|
|
1990
2061
|
logger.info(
|
|
1991
2062
|
" # python-app, python-function-app, python-lib, python-internal-lib,"
|
|
1992
2063
|
);
|
|
@@ -2001,7 +2072,7 @@ async function runNew(name, options) {
|
|
|
2001
2072
|
|
|
2002
2073
|
// src/commands/upgrade.ts
|
|
2003
2074
|
var import_node_fs7 = require("fs");
|
|
2004
|
-
var
|
|
2075
|
+
var import_node_path13 = require("path");
|
|
2005
2076
|
function resolveRegistry2(options, persisted) {
|
|
2006
2077
|
if (options.registry === "azure-artifacts" || options.organization && options.artifactsFeed) {
|
|
2007
2078
|
const persistedAzure = persisted?.kind === "azure-artifacts" ? persisted : void 0;
|
|
@@ -2038,7 +2109,7 @@ function resolveWorkspaceName(workspaceRoot, persisted) {
|
|
|
2038
2109
|
}
|
|
2039
2110
|
} catch {
|
|
2040
2111
|
}
|
|
2041
|
-
return (0,
|
|
2112
|
+
return (0, import_node_path13.basename)(workspaceRoot);
|
|
2042
2113
|
}
|
|
2043
2114
|
function resolveOverlayOptions(workspaceRoot, options, persisted) {
|
|
2044
2115
|
const scope = options.scope ?? persisted.scope;
|
|
@@ -2076,7 +2147,7 @@ function resolveOverlayOptions(workspaceRoot, options, persisted) {
|
|
|
2076
2147
|
};
|
|
2077
2148
|
}
|
|
2078
2149
|
function runUpgrade(workspaceRoot, options) {
|
|
2079
|
-
if (!fileExists((0,
|
|
2150
|
+
if (!fileExists((0, import_node_path13.join)(workspaceRoot, "nx.json"))) {
|
|
2080
2151
|
throw new Error(
|
|
2081
2152
|
`No nx.json found in ${workspaceRoot} \u2014 this does not look like an Nx workspace. Run 'mnci upgrade' from the workspace root.`
|
|
2082
2153
|
);
|
|
@@ -2093,14 +2164,14 @@ function runUpgrade(workspaceRoot, options) {
|
|
|
2093
2164
|
|
|
2094
2165
|
// src/commands/interactive.ts
|
|
2095
2166
|
async function runInteractive() {
|
|
2096
|
-
const inWorkspace = fileExists((0,
|
|
2167
|
+
const inWorkspace = fileExists((0, import_node_path14.join)(process.cwd(), "nx.json"));
|
|
2097
2168
|
const newChoice = { name: "Create a new monorepo", value: "new" };
|
|
2098
2169
|
const addChoice = { name: "Add a project to this workspace", value: "add" };
|
|
2099
2170
|
const upgradeChoice = {
|
|
2100
2171
|
name: "Upgrade this workspace (re-apply the latest overlay)",
|
|
2101
2172
|
value: "upgrade"
|
|
2102
2173
|
};
|
|
2103
|
-
const action = await (0,
|
|
2174
|
+
const action = await (0, import_prompts8.select)({
|
|
2104
2175
|
message: "What would you like to do?",
|
|
2105
2176
|
choices: inWorkspace ? [addChoice, upgradeChoice, newChoice] : [newChoice, addChoice, upgradeChoice]
|
|
2106
2177
|
});
|
|
@@ -2115,7 +2186,7 @@ async function runInteractive() {
|
|
|
2115
2186
|
|
|
2116
2187
|
// src/util/versionChecker.ts
|
|
2117
2188
|
var import_node_fs8 = require("fs");
|
|
2118
|
-
var
|
|
2189
|
+
var import_node_path15 = require("path");
|
|
2119
2190
|
var import_cross_spawn2 = __toESM(require("cross-spawn"));
|
|
2120
2191
|
var PACKAGE_NAME = "@mnci/cli";
|
|
2121
2192
|
var REGISTRY_TIMEOUT_MS = 2e3;
|
|
@@ -2171,7 +2242,7 @@ function releaseTriple(version) {
|
|
|
2171
2242
|
}
|
|
2172
2243
|
function readCliVersion(packageDirectory) {
|
|
2173
2244
|
try {
|
|
2174
|
-
const manifestPath = (0,
|
|
2245
|
+
const manifestPath = (0, import_node_path15.join)(packageDirectory, "..", "package.json");
|
|
2175
2246
|
const manifest = JSON.parse((0, import_node_fs8.readFileSync)(manifestPath, "utf8"));
|
|
2176
2247
|
return manifest.version ?? "0.0.0";
|
|
2177
2248
|
} catch {
|