@sanity/cli 3.44.1-canary.21 → 3.44.1-mmm-canary.137

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.
@@ -21685,7 +21685,9 @@ var preferredPm = async function preferredPM2(pkgPath) {
21685
21685
  const pm = await whichPM(pkgPath);
21686
21686
  return pm && { name: pm.name, version: pm.version || "*" };
21687
21687
  }, preferredPM = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(preferredPm);
21688
- const isInteractive$2 = process.stdout.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env), EXPERIMENTAL = ["bun"];
21688
+ const isInteractive$2 = process.stdout.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env), ALLOWED_PACKAGE_MANAGERS = ["npm", "yarn", "pnpm", "bun", "manual"], allowedPackageManagersString = ALLOWED_PACKAGE_MANAGERS.map((pm) => `"${pm}"`).join(
21689
+ " | "
21690
+ ), EXPERIMENTAL = ["bun"];
21689
21691
  async function getPackageManagerChoice(workDir, options2) {
21690
21692
  const rootDir = workDir || process.cwd(), preferred = (await preferredPM(rootDir))?.name;
21691
21693
  if (preferred && await hasCommand(preferred, rootDir))
@@ -44195,7 +44197,7 @@ async function initSanity(args, context) {
44195
44197
  sanityMajorVersion,
44196
44198
  telemetry: telemetry2,
44197
44199
  detectedFramework
44198
- } = context, trace = telemetry2.trace(CLIInitStepCompleted), cliFlags = args.extOptions, unattended = cliFlags.y || cliFlags.yes, print = unattended ? lodashExports.noop : output.print, intendedPlan = cliFlags["project-plan"], intendedCoupon = cliFlags.coupon, reconfigure = cliFlags.reconfigure, commitMessage = cliFlags.git, useGit = typeof commitMessage > "u" ? !0 : !!commitMessage, bareOutput = cliFlags.bare, env = cliFlags.env;
44200
+ } = context, trace = telemetry2.trace(CLIInitStepCompleted), cliFlags = args.extOptions, unattended = cliFlags.y || cliFlags.yes, print = unattended ? lodashExports.noop : output.print, intendedPlan = cliFlags["project-plan"], intendedCoupon = cliFlags.coupon, reconfigure = cliFlags.reconfigure, commitMessage = cliFlags.git, useGit = typeof commitMessage > "u" ? !0 : !!commitMessage, bareOutput = cliFlags.bare, env = cliFlags.env, packageManager = cliFlags["package-manager"];
44199
44201
  let defaultConfig = cliFlags["dataset-default"], showDefaultConfigPrompt = !defaultConfig;
44200
44202
  if (trace.start(), trace.log({
44201
44203
  step: "start",
@@ -44377,7 +44379,6 @@ You can find your project on Sanity Manage \u2014 https://www.sanity.io/manage/p
44377
44379
  `
44378
44380
  ${chalk2.green("Success!")} Your Sanity configuration files has been added to this project`
44379
44381
  ), process.exit(0);
44380
- return;
44381
44382
  }
44382
44383
  function countNestedFolders(path2) {
44383
44384
  const separator2 = path2.includes("\\") ? "\\" : "/";
@@ -44422,11 +44423,15 @@ ${chalk2.green("Success!")} Your Sanity configuration files has been added to th
44422
44423
  }
44423
44424
  }, shouldImport = !unattended && template.datasetUrl && await promptForDatasetImport(template.importPrompt);
44424
44425
  trace.log({ step: "importTemplateDataset", selectedOption: shouldImport ? "yes" : "no" }), await bootstrapTemplate(templateOptions, context);
44425
- const pkgManager = await getPackageManagerChoice(outputPath, {
44426
+ let pkgManager;
44427
+ if (packageManager && ALLOWED_PACKAGE_MANAGERS.includes(packageManager) ? pkgManager = packageManager : (pkgManager = (await getPackageManagerChoice(outputPath, {
44426
44428
  prompt: prompt2,
44427
44429
  interactive: unattended ? !1 : isInteractive$2
44428
- });
44429
- if (trace.log({ step: "selectPackageManager", selectedOption: pkgManager.chosen }), await installDeclaredPackages(outputPath, pkgManager.chosen, context), useGit && tryGitInit(outputPath, typeof commitMessage == "string" ? commitMessage : void 0), shouldImport) {
44430
+ })).chosen, packageManager && (output.warn(
44431
+ chalk2.yellow(
44432
+ `Given package manager "${packageManager}" is not supported. Supported package managers are ${allowedPackageManagersString}.`
44433
+ )
44434
+ ), output.print(`Using ${pkgManager} as package manager`))), trace.log({ step: "selectPackageManager", selectedOption: pkgManager }), await installDeclaredPackages(outputPath, pkgManager, context), useGit && tryGitInit(outputPath, typeof commitMessage == "string" ? commitMessage : void 0), shouldImport) {
44430
44435
  const importCommand = getImportCommand(outputPath);
44431
44436
  await doDatasetImport({
44432
44437
  projectId,
@@ -44444,7 +44449,7 @@ ${chalk2.green("Success!")} Your Sanity configuration files has been added to th
44444
44449
  pnpm: "pnpm dev",
44445
44450
  bun: "bun dev",
44446
44451
  manual: "npm run dev"
44447
- }[pkgManager.chosen];
44452
+ }[pkgManager];
44448
44453
  outputPath === process.cwd() ? (print(`
44449
44454
  ${chalk2.green("Success!")} Now, use this command to continue:
44450
44455
  `), print(`${chalk2.cyan(devCommand)} - to run Sanity Studio
@@ -44937,6 +44942,7 @@ Options
44937
44942
  --project-plan <name> Optionally select a plan for a new project
44938
44943
  --coupon <name> Optionally select a coupon for a new project (cannot be used with --project-plan)
44939
44944
  --no-typescript Do not use TypeScript for template files
44945
+ --package-manager <name> Specify which package manager to use [allowed: ${allowedPackageManagersString}]
44940
44946
 
44941
44947
  Examples
44942
44948
  # Initialize a new project, prompt for required information along the way