Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove --location from apphosting:backends:get and return the first backend if multiple are found. #8260

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions src/commands/apphosting-backends-get.ts
Original file line number Diff line number Diff line change
@@ -8,25 +8,15 @@ import { printBackendsTable } from "./apphosting-backends-list";

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

let backendsList: apphosting.Backend[] = [];
try {
if (location !== "-") {
const backendInRegion = await apphosting.getBackend(projectId, location, backend);
backendsList.push(backendInRegion);
} else {
const resp = await apphosting.listBackends(projectId, "-");
const allBackends = resp.backends || [];
backendsList = allBackends.filter((bkd) => bkd.name.split("/").pop() === backend);
}
const resp = await apphosting.listBackends(projectId, "-");
const allBackends = resp.backends || [];
backendsList = allBackends.filter((bkd) => bkd.name.split("/").pop() === backend);
} catch (err: unknown) {
throw new FirebaseError(
`Failed to get backend: ${backend}. Please check the parameters you have provided.`,
@@ -37,6 +27,13 @@ export const command = new Command("apphosting:backends:get <backend>")
logWarning(`Backend "${backend}" not found`);
return;
}
printBackendsTable(backendsList);
if (backendsList.length > 1) {
logWarning(
`Detected multiple backends with the same ${backend} ID. This is not allowed until we can support more locations.\n` +
`Please delete and recreate any backends that share an ID with another backend. ` +
`Use apphosting:backends:list to see all backends.\n Returning the following backend:`,
);
}
printBackendsTable(backendsList.slice(0, 1));
return backendsList[0];
});

Unchanged files with check annotations Beta

export const DEFAULT_BUILD_SCRIPT = ["vite build", "tsc && vite build"];
export const initViteTemplate = (template: string) => async (setup: any, config: any) =>

Check warning on line 24 in src/frameworks/vite/index.ts

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 24 in src/frameworks/vite/index.ts

GitHub Actions / lint (20)

Unexpected any. Specify a different type
await init(setup, config, template);
export async function init(setup: any, config: any, baseTemplate: string = "vanilla") {

Check warning on line 27 in src/frameworks/vite/index.ts

GitHub Actions / lint (20)

Missing return type on function

Check warning on line 27 in src/frameworks/vite/index.ts

GitHub Actions / lint (20)

Missing JSDoc comment

Check warning on line 27 in src/frameworks/vite/index.ts

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 27 in src/frameworks/vite/index.ts

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 27 in src/frameworks/vite/index.ts

GitHub Actions / lint (20)

Type string trivially inferred from a string literal, remove type annotation
const template = await promptOnce({

Check warning on line 28 in src/frameworks/vite/index.ts

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
type: "list",
default: "JavaScript",
message: "What language would you like to use?",
],
});
execSync(
`npm create vite@"${supportedRange}" ${setup.hosting.source} --yes -- --template ${template}`,

Check warning on line 38 in src/frameworks/vite/index.ts

GitHub Actions / lint (20)

Invalid type "any" of template literal expression

Check warning on line 38 in src/frameworks/vite/index.ts

GitHub Actions / lint (20)

Unsafe member access .hosting on an `any` value
{
stdio: "inherit",
cwd: config.projectDir,
// Subscription to trigger emulator exports when button is clicked.
this.subscriptions.push(broker.on("runEmulatorsExport", () => {
vscode.commands.executeCommand("firebase.emulators.exportData")

Check warning on line 45 in firebase-vscode/src/core/emulators.ts

GitHub Actions / lint (20)

Missing semicolon
}));
}
(args: { appFolder: string }) => {
analyticsLogger.logger.logUsage(DATA_CONNECT_EVENT_NAME.INIT_SDK_CLI);
// Lets do it from the right directory
const e: Record<string, string> = {}

Check warning on line 43 in firebase-vscode/src/data-connect/sdk-generation.ts

GitHub Actions / lint (20)

Missing semicolon
e[FDC_APP_FOLDER] = args.appFolder;
setTerminalEnvVars(e);
runCommand(`${settings.firebasePath} init dataconnect:sdk`);
import { FirebaseSidebar } from "../../utils/page_objects/sidebar";
import { mockUser } from "../../utils/user";
import { Workbench, Notification } from "wdio-vscode-service";
import {Notifications} from "../../utils/page_objects/notifications"

Check warning on line 13 in firebase-vscode/src/test/integration/fishfood/execution.ts

GitHub Actions / lint (20)

Missing semicolon
firebaseSuite("Execution", async function () {
firebaseTest(
expect(startEmulatorsNotif).toExist();
// should always exist due to check above; Click Yes
if (startEmulatorsNotif)
notificationUtil.startEmulatorFromNotification(startEmulatorsNotif);

Check warning on line 45 in firebase-vscode/src/test/integration/fishfood/execution.ts

GitHub Actions / lint (20)

Expected { after 'if' condition
console.log(
"Starting emulators from local execution. Waiting for emulators to start...",