@prisma/cli 3.0.0-dev.131.1 → 3.0.0-dev.132.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.
@@ -333,12 +333,13 @@ function createRollbackCommand(runtime) {
333
333
  }
334
334
  function createRemoveCommand(runtime) {
335
335
  const command = attachCommandDescriptor(configureRuntimeCommand(new Command("remove"), runtime), "app.remove");
336
- command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name"));
336
+ command.argument("[app]", "App target from prisma.compute.ts when the config defines multiple apps").addOption(new Option("--app <name>", "App name")).addOption(new Option("--project <id-or-name>", "Project id or name")).addOption(new Option("--branch <name>", "Branch name"));
337
337
  addGlobalFlags(command);
338
338
  command.action(async (configTarget, options) => {
339
339
  const appName = options.app;
340
340
  const projectRef = options.project;
341
- await runCommand(runtime, "app.remove", options, (context) => runAppRemove(context, appName, projectRef, configTarget), {
341
+ const branchName = options.branch;
342
+ await runCommand(runtime, "app.remove", options, (context) => runAppRemove(context, appName, projectRef, configTarget, branchName), {
342
343
  renderHuman: (context, descriptor, result) => renderAppRemove(context, descriptor, result),
343
344
  renderJson: (result) => serializeAppRemove(result)
344
345
  });
@@ -967,11 +967,19 @@ async function runAppRollback(context, appName, deploymentId, projectRef, config
967
967
  nextSteps: ["prisma-cli app list-deploys", `prisma-cli app show-deploy ${targetDeployment.id}`]
968
968
  };
969
969
  }
970
- async function runAppRemove(context, appName, projectRef, configTarget) {
970
+ /**
971
+ * Removes an app and every deployment it owns in the resolved branch.
972
+ *
973
+ * @param branchName Scopes the removal to this branch. When omitted the branch
974
+ * is inferred from the local Git branch, falling back to the production branch.
975
+ */
976
+ async function runAppRemove(context, appName, projectRef, configTarget, branchName) {
971
977
  ensurePreviewAppMode(context);
972
978
  const compute = await resolveComputeManagementContext(context, configTarget, "remove");
973
979
  appName = appName ?? compute.configAppName;
980
+ if (branchName !== void 0 && branchName.trim() === "") throw usageError("The --branch value cannot be empty", "app remove scopes the removal to the given branch; an empty --branch would silently fall back to the inferred (possibly production) branch.", "Pass a non-empty branch name, e.g. --branch <branch>, or omit --branch to use the inferred branch.", ["prisma-cli app remove --app <name> --branch <branch>"], "app");
974
981
  const { provider, target, projectId } = await requireProviderAndProjectContext(context, projectRef, {
982
+ branch: branchName !== void 0 ? await resolveDeployBranch(context, branchName) : void 0,
975
983
  commandName: "app remove",
976
984
  projectDir: compute.projectDir
977
985
  });
@@ -798,8 +798,12 @@ const DESCRIPTORS = [
798
798
  "app",
799
799
  "remove"
800
800
  ],
801
- description: "Remove the app from the current branch",
802
- examples: ["prisma-cli app remove --app hello-world", "prisma-cli app remove --app hello-world --yes"]
801
+ description: "Remove the app from the resolved branch",
802
+ examples: [
803
+ "prisma-cli app remove --app hello-world",
804
+ "prisma-cli app remove --app hello-world --yes",
805
+ "prisma-cli app remove --app hello-world --branch feature/foo --yes"
806
+ ]
803
807
  },
804
808
  {
805
809
  id: "project.env",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/cli",
3
- "version": "3.0.0-dev.131.1",
3
+ "version": "3.0.0-dev.132.1",
4
4
  "description": "Command-line interface for the Prisma Developer Platform.",
5
5
  "type": "module",
6
6
  "bin": {