diff --git a/src/apphosting/secrets/dialogs.ts b/src/apphosting/secrets/dialogs.ts index d3fd2cccd03..51d82706888 100644 --- a/src/apphosting/secrets/dialogs.ts +++ b/src/apphosting/secrets/dialogs.ts @@ -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"); import { MultiServiceAccounts, ServiceAccounts, serviceAccountsForBackend, toMulti } from "."; @@ -178,7 +183,7 @@ export async function selectBackendServiceAccounts( const table = new Table({ head: tableData[0], style: { head: ["green"] }, - rows: tableData[1], + rows: tableData[1], // TODO: "rows" is not a field in TableOptions. }); logger.info(table.toString()); diff --git a/src/commands/appdistribution-groups-list.ts b/src/commands/appdistribution-groups-list.ts index 3637cff986d..28cc456d78e 100644 --- a/src/commands/appdistribution-groups-list.ts +++ b/src/commands/appdistribution-groups-list.ts @@ -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") diff --git a/src/commands/appdistribution-testers-list.ts b/src/commands/appdistribution-testers-list.ts index e880186a8dd..a45289b63e8 100644 --- a/src/commands/appdistribution-testers-list.ts +++ b/src/commands/appdistribution-testers-list.ts @@ -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") diff --git a/src/commands/apphosting-backends-list.ts b/src/commands/apphosting-backends-list.ts index 0b583e2d602..b70970019af 100644 --- a/src/commands/apphosting-backends-list.ts +++ b/src/commands/apphosting-backends-list.ts @@ -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") diff --git a/src/commands/apphosting-secrets-describe.ts b/src/commands/apphosting-secrets-describe.ts index 7abafafa8ef..1ab97683ce4 100644 --- a/src/commands/apphosting-secrets-describe.ts +++ b/src/commands/apphosting-secrets-describe.ts @@ -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 ") .description("Get metadata for secret and its versions.") diff --git a/src/commands/apps-android-sha-list.ts b/src/commands/apps-android-sha-list.ts index bd24b595c38..72961340243 100644 --- a/src/commands/apps-android-sha-list.ts +++ b/src/commands/apps-android-sha-list.ts @@ -1,4 +1,4 @@ -const Table = require("cli-table"); +import Table = require("cli-table"); import { Command } from "../command"; import { needProjectId } from "../projectUtils"; @@ -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]; diff --git a/src/commands/apps-list.ts b/src/commands/apps-list.ts index 766afb43426..857e6abe343 100644 --- a/src/commands/apps-list.ts +++ b/src/commands/apps-list.ts @@ -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"; diff --git a/src/commands/database-instances-list.ts b/src/commands/database-instances-list.ts index 42505f50610..c33138038c4 100644 --- a/src/commands/database-instances-list.ts +++ b/src/commands/database-instances-list.ts @@ -1,4 +1,4 @@ -const Table = require("cli-table"); +import Table = require("cli-table"); import { Command } from "../command"; import * as clc from "colorette"; diff --git a/src/commands/dataconnect-services-list.ts b/src/commands/dataconnect-services-list.ts index b0e5a3c2da4..0460b1d65c7 100644 --- a/src/commands/dataconnect-services-list.ts +++ b/src/commands/dataconnect-services-list.ts @@ -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") diff --git a/src/commands/emulators-start.ts b/src/commands/emulators-start.ts index eddc62fa06c..c3bd99bf87d 100644 --- a/src/commands/emulators-start.ts +++ b/src/commands/emulators-start.ts @@ -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)); diff --git a/src/commands/experiments-list.ts b/src/commands/experiments-list.ts index e546fe6bca5..77705183df8 100644 --- a/src/commands/experiments-list.ts +++ b/src/commands/experiments-list.ts @@ -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"; diff --git a/src/commands/ext-configure.ts b/src/commands/ext-configure.ts index 0bb8df38618..a4a55e9748e 100644 --- a/src/commands/ext-configure.ts +++ b/src/commands/ext-configure.ts @@ -126,7 +126,10 @@ export const command = new Command("ext:configure ") return; }); -function infoImmutableParams(immutableParams: Param[], paramValues: { [key: string]: string }) { +function infoImmutableParams( + immutableParams: Param[], + paramValues: { [key: string]: string }, +): void { if (!immutableParams.length) { return; } diff --git a/src/commands/ext-dev-deprecate.ts b/src/commands/ext-dev-deprecate.ts index 6bae6296347..d21383e0f0e 100644 --- a/src/commands/ext-dev-deprecate.ts +++ b/src/commands/ext-dev-deprecate.ts @@ -39,7 +39,7 @@ async function deprecate( extensionRef: refs.Ref, versionPredicate: string, options: ExtDevDeprecateOptions, -) { +): Promise { const { publisherId, extensionId, version } = extensionRef; if (version) { throw new FirebaseError( diff --git a/src/commands/ext-dev-init.ts b/src/commands/ext-dev-init.ts index b383fa577ea..5c94785906a 100644 --- a/src/commands/ext-dev-init.ts +++ b/src/commands/ext-dev-init.ts @@ -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 { return { integrationTestFirebaseJsonTemplate: readTemplateSync("extensions/integration-test.json"), integrationTestEnvTemplate: readTemplateSync("extensions/integration-test.env"), @@ -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>({ type: "list", name: "language", message: "In which language do you want to write the Cloud Functions for your extension?", @@ -49,7 +51,7 @@ export const command = new Command("ext:dev:init") value: "typescript", }, ], - }); + })) as string; switch (lang) { case "javascript": { await javascriptSelected(config); @@ -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( diff --git a/src/commands/ext-dev-list.ts b/src/commands/ext-dev-list.ts index f47c51a4dda..b87bf2a0fd7 100644 --- a/src/commands/ext-dev-list.ts +++ b/src/commands/ext-dev-list.ts @@ -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"; diff --git a/src/commands/ext-dev-usage.ts b/src/commands/ext-dev-usage.ts index e9cff76b2e8..8b53f2db844 100644 --- a/src/commands/ext-dev-usage.ts +++ b/src/commands/ext-dev-usage.ts @@ -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"; diff --git a/src/commands/functions-list.ts b/src/commands/functions-list.ts index ee4d0e38a17..cea4c9df254 100644 --- a/src/commands/functions-list.ts +++ b/src/commands/functions-list.ts @@ -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") diff --git a/src/commands/hosting-channel-list.ts b/src/commands/hosting-channel-list.ts index 0d721444257..2c523d4902c 100644 --- a/src/commands/hosting-channel-list.ts +++ b/src/commands/hosting-channel-list.ts @@ -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"; diff --git a/src/commands/hosting-sites-get.ts b/src/commands/hosting-sites-get.ts index bc32b327bb2..3666c689884 100644 --- a/src/commands/hosting-sites-get.ts +++ b/src/commands/hosting-sites-get.ts @@ -1,4 +1,4 @@ -const Table = require("cli-table"); +import Table = require("cli-table"); import { Command } from "../command"; import { Site, getSite } from "../hosting/api"; diff --git a/src/commands/hosting-sites-list.ts b/src/commands/hosting-sites-list.ts index d558bfc8f08..574e87842fd 100644 --- a/src/commands/hosting-sites-list.ts +++ b/src/commands/hosting-sites-list.ts @@ -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"; diff --git a/src/commands/projects-list.ts b/src/commands/projects-list.ts index 007346abe7f..d2dc89763e7 100644 --- a/src/commands/projects-list.ts +++ b/src/commands/projects-list.ts @@ -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"; diff --git a/src/commands/remoteconfig-get.ts b/src/commands/remoteconfig-get.ts index ac6f64c3b39..0a801308070 100644 --- a/src/commands/remoteconfig-get.ts +++ b/src/commands/remoteconfig-get.ts @@ -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"; diff --git a/src/commands/remoteconfig-versions-list.ts b/src/commands/remoteconfig-versions-list.ts index 19625219f22..7e4986439c0 100644 --- a/src/commands/remoteconfig-versions-list.ts +++ b/src/commands/remoteconfig-versions-list.ts @@ -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, diff --git a/src/emulator/commandUtils.ts b/src/emulator/commandUtils.ts index 119bc509f13..41b63d42372 100644 --- a/src/emulator/commandUtils.ts +++ b/src/emulator/commandUtils.ts @@ -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"; diff --git a/src/emulator/extensionsEmulator.ts b/src/emulator/extensionsEmulator.ts index 50bb45e1e0c..69b2321d3da 100644 --- a/src/emulator/extensionsEmulator.ts +++ b/src/emulator/extensionsEmulator.ts @@ -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"; diff --git a/src/extensions/change-log.ts b/src/extensions/change-log.ts index 6bfc1bd39a4..e2a96d553b8 100644 --- a/src/extensions/change-log.ts +++ b/src/extensions/change-log.ts @@ -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"; diff --git a/src/extensions/listExtensions.ts b/src/extensions/listExtensions.ts index c6cb663f1a3..3dd6c314b38 100644 --- a/src/extensions/listExtensions.ts +++ b/src/extensions/listExtensions.ts @@ -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"; diff --git a/src/firestore/pretty-print.ts b/src/firestore/pretty-print.ts index 8b3725e6870..6c875b7483f 100644 --- a/src/firestore/pretty-print.ts +++ b/src/firestore/pretty-print.ts @@ -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"; diff --git a/src/functions/secrets.ts b/src/functions/secrets.ts index 5e8cf85145e..851a0a45cbf 100644 --- a/src/functions/secrets.ts +++ b/src/functions/secrets.ts @@ -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, diff --git a/src/gcp/cloudsql/interactive.ts b/src/gcp/cloudsql/interactive.ts index 17a872c614e..20ab17b761f 100644 --- a/src/gcp/cloudsql/interactive.ts +++ b/src/gcp/cloudsql/interactive.ts @@ -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"]; diff --git a/src/init/features/genkit/index.ts b/src/init/features/genkit/index.ts index 730be6c53e8..dadddc73a84 100644 --- a/src/init/features/genkit/index.ts +++ b/src/init/features/genkit/index.ts @@ -77,7 +77,7 @@ async function getGenkitVersion(): Promise { 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: diff --git a/src/profileReport.ts b/src/profileReport.ts index ab0baca9dd6..a6b586edfa3 100644 --- a/src/profileReport.ts +++ b/src/profileReport.ts @@ -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"; @@ -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"); };