Skip to content

Commit

Permalink
maintenance plus firebase init genkit version update
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingrid Fielker committed Dec 18, 2024
1 parent 4e7b492 commit 1f4aac6
Show file tree
Hide file tree
Showing 32 changed files with 50 additions and 40 deletions.
7 changes: 6 additions & 1 deletion src/apphosting/secrets/dialogs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import * as clc from "colorette";

// TODO: change to `import Table = require("cli-table");` once the "rows:"
// issue below has been fixed. ("rows" is not a member of TableOptions)
// The issue is currently hidden because Table here is an `any` so
// type checking is skipped.
const Table = require("cli-table");

Check warning on line 7 in src/apphosting/secrets/dialogs.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value

Check warning on line 7 in src/apphosting/secrets/dialogs.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Require statement not part of import statement

import { MultiServiceAccounts, ServiceAccounts, serviceAccountsForBackend, toMulti } from ".";
Expand Down Expand Up @@ -178,7 +183,7 @@ export async function selectBackendServiceAccounts(
const table = new Table({

Check warning on line 183 in src/apphosting/secrets/dialogs.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value

Check warning on line 183 in src/apphosting/secrets/dialogs.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe construction of an any type value
head: tableData[0],
style: { head: ["green"] },
rows: tableData[1],
rows: tableData[1], // TODO: "rows" is not a field in TableOptions.
});
logger.info(table.toString());

Expand Down
2 changes: 1 addition & 1 deletion src/commands/appdistribution-groups-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Options } from "../options";
import { requireAuth } from "../requireAuth";
import * as utils from "../utils";

const Table = require("cli-table");
import Table = require("cli-table");

export const command = new Command("appdistribution:groups:list")
.description("list groups in project")
Expand Down
2 changes: 1 addition & 1 deletion src/commands/appdistribution-testers-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Options } from "../options";
import { requireAuth } from "../requireAuth";
import * as utils from "../utils";

const Table = require("cli-table");
import Table = require("cli-table");

export const command = new Command("appdistribution:testers:list [group]")
.description("list testers in project")
Expand Down
2 changes: 1 addition & 1 deletion src/commands/apphosting-backends-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { needProjectId } from "../projectUtils";
import { Options } from "../options";
import * as apphosting from "../gcp/apphosting";

const Table = require("cli-table");
import Table = require("cli-table");
const TABLE_HEAD = ["Backend", "Repository", "URL", "Location", "Updated Date"];

export const command = new Command("apphosting:backends:list")
Expand Down
2 changes: 1 addition & 1 deletion src/commands/apphosting-secrets-describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { listSecretVersions } from "../gcp/secretManager";
import * as secretManager from "../gcp/secretManager";
import { requirePermissions } from "../requirePermissions";

const Table = require("cli-table");
import Table = require("cli-table");

export const command = new Command("apphosting:secrets:describe <secretName>")
.description("Get metadata for secret and its versions.")
Expand Down
6 changes: 3 additions & 3 deletions src/commands/apps-android-sha-list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Table = require("cli-table");
import Table = require("cli-table");

import { Command } from "../command";
import { needProjectId } from "../projectUtils";
Expand All @@ -15,9 +15,9 @@ function logCertificatesList(certificates: AppAndroidShaData[]): void {
const tableHead = ["App Id", "SHA Id", "SHA Hash", "SHA Hash Type"];
const table = new Table({ head: tableHead, style: { head: ["green"] } });
certificates.forEach(({ name, shaHash, certType }) => {
/* the name property has the following value
/* the name property has the following value
"projects/projectId/androidApps/appId/sha/shaId" as it comes from the json response
so we slpit the string in order to get appId and shaId.
so we split the string in order to get appId and shaId.
Property shaId can be used by the end user to delete a SHA hash record.*/
const splitted = name.split("/");
const appId = splitted[3];
Expand Down
2 changes: 1 addition & 1 deletion src/commands/apps-list.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as clc from "colorette";
import * as ora from "ora";
const Table = require("cli-table");
import Table = require("cli-table");

import { Command } from "../command";
import { needProjectId } from "../projectUtils";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/database-instances-list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Table = require("cli-table");
import Table = require("cli-table");

import { Command } from "../command";
import * as clc from "colorette";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/dataconnect-services-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as client from "../dataconnect/client";
import { logger } from "../logger";
import { requirePermissions } from "../requirePermissions";
import { ensureApis } from "../dataconnect/ensureApis";
const Table = require("cli-table");
import Table = require("cli-table");

export const command = new Command("dataconnect:services:list")
.description("list all deployed services in your Firebase project")
Expand Down
2 changes: 1 addition & 1 deletion src/commands/emulators-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { sendVSCodeMessage, VSCODE_MESSAGE } from "../dataconnect/webhook";
import { Options } from "../options";

// eslint-disable-next-line @typescript-eslint/no-var-requires
const Table = require("cli-table");
import Table = require("cli-table");

function stylizeLink(url: string): string {
return clc.underline(clc.bold(url));
Expand Down
2 changes: 1 addition & 1 deletion src/commands/experiments-list.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Command } from "../command";
const Table = require("cli-table");
import Table = require("cli-table");
import * as experiments from "../experiments";
import { partition } from "../functional";
import { logger } from "../logger";
Expand Down
5 changes: 4 additions & 1 deletion src/commands/ext-configure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ export const command = new Command("ext:configure <extensionInstanceId>")
return;
});

function infoImmutableParams(immutableParams: Param[], paramValues: { [key: string]: string }) {
function infoImmutableParams(
immutableParams: Param[],
paramValues: { [key: string]: string },
): void {
if (!immutableParams.length) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/ext-dev-deprecate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function deprecate(
extensionRef: refs.Ref,
versionPredicate: string,
options: ExtDevDeprecateOptions,
) {
): Promise<void> {
const { publisherId, extensionId, version } = extensionRef;
if (version) {
throw new FirebaseError(
Expand Down
12 changes: 7 additions & 5 deletions src/commands/ext-dev-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import { promptOnce } from "../prompt";
import { logger } from "../logger";
import * as npmDependencies from "../init/features/functions/npm-dependencies";
import { readTemplateSync } from "../templates";
import { Options } from "../options";

marked.use(markedTerminal() as any);

function readCommonTemplates() {
function readCommonTemplates(): Record<string, string> {
return {
integrationTestFirebaseJsonTemplate: readTemplateSync("extensions/integration-test.json"),
integrationTestEnvTemplate: readTemplateSync("extensions/integration-test.env"),
Expand All @@ -28,13 +30,13 @@ function readCommonTemplates() {
export const command = new Command("ext:dev:init")
.description("initialize files for writing an extension in the current directory")
.before(checkMinRequiredVersion, "extDevMinVersion")
.action(async (options: any) => {
.action(async (options: Options) => {
const cwd = options.cwd || process.cwd();
const config = new Config({}, { projectDir: cwd, cwd: cwd });

try {
let welcome: string;
const lang = await promptOnce({
const lang: string = (await promptOnce<Record<string, string>>({
type: "list",
name: "language",
message: "In which language do you want to write the Cloud Functions for your extension?",
Expand All @@ -49,7 +51,7 @@ export const command = new Command("ext:dev:init")
value: "typescript",
},
],
});
})) as string;
switch (lang) {
case "javascript": {
await javascriptSelected(config);
Expand All @@ -68,7 +70,7 @@ export const command = new Command("ext:dev:init")

await npmDependencies.askInstallDependencies({ source: "functions" }, config);

return logger.info("\n" + marked(welcome));
return logger.info("\n" + (await marked(welcome)));
} catch (err: unknown) {
if (!(err instanceof FirebaseError)) {
throw new FirebaseError(
Expand Down
2 changes: 1 addition & 1 deletion src/commands/ext-dev-list.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as clc from "colorette";
const Table = require("cli-table");
import Table = require("cli-table");

import { Command } from "../command";
import { FirebaseError, getErrMsg } from "../error";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/ext-dev-usage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Table = require("cli-table");
import Table = require("cli-table");
import * as clc from "colorette";
import * as utils from "../utils";
import { Command } from "../command";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/functions-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Options } from "../options";
import { requirePermissions } from "../requirePermissions";
import * as backend from "../deploy/functions/backend";
import { logger } from "../logger";
const Table = require("cli-table");
import Table = require("cli-table");

export const command = new Command("functions:list")
.description("list all deployed functions in your Firebase project")
Expand Down
2 changes: 1 addition & 1 deletion src/commands/hosting-channel-list.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { bold } from "colorette";
const Table = require("cli-table");
import Table = require("cli-table");

import { Channel, listChannels } from "../hosting/api";
import { Command } from "../command";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/hosting-sites-get.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const Table = require("cli-table");
import Table = require("cli-table");

import { Command } from "../command";
import { Site, getSite } from "../hosting/api";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/hosting-sites-list.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { bold } from "colorette";
const Table = require("cli-table");
import Table = require("cli-table");

import { Command } from "../command";
import { Site, listSites } from "../hosting/api";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/projects-list.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as clc from "colorette";
import * as ora from "ora";
const Table = require("cli-table");
import Table = require("cli-table");

import { Command } from "../command";
import { listFirebaseProjects } from "../management/projects";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/remoteconfig-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { parseTemplateForTable } from "../remoteconfig/get";
import { Options } from "../options";
import * as utils from "../utils";

const Table = require("cli-table");
import Table = require("cli-table");
import * as fs from "fs";
import * as util from "util";
import { FirebaseError } from "../error";
Expand Down
4 changes: 2 additions & 2 deletions src/commands/remoteconfig-versions-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { requirePermissions } from "../requirePermissions";
import { Version, ListVersionsResult } from "../remoteconfig/interfaces";
import { datetimeString } from "../utils";

const Table = require("cli-table");
import Table = require("cli-table");

const tableHead = ["Update User", "Version Number", "Update Time"];

function pushTableContents(table: typeof Table, version: Version): number {
function pushTableContents(table: Table, version: Version): number {
return table.push([
version.updateUser?.email,
version.versionNumber,
Expand Down
2 changes: 1 addition & 1 deletion src/emulator/commandUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { promptOnce } from "../prompt";
import * as fsutils from "../fsutils";
import Signals = NodeJS.Signals;
import SignalsListener = NodeJS.SignalsListener;
const Table = require("cli-table");
import Table = require("cli-table");
import { emulatorSession } from "../track";
import { setEnvVarsForEmulators } from "./env";
import { sendVSCodeMessage, VSCODE_MESSAGE } from "../dataconnect/webhook";
Expand Down
2 changes: 1 addition & 1 deletion src/emulator/extensionsEmulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as spawn from "cross-spawn";
import * as fs from "fs-extra";
import * as os from "os";
import * as path from "path";
const Table = require("cli-table");
import Table = require("cli-table");

import * as planner from "../deploy/extensions/planner";
import { enableApiURI } from "../ensureApiEnabled";
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/change-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { marked } from "marked";
import * as path from "path";
import * as semver from "semver";
import { markedTerminal } from "marked-terminal";
const Table = require("cli-table");
import Table = require("cli-table");

import { listExtensionVersions } from "./extensionsApi";
import { readFile } from "./localHelper";
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/listExtensions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as clc from "colorette";
const Table = require("cli-table");
import Table = require("cli-table");

import { listInstances } from "./extensionsApi";
import { logger } from "../logger";
Expand Down
2 changes: 1 addition & 1 deletion src/firestore/pretty-print.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as clc from "colorette";
const Table = require("cli-table");
import Table = require("cli-table");

import * as sort from "./api-sort";
import * as types from "./api-types";
Expand Down
2 changes: 1 addition & 1 deletion src/functions/secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { isFunctionsManaged, FIREBASE_MANAGED } from "../gcp/secretManager";
import { labels } from "../gcp/secretManager";
import { needProjectId } from "../projectUtils";

const Table = require("cli-table");
import Table = require("cli-table");

// For mysterious reasons, importing the poller option in fabricator.ts leads to some
// value of the poller option to be undefined at runtime. I can't figure out what's going on,
Expand Down
2 changes: 1 addition & 1 deletion src/gcp/cloudsql/interactive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { logger } from "../../logger";
import { confirm } from "../../prompt";

// eslint-disable-next-line @typescript-eslint/no-var-requires
const Table = require("cli-table");
import Table = require("cli-table");

// Not comprehensive list, used for best offer prompting.
const destructiveSqlKeywords = ["DROP", "DELETE"];
Expand Down
2 changes: 1 addition & 1 deletion src/init/features/genkit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async function getGenkitVersion(): Promise<GenkitInfo> {
throw new FirebaseError("Unable to determine genkit version to install");
}

if (semver.gte(genkitVersion, "1.0.0")) {
if (semver.gte(genkitVersion, "2.0.0")) {
// We don't know about this version. (Can override with GENKIT_DEV_VERSION)
const continueInstall = await confirm({
message:
Expand Down
4 changes: 2 additions & 2 deletions src/profileReport.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as clc from "colorette";
const Table = require("cli-table");
import Table = require("cli-table");
import * as fs from "fs";
import * as _ from "lodash";
import * as readline from "readline";
Expand Down Expand Up @@ -597,7 +597,7 @@ export class ProfileReport {
write(clc.bold(clc.yellow(title)) + "\n");
}
};
const writeTable = (title: string, table: typeof Table) => {
const writeTable = (title: string, table: Table) => {
writeTitle(title);
write(table.toString() + "\n");
};
Expand Down

0 comments on commit 1f4aac6

Please sign in to comment.