@mnci/cli 4.54.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/dist/cli.js +27 -8
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -10829,9 +10829,27 @@ function adoptGeneratedWorkspace(generatedRoot, target) {
|
|
|
10829
10829
|
}
|
|
10830
10830
|
|
|
10831
10831
|
// src/workspace-creation/create-workspace.use-case.ts
|
|
10832
|
-
var
|
|
10832
|
+
var import_node_fs44 = require("fs");
|
|
10833
10833
|
var import_node_os2 = require("os");
|
|
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");
|
|
10834
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
|
|
10835
10853
|
function nxCloudProviderValue(ci) {
|
|
10836
10854
|
return ci === "azure" ? "azure" : "github";
|
|
10837
10855
|
}
|
|
@@ -10874,10 +10892,10 @@ async function resolveRegistry2(options) {
|
|
|
10874
10892
|
return await promptRegistry();
|
|
10875
10893
|
}
|
|
10876
10894
|
async function runNew(name, options) {
|
|
10877
|
-
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);
|
|
10878
10896
|
if (adoptTarget !== void 0) assertAdoptableDirectory(adoptTarget);
|
|
10879
10897
|
if (options.preset !== void 0) findPreset(options.preset);
|
|
10880
|
-
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));
|
|
10881
10899
|
assertValidProjectName(workspaceName, "Workspace name");
|
|
10882
10900
|
const scope = options.scope ?? (options.yes ? `@${workspaceName}` : await promptText("npm scope for publishable packages", `@${workspaceName}`));
|
|
10883
10901
|
const registry = await resolveRegistry2(options);
|
|
@@ -10890,8 +10908,8 @@ async function runNew(name, options) {
|
|
|
10890
10908
|
const npmAuth = resolveNpmAuth(options.npmAuth, registry, ci);
|
|
10891
10909
|
const stack = await resolveStack(options);
|
|
10892
10910
|
const nxCloud = options.nxCloud ?? (options.yes ? false : await promptNxCloud());
|
|
10893
|
-
const stagingParent = adoptTarget === void 0 ? process.cwd() : (0,
|
|
10894
|
-
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);
|
|
10895
10913
|
try {
|
|
10896
10914
|
logger.step(`Creating Nx workspace '${workspaceName}' (preset: ts)`);
|
|
10897
10915
|
runNpx(
|
|
@@ -10906,6 +10924,7 @@ async function runNew(name, options) {
|
|
|
10906
10924
|
],
|
|
10907
10925
|
stagingParent
|
|
10908
10926
|
);
|
|
10927
|
+
removeGeneratedPipelines(workspaceRoot);
|
|
10909
10928
|
if (adoptTarget !== void 0) {
|
|
10910
10929
|
logger.step(`Adopting ${adoptTarget} (keeping its .git)`);
|
|
10911
10930
|
const adoption = adoptGeneratedWorkspace(workspaceRoot, adoptTarget);
|
|
@@ -10914,7 +10933,7 @@ async function runNew(name, options) {
|
|
|
10914
10933
|
workspaceRoot = adoptTarget;
|
|
10915
10934
|
}
|
|
10916
10935
|
} finally {
|
|
10917
|
-
if (adoptTarget !== void 0) (0,
|
|
10936
|
+
if (adoptTarget !== void 0) (0, import_node_fs44.rmSync)(stagingParent, { recursive: true, force: true });
|
|
10918
10937
|
}
|
|
10919
10938
|
logger.step(
|
|
10920
10939
|
"Applying MoNecromanCI overlay (VS Code workspace, release config, .npmrc, commitlint, pipeline, stack)"
|
|
@@ -10924,8 +10943,8 @@ async function runNew(name, options) {
|
|
|
10924
10943
|
{ workspaceName, scope, registry, agent, variableGroup, ci, stack, ...npmAuth && { npmAuth } },
|
|
10925
10944
|
logger.detail
|
|
10926
10945
|
);
|
|
10927
|
-
(0,
|
|
10928
|
-
(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 });
|
|
10929
10948
|
logger.step("Installing the toolchain (commitlint + husky + linting/formatting)");
|
|
10930
10949
|
const installStatus = runShell(
|
|
10931
10950
|
"npm",
|