@sanity/cli 3.91.1-next.23.8af6f8d288 → 3.91.1-next.24.3717582803

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.
@@ -53812,7 +53812,7 @@ ${err.message}`);
53812
53812
  });
53813
53813
  return createProject(apiClient, {
53814
53814
  displayName: projectName,
53815
- organizationId: await getOrganizationId(organizations),
53815
+ organizationId: cliFlags.organization || await getOrganizationId(organizations),
53816
53816
  subscription: selectedPlan ? { planId: selectedPlan } : void 0,
53817
53817
  metadata: { coupon: intendedCoupon }
53818
53818
  }).then((response) => ({
@@ -53841,7 +53841,7 @@ ${err.message}`);
53841
53841
  message: "Your project name:",
53842
53842
  default: "My Sanity Project"
53843
53843
  }),
53844
- organizationId: await getOrganizationId(organizations),
53844
+ organizationId: cliFlags.organization || await getOrganizationId(organizations),
53845
53845
  subscription: selectedPlan ? { planId: selectedPlan } : void 0,
53846
53846
  metadata: { coupon: intendedCoupon }
53847
53847
  }).then((response) => ({
@@ -54025,12 +54025,23 @@ The default dataset configuration has a public dataset named "production".`;
54025
54025
  throw new Error(
54026
54026
  "`--project <id>` or `--create-project <name>` must be specified in unattended mode"
54027
54027
  );
54028
+ if (createProjectName && !cliFlags.organization)
54029
+ throw new Error(
54030
+ "--create-project is not supported in unattended mode without an organization, please specify an organization with `--organization <id>`"
54031
+ );
54028
54032
  }
54029
54033
  if (createProjectName) {
54030
54034
  loadEnv.debug("--create-project specified, creating a new project");
54035
+ let orgForCreateProjectFlag = cliFlags.organization;
54036
+ if (!orgForCreateProjectFlag) {
54037
+ loadEnv.debug("no organization specified, selecting one");
54038
+ const organizations = await apiClient({ requireUser: !0, requireProject: !1 }).request({ uri: "/organizations" });
54039
+ orgForCreateProjectFlag = await getOrganizationId(organizations);
54040
+ }
54041
+ loadEnv.debug("creating a new project");
54031
54042
  const createdProject = await createProject(apiClient, {
54032
54043
  displayName: createProjectName.trim(),
54033
- organizationId: cliFlags.organization || void 0,
54044
+ organizationId: orgForCreateProjectFlag,
54034
54045
  subscription: selectedPlan ? { planId: selectedPlan } : void 0,
54035
54046
  metadata: { coupon: intendedCoupon }
54036
54047
  });
@@ -54077,8 +54088,6 @@ The default dataset configuration has a public dataset named "production".`;
54077
54088
  return chosenOrg === "-new-" ? createOrganization().then((org) => org.id) : chosenOrg || void 0;
54078
54089
  }
54079
54090
  async function getOrganizationId(organizations) {
54080
- if (unattended || flags.organization)
54081
- return flags.organization || void 0;
54082
54091
  if (organizations.length === 0)
54083
54092
  return createOrganization().then((org) => org.id);
54084
54093
  loadEnv.debug(`User has ${organizations.length} organization(s), checking attach access`);