Skip to content

Commit 62f88d9

Browse files
committed
Print warning about --location removal.
1 parent 2bfb61b commit 62f88d9

8 files changed

+51
-15
lines changed

src/commands/apphosting-backends-create.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import { doSetup } from "../apphosting/backend";
66
import { ensureApiEnabled } from "../gcp/apphosting";
77
import { APPHOSTING_TOS_ID } from "../gcp/firedata";
88
import { requireTosAcceptance } from "../requireTosAcceptance";
9+
import { logWarning } from "../utils";
910

1011
export const command = new Command("apphosting:backends:create")
1112
.description("create a Firebase App Hosting backend")
1213
.option(
1314
"-a, --app <webAppId>",
1415
"specify an existing Firebase web app's ID to associate your App Hosting backend with",
1516
)
16-
.option("-l, --location <location>", "specify the location of the backend", "")
17+
.option("-l, --location <location>", "specify the location of the backend")
1718
.option(
1819
"-s, --service-account <serviceAccount>",
1920
"specify the service account used to run the server",
@@ -23,9 +24,15 @@ export const command = new Command("apphosting:backends:create")
2324
.before(requireInteractive)
2425
.before(requireTosAcceptance(APPHOSTING_TOS_ID))
2526
.action(async (options: Options) => {
27+
if (options.location !== undefined) {
28+
logWarning(
29+
"--location is being removed in the next major release. " +
30+
"The CLI will prompt for a Primary Region where appropriate.",
31+
);
32+
}
2633
const projectId = needProjectId(options);
2734
const webAppId = options.app;
28-
const location = options.location;
35+
const location = options.location as string;
2936
const serviceAccount = options.serviceAccount;
3037

3138
await doSetup(

src/commands/apphosting-backends-delete.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@ import * as ora from "ora";
1515

1616
export const command = new Command("apphosting:backends:delete <backend>")
1717
.description("delete a Firebase App Hosting backend")
18-
.option("-l, --location <location>", "specify the location of the backend", "-")
18+
.option("-l, --location <location>", "specify the location of the backend")
1919
.withForce()
2020
.before(apphosting.ensureApiEnabled)
2121
.action(async (backendId: string, options: Options) => {
2222
const projectId = needProjectId(options);
23-
let location = options.location as string;
23+
if (options.location !== undefined) {
24+
utils.logWarning(
25+
"--location is being removed in the next major release. " +
26+
"Instead, the CLI will list all possible backends to be deleted.",
27+
);
28+
}
29+
let location = (options.location as string) ?? "-";
2430
let backend: apphosting.Backend;
2531
if (location === "-" || location === "") {
2632
backend = await getBackendForAmbiguousLocation(

src/commands/apphosting-backends-get.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ import { printBackendsTable } from "./apphosting-backends-list";
88

99
export const command = new Command("apphosting:backends:get <backend>")
1010
.description("print info about a Firebase App Hosting backend")
11-
.option("-l, --location <location>", "backend location", "-")
11+
.option("-l, --location <location>", "backend location")
1212
.before(apphosting.ensureApiEnabled)
1313
.action(async (backend: string, options: Options) => {
1414
const projectId = needProjectId(options);
15-
const location = options.location as string;
15+
if (options.location !== undefined) {
16+
logWarning("--location is being removed in the next major release.");
17+
}
18+
const location = (options.location as string) ?? "-";
1619

1720
let backendsList: apphosting.Backend[] = [];
1821
try {

src/commands/apphosting-backends-list.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@ import { needProjectId } from "../projectUtils";
66
import { Options } from "../options";
77
import * as apphosting from "../gcp/apphosting";
88
import * as Table from "cli-table3";
9+
import { logWarning } from "../utils";
910

1011
const TABLE_HEAD = ["Backend", "Repository", "URL", "Location", "Updated Date"];
1112

1213
export const command = new Command("apphosting:backends:list")
1314
.description("list Firebase App Hosting backends")
14-
.option("-l, --location <location>", "list backends in the specified location", "-")
15+
.option("-l, --location <location>", "list backends in the specified location")
1516
.before(apphosting.ensureApiEnabled)
1617
.action(async (options: Options) => {
18+
if (options.location !== undefined) {
19+
logWarning("--location is being removed in the next major release.");
20+
}
1721
const projectId = needProjectId(options);
18-
const location = options.location as string;
22+
const location = (options.location as string) ?? "-";
1923
let backendRes: apphosting.ListBackendsResponse;
2024
try {
2125
backendRes = await apphosting.listBackends(projectId, location);

src/commands/apphosting-builds-create.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@ import { logger } from "../logger";
33
import { Command } from "../command";
44
import { Options } from "../options";
55
import { needProjectId } from "../projectUtils";
6+
import { logWarning } from "../utils";
67

78
export const command = new Command("apphosting:builds:create <backendId>")
89
.description("create a build for an App Hosting backend")
9-
.option("-l, --location <location>", "specify the region of the backend", "us-central1")
10+
.option("-l, --location <location>", "specify the region of the backend")
1011
.option("-i, --id <buildId>", "id of the build (defaults to autogenerating a random id)", "")
1112
.option("-b, --branch <branch>", "repository branch to deploy (defaults to 'main')", "main")
1213
.before(apphosting.ensureApiEnabled)
1314
.action(async (backendId: string, options: Options) => {
1415
const projectId = needProjectId(options);
15-
const location = options.location as string;
16+
if (options.location !== undefined) {
17+
logWarning("--location is being removed in the next major release.");
18+
}
19+
const location = (options.location as string) ?? "us-central1";
1620
const buildId =
1721
(options.buildId as string) ||
1822
(await apphosting.getNextRolloutId(projectId, location, backendId));

src/commands/apphosting-builds-get.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@ import { logger } from "../logger";
33
import { Command } from "../command";
44
import { Options } from "../options";
55
import { needProjectId } from "../projectUtils";
6+
import { logWarning } from "../utils";
67

78
export const command = new Command("apphosting:builds:get <backendId> <buildId>")
89
.description("get a build for an App Hosting backend")
9-
.option("-l, --location <location>", "specify the region of the backend", "us-central1")
10+
.option("-l, --location <location>", "specify the region of the backend")
1011
.before(apphosting.ensureApiEnabled)
1112
.action(async (backendId: string, buildId: string, options: Options) => {
13+
if (options.location !== undefined) {
14+
logWarning("--location is being removed in the next major release.");
15+
}
16+
options.location = options.location ?? "us-central";
1217
const projectId = needProjectId(options);
1318
const location = options.location as string;
1419
const build = await apphosting.getBuild(projectId, location, backendId, buildId);

src/commands/apphosting-rollouts-create.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import { Options } from "../options";
44
import { needProjectId } from "../projectUtils";
55
import { FirebaseError } from "../error";
66
import { createRollout } from "../apphosting/rollout";
7+
import { logWarning } from "../utils";
78

89
export const command = new Command("apphosting:rollouts:create <backendId>")
910
.description("create a rollout using a build for an App Hosting backend")
10-
.option("-l, --location <location>", "specify the region of the backend", "-")
11+
.option("-l, --location <location>", "specify the region of the backend")
1112
.option(
1213
"-b, --git-branch <gitBranch>",
1314
"repository branch to deploy (mutually exclusive with -g)",
@@ -17,7 +18,10 @@ export const command = new Command("apphosting:rollouts:create <backendId>")
1718
.before(apphosting.ensureApiEnabled)
1819
.action(async (backendId: string, options: Options) => {
1920
const projectId = needProjectId(options);
20-
const location = options.location as string;
21+
if (options.location !== undefined) {
22+
logWarning("--location is being removed in the next major release.");
23+
}
24+
const location = (options.location as string) ?? "-";
2125

2226
const branch = options.gitBranch as string | undefined;
2327
const commit = options.gitCommit as string | undefined;

src/commands/apphosting-rollouts-list.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@ import { logger } from "../logger";
33
import { Command } from "../command";
44
import { Options } from "../options";
55
import { needProjectId } from "../projectUtils";
6+
import { logWarning } from "../utils";
67

78
export const command = new Command("apphosting:rollouts:list <backendId>")
89
.description("list rollouts of an App Hosting backend")
910
.option(
1011
"-l, --location <location>",
1112
"region of the rollouts (defaults to listing rollouts from all regions)",
12-
"-",
1313
)
1414
.before(apphosting.ensureApiEnabled)
1515
.action(async (backendId: string, options: Options) => {
16+
if (options.location !== undefined) {
17+
logWarning("--location is being removed in the next major release.");
18+
}
1619
const projectId = needProjectId(options);
17-
const location = options.location as string;
20+
const location = (options.location as string) ?? "-";
1821
const rollouts = await apphosting.listRollouts(projectId, location, backendId);
1922
if (rollouts.unreachable) {
2023
logger.error(

0 commit comments

Comments
 (0)