@mnci/cli 4.17.3 → 4.17.5

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 CHANGED
@@ -2784,7 +2784,7 @@ function addInitialVersion(csprojPath) {
2784
2784
  }
2785
2785
  function csharpLibPublishTarget(projectRoot) {
2786
2786
  const outDir = `${projectRoot}/dist`;
2787
- const command = `node -e "if(!process.env.NUGET_PAT){console.log('NuGet publish is not configured for this registry choice (no NUGET_PAT) - skipping. Regenerate with --registry azure-artifacts, or run dotnet nuget push manually.');process.exit(0)}const cp=require('node:child_process');const pack=cp.spawnSync('dotnet',['pack','${projectRoot}','-c','Release','-o','${outDir}'],{stdio:'inherit',shell:true});if(pack.status!==0)process.exit(pack.status??1);const fs=require('node:fs');for(const pkg of fs.globSync('${outDir}/*.nupkg')){const push=cp.spawnSync('dotnet',['nuget','push',pkg,'--source','${NUGET_AZURE_SOURCE}','--api-key','AZ'],{stdio:'inherit',shell:true});if(push.status!==0)process.exit(push.status??1)}"`;
2787
+ const command = `node -e "if(process.argv.some((a)=>a==='--dryRun'||a==='--dryRun=true')||process.env.NX_DRY_RUN==='true'){console.log('Dry run - would dotnet pack ${projectRoot} and dotnet nuget push the resulting .nupkg to ${NUGET_AZURE_SOURCE}.');process.exit(0)}if(!process.env.NUGET_PAT){console.log('NuGet publish is not configured for this registry choice (no NUGET_PAT) - skipping. Regenerate with --registry azure-artifacts, or run dotnet nuget push manually.');process.exit(0)}const cp=require('node:child_process');const pack=cp.spawnSync('dotnet',['pack','${projectRoot}','-c','Release','-o','${outDir}'],{stdio:'inherit',shell:true});if(pack.status!==0)process.exit(pack.status??1);const fs=require('node:fs');for(const pkg of fs.globSync('${outDir}/*.nupkg')){const push=cp.spawnSync('dotnet',['nuget','push',pkg,'--source','${NUGET_AZURE_SOURCE}','--api-key','AZ'],{stdio:'inherit',shell:true});if(push.status!==0)process.exit(push.status??1)}"`;
2788
2788
  return { executor: "nx:run-commands", options: { command } };
2789
2789
  }
2790
2790
  async function addCsharpLib(workspaceRoot, name, options, kindProvided) {
@@ -6718,7 +6718,10 @@ async function resolveStack(options) {
6718
6718
  }
6719
6719
  var CI_PROVIDERS = /* @__PURE__ */ new Set(["azure", "github", "both"]);
6720
6720
  async function resolveCi(options) {
6721
- if (options.ci && CI_PROVIDERS.has(options.ci)) {
6721
+ if (options.ci !== void 0) {
6722
+ if (!CI_PROVIDERS.has(options.ci)) {
6723
+ throw new Error(`Invalid --ci '${options.ci}'. Valid values: azure, github, both.`);
6724
+ }
6722
6725
  return options.ci;
6723
6726
  }
6724
6727
  if (options.yes) {
@@ -6726,7 +6729,11 @@ async function resolveCi(options) {
6726
6729
  }
6727
6730
  return await promptCi();
6728
6731
  }
6732
+ var REGISTRY_KINDS = /* @__PURE__ */ new Set(["azure-artifacts", "npm"]);
6729
6733
  async function resolveRegistry(options) {
6734
+ if (options.registry !== void 0 && !REGISTRY_KINDS.has(options.registry)) {
6735
+ throw new Error(`Invalid --registry '${options.registry}'. Valid values: azure-artifacts, npm.`);
6736
+ }
6730
6737
  if (options.registry === "azure-artifacts" || options.organization && options.artifactsFeed) {
6731
6738
  return {
6732
6739
  kind: "azure-artifacts",
@@ -6806,20 +6813,27 @@ async function runNew(name, options) {
6806
6813
  runFormatter(workspaceRoot);
6807
6814
  logger.success("Done. Next steps:");
6808
6815
  if (adoptTarget === void 0) logger.info(` cd ${workspaceName}`);
6809
- logger.info(" mnci add react-app web # or: react-lib, react-internal-lib, node-app,");
6810
- logger.info(" # node-function-app, npm-lib, internal-lib,");
6811
- logger.info(
6812
- " # python-app, python-function-app, python-lib, python-internal-lib,"
6813
- );
6814
- logger.info(
6815
- " # go-app, go-function-app, go-lib, go-internal-lib,"
6816
- );
6817
- logger.info(
6818
- " # flutter-app, flutter-lib, flutter-internal-lib,"
6819
- );
6820
- logger.info(" # vscode-extension");
6816
+ for (const line of projectKindHintLines()) {
6817
+ logger.info(line);
6818
+ }
6821
6819
  logger.info(' git add -A && git commit -m "feat: initial workspace"');
6822
6820
  }
6821
+ function projectKindHintLines(kinds = PROJECT_KINDS) {
6822
+ const indent = " ".repeat(4);
6823
+ const width = 78;
6824
+ const lines = [" mnci add <kind> <name> # <kind> is one of:"];
6825
+ let current = indent;
6826
+ for (const [index, kind] of kinds.entries()) {
6827
+ const token = `${kind}${index < kinds.length - 1 ? ", " : ""}`;
6828
+ if (current !== indent && current.length + token.length > width) {
6829
+ lines.push(current.replace(/\s+$/, ""));
6830
+ current = indent;
6831
+ }
6832
+ current += token;
6833
+ }
6834
+ lines.push(current.replace(/\s+$/, ""));
6835
+ return lines;
6836
+ }
6823
6837
 
6824
6838
  // src/workspace-creation/interactive-wizard.use-case.ts
6825
6839
  var import_node_path28 = require("path");
@@ -7070,13 +7084,13 @@ function readCliVersion(packageDirectory) {
7070
7084
  function buildProgram(cliVersion) {
7071
7085
  const program = new import_commander.Command();
7072
7086
  program.name("mnci").description("MoNecromanCI \u2014 a thin CLI over official Nx plugins").version(cliVersion, "-v, --version", "display the version");
7073
- program.command("new").argument("[name]", "workspace name").description("Create a new monorepo (Nx TS preset + release/pipeline overlay)").option("-y, --yes", "accept defaults for anything not passed as a flag").option("--scope <scope>", "npm scope for publishable packages (e.g. @demo)").option("--registry <kind>", "azure-artifacts | npm").option("--organization <name>", "Azure DevOps organization").option("--project <name>", "Azure DevOps project").option("--artifacts-feed <name>", "Azure Artifacts feed").option(
7087
+ program.command("new").argument("[name]", "workspace name").description("Create a new monorepo (Nx TS preset + release/pipeline overlay)").option("-y, --yes", "accept defaults for anything not passed as a flag").option("--scope <scope>", "npm scope for publishable packages (e.g. @demo)").addOption(new import_commander.Option("--registry <kind>", "package registry").choices(["azure-artifacts", "npm"])).option("--organization <name>", "Azure DevOps organization").option("--project <name>", "Azure DevOps project").option("--artifacts-feed <name>", "Azure Artifacts feed").option(
7074
7088
  "--agent <pool>",
7075
7089
  "CI build agent: a vmImage (e.g. ubuntu-latest) or self-hosted pool name"
7076
7090
  ).option("--variable-group <name>", "Azure DevOps variable group holding the npm PAT").option(
7077
7091
  "--npm-auth <mode>",
7078
7092
  "how npm authenticates to an Azure Artifacts feed: pat (default) | build-identity (npmAuthenticate@0, no PAT; --ci azure only)"
7079
- ).option("--ci <provider>", "CI provider: azure | github | both").option("--test-runner <runner>", "unit-test runner: jest | vitest").option("--nx-cloud", "connect the workspace to Nx Cloud (remote caching + CI insights)").option(
7093
+ ).addOption(new import_commander.Option("--ci <provider>", "CI provider").choices(["azure", "github", "both"])).option("--test-runner <runner>", "unit-test runner: jest | vitest").option("--nx-cloud", "connect the workspace to Nx Cloud (remote caching + CI insights)").option(
7080
7094
  "--into <dir>",
7081
7095
  "bootstrap into an existing directory (a fresh clone holding only .git); the directory name is the workspace name unless one is given"
7082
7096
  ).action(async (name, options) => {