diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29bb2d..4ffa9bd0696 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1 @@ +- Add a confirmation in `firebase init dataconnect` before asking for app idea description. (#9282) diff --git a/firebase-vscode/src/options.ts b/firebase-vscode/src/options.ts index a829e6c9551..dc10941d725 100644 --- a/firebase-vscode/src/options.ts +++ b/firebase-vscode/src/options.ts @@ -26,7 +26,6 @@ const defaultOptions: Readonly = { projectNumber: "", projectRoot: "", account: "", - json: true, nonInteractive: true, interactive: false, debug: false, diff --git a/src/checkValidTargetFilters.spec.ts b/src/checkValidTargetFilters.spec.ts index e77100fe7c3..fc052498964 100644 --- a/src/checkValidTargetFilters.spec.ts +++ b/src/checkValidTargetFilters.spec.ts @@ -13,7 +13,6 @@ const SAMPLE_OPTIONS: Options = { only: "", except: "", nonInteractive: false, - json: false, interactive: false, debug: false, force: false, diff --git a/src/command.ts b/src/command.ts index 36d6ab502f6..1f82d68343a 100644 --- a/src/command.ts +++ b/src/command.ts @@ -313,6 +313,7 @@ export class Command { } if (getInheritedOption(options, "json")) { + options.interactive = false; options.nonInteractive = true; } else if (!options.isMCP) { useConsoleLoggers(); diff --git a/src/commands/firestore-backups-delete.ts b/src/commands/firestore-backups-delete.ts index 4fb8339f916..ecc6e8d538c 100644 --- a/src/commands/firestore-backups-delete.ts +++ b/src/commands/firestore-backups-delete.ts @@ -34,11 +34,7 @@ export const command = new Command("firestore:backups:delete ") throw new FirebaseError(`Failed to delete the backup ${backupName}`, { original: err }); } - if (options.json) { - logger.info(JSON.stringify(backup, undefined, 2)); - } else { - logger.info(clc.bold(`Successfully deleted ${clc.yellow(backupName)}`)); - } + logger.info(clc.bold(`Successfully deleted ${clc.yellow(backupName)}`)); return backup; }); diff --git a/src/commands/firestore-backups-get.ts b/src/commands/firestore-backups-get.ts index 73aaa677e30..3a030370590 100644 --- a/src/commands/firestore-backups-get.ts +++ b/src/commands/firestore-backups-get.ts @@ -1,9 +1,7 @@ import { Command } from "../command"; -import { logger } from "../logger"; import { requirePermissions } from "../requirePermissions"; import { Emulators } from "../emulator/types"; import { warnEmulatorNotSupported } from "../emulator/commandUtils"; -import { FirestoreOptions } from "../firestore/options"; import { Backup, getBackup } from "../gcp/firestore"; import { PrettyPrint } from "../firestore/pretty-print"; @@ -11,15 +9,11 @@ export const command = new Command("firestore:backups:get ") .description("get a Cloud Firestore database backup") .before(requirePermissions, ["datastore.backups.get"]) .before(warnEmulatorNotSupported, Emulators.FIRESTORE) - .action(async (backupName: string, options: FirestoreOptions) => { + .action(async (backupName: string) => { const backup: Backup = await getBackup(backupName); const printer = new PrettyPrint(); - if (options.json) { - logger.info(JSON.stringify(backup, undefined, 2)); - } else { - printer.prettyPrintBackup(backup); - } + printer.prettyPrintBackup(backup); return backup; }); diff --git a/src/commands/firestore-backups-list.ts b/src/commands/firestore-backups-list.ts index 8080b0d4b1a..d330684c1d5 100644 --- a/src/commands/firestore-backups-list.ts +++ b/src/commands/firestore-backups-list.ts @@ -1,5 +1,4 @@ import { Command } from "../command"; -import { logger } from "../logger"; import { requirePermissions } from "../requirePermissions"; import { Emulators } from "../emulator/types"; import { warnEmulatorNotSupported } from "../emulator/commandUtils"; @@ -23,17 +22,15 @@ export const command = new Command("firestore:backups:list") const listBackupsResponse: ListBackupsResponse = await listBackups(options.project, location); const backups: Backup[] = listBackupsResponse.backups || []; - if (options.json) { - logger.info(JSON.stringify(listBackupsResponse, undefined, 2)); - } else { - printer.prettyPrintBackups(backups); - if (listBackupsResponse.unreachable && listBackupsResponse.unreachable.length > 0) { - logWarning( - "We were not able to reach the following locations: " + - listBackupsResponse.unreachable.join(", "), - ); - } + printer.prettyPrintBackups(backups); + if (listBackupsResponse.unreachable && listBackupsResponse.unreachable.length > 0) { + logWarning( + "We were not able to reach the following locations: " + + listBackupsResponse.unreachable.join(", "), + ); } + // TODO: Consider returning listBackupResponse instead for --json. This will + // be a breaking change but exposes .unreachable, not just .backups. return backups; }); diff --git a/src/commands/firestore-backups-schedules-create.ts b/src/commands/firestore-backups-schedules-create.ts index 255c190b0c0..e7e9e3917d1 100644 --- a/src/commands/firestore-backups-schedules-create.ts +++ b/src/commands/firestore-backups-schedules-create.ts @@ -81,13 +81,9 @@ export const command = new Command("firestore:backups:schedules:create") weeklyRecurrence, ); - if (options.json) { - logger.info(JSON.stringify(backupSchedule, undefined, 2)); - } else { - logger.info( - clc.bold(`Successfully created ${printer.prettyBackupScheduleString(backupSchedule)}`), - ); - } + logger.info( + clc.bold(`Successfully created ${printer.prettyBackupScheduleString(backupSchedule)}`), + ); return backupSchedule; }); diff --git a/src/commands/firestore-backups-schedules-delete.ts b/src/commands/firestore-backups-schedules-delete.ts index 8915f737470..4bb134bd22c 100644 --- a/src/commands/firestore-backups-schedules-delete.ts +++ b/src/commands/firestore-backups-schedules-delete.ts @@ -36,11 +36,7 @@ export const command = new Command("firestore:backups:schedules:delete ") const databaseResp: types.DatabaseResp = await api.createDatabase(createDatabaseReq); - if (options.json) { - logger.info(JSON.stringify(databaseResp, undefined, 2)); - } else { - logger.info(clc.bold(`Successfully created ${printer.prettyDatabaseString(databaseResp)}`)); - logger.info( - "Please be sure to configure Firebase rules in your Firebase config file for\n" + - "the new database. By default, created databases will have closed rules that\n" + - "block any incoming third-party traffic.", - ); - logger.info( - `Your database may be viewed at ${printer.firebaseConsoleDatabaseUrl(options.project, database)}`, - ); - } + logger.info(clc.bold(`Successfully created ${printer.prettyDatabaseString(databaseResp)}`)); + logger.info( + "Please be sure to configure Firebase rules in your Firebase config file for\n" + + "the new database. By default, created databases will have closed rules that\n" + + "block any incoming third-party traffic.", + ); + logger.info( + `Your database may be viewed at ${printer.firebaseConsoleDatabaseUrl(options.project, database)}`, + ); return databaseResp; }); diff --git a/src/commands/firestore-databases-delete.ts b/src/commands/firestore-databases-delete.ts index 5ae410279be..72d4dd4f6a5 100644 --- a/src/commands/firestore-databases-delete.ts +++ b/src/commands/firestore-databases-delete.ts @@ -31,11 +31,7 @@ export const command = new Command("firestore:databases:delete ") const databaseResp: types.DatabaseResp = await api.deleteDatabase(options.project, database); - if (options.json) { - logger.info(JSON.stringify(databaseResp, undefined, 2)); - } else { - logger.info(clc.bold(`Successfully deleted ${printer.prettyDatabaseString(databaseResp)}`)); - } + logger.info(clc.bold(`Successfully deleted ${printer.prettyDatabaseString(databaseResp)}`)); return databaseResp; }); diff --git a/src/commands/firestore-databases-get.ts b/src/commands/firestore-databases-get.ts index afe2ed0e9bb..e46e2661570 100644 --- a/src/commands/firestore-databases-get.ts +++ b/src/commands/firestore-databases-get.ts @@ -1,7 +1,6 @@ import { Command } from "../command"; import * as fsi from "../firestore/api"; import * as types from "../firestore/api-types"; -import { logger } from "../logger"; import { requirePermissions } from "../requirePermissions"; import { Emulators } from "../emulator/types"; import { warnEmulatorNotSupported } from "../emulator/commandUtils"; @@ -19,11 +18,7 @@ export const command = new Command("firestore:databases:get [database]") const databaseId = database || "(default)"; const databaseResp: types.DatabaseResp = await api.getDatabase(options.project, databaseId); - if (options.json) { - logger.info(JSON.stringify(databaseResp, undefined, 2)); - } else { - printer.prettyPrintDatabase(databaseResp); - } + printer.prettyPrintDatabase(databaseResp); return databaseResp; }); diff --git a/src/commands/firestore-databases-list.ts b/src/commands/firestore-databases-list.ts index 07c50d4180f..d1f1f199634 100644 --- a/src/commands/firestore-databases-list.ts +++ b/src/commands/firestore-databases-list.ts @@ -1,7 +1,6 @@ import { Command } from "../command"; import * as fsi from "../firestore/api"; import * as types from "../firestore/api-types"; -import { logger } from "../logger"; import { requirePermissions } from "../requirePermissions"; import { Emulators } from "../emulator/types"; import { warnEmulatorNotSupported } from "../emulator/commandUtils"; @@ -18,11 +17,7 @@ export const command = new Command("firestore:databases:list") const databases: types.DatabaseResp[] = await api.listDatabases(options.project); - if (options.json) { - logger.info(JSON.stringify(databases, undefined, 2)); - } else { - printer.prettyPrintDatabases(databases); - } + printer.prettyPrintDatabases(databases); return databases; }); diff --git a/src/commands/firestore-databases-restore.ts b/src/commands/firestore-databases-restore.ts index 6cd278248e8..efcb87fa2cb 100644 --- a/src/commands/firestore-databases-restore.ts +++ b/src/commands/firestore-databases-restore.ts @@ -72,21 +72,17 @@ export const command = new Command("firestore:databases:restore") encryptionConfig, ); - if (options.json) { - logger.info(JSON.stringify(databaseResp, undefined, 2)); - } else { - logger.info( - clc.bold(`Successfully initiated restore of ${printer.prettyDatabaseString(databaseResp)}`), - ); - logger.info( - "Please be sure to configure Firebase rules in your Firebase config file for\n" + - "the new database. By default, created databases will have closed rules that\n" + - "block any incoming third-party traffic.", - ); - logger.info( - `Once the restore is complete, your database may be viewed at ${printer.firebaseConsoleDatabaseUrl(options.project, databaseId)}`, - ); - } + logger.info( + clc.bold(`Successfully initiated restore of ${printer.prettyDatabaseString(databaseResp)}`), + ); + logger.info( + "Please be sure to configure Firebase rules in your Firebase config file for\n" + + "the new database. By default, created databases will have closed rules that\n" + + "block any incoming third-party traffic.", + ); + logger.info( + `Once the restore is complete, your database may be viewed at ${printer.firebaseConsoleDatabaseUrl(options.project, databaseId)}`, + ); return databaseResp; diff --git a/src/commands/firestore-databases-update.ts b/src/commands/firestore-databases-update.ts index 88ca73c1063..609ba4719df 100644 --- a/src/commands/firestore-databases-update.ts +++ b/src/commands/firestore-databases-update.ts @@ -71,11 +71,7 @@ export const command = new Command("firestore:databases:update ") pointInTimeRecoveryEnablement, ); - if (options.json) { - logger.info(JSON.stringify(databaseResp, undefined, 2)); - } else { - logger.info(clc.bold(`Successfully updated ${printer.prettyDatabaseString(databaseResp)}`)); - } + logger.info(clc.bold(`Successfully updated ${printer.prettyDatabaseString(databaseResp)}`)); return databaseResp; }); diff --git a/src/commands/firestore-locations.ts b/src/commands/firestore-locations.ts index 4cfffcb2a1d..1fc617e7dc0 100644 --- a/src/commands/firestore-locations.ts +++ b/src/commands/firestore-locations.ts @@ -1,7 +1,6 @@ import { Command } from "../command"; import * as fsi from "../firestore/api"; import * as types from "../firestore/api-types"; -import { logger } from "../logger"; import { requirePermissions } from "../requirePermissions"; import { Emulators } from "../emulator/types"; import { warnEmulatorNotSupported } from "../emulator/commandUtils"; @@ -18,11 +17,7 @@ export const command = new Command("firestore:locations") const locations: types.Location[] = await api.locations(options.project); - if (options.json) { - logger.info(JSON.stringify(locations, undefined, 2)); - } else { - printer.prettyPrintLocations(locations); - } + printer.prettyPrintLocations(locations); return locations; }); diff --git a/src/commands/firestore-operations-cancel.spec.ts b/src/commands/firestore-operations-cancel.spec.ts index 89dabc2bfe1..18f015c0318 100644 --- a/src/commands/firestore-operations-cancel.spec.ts +++ b/src/commands/firestore-operations-cancel.spec.ts @@ -4,7 +4,6 @@ import { command } from "./firestore-operations-cancel"; import * as fsi from "../firestore/api"; import * as prompt from "../prompt"; import * as utils from "../utils"; -import { logger } from "../logger"; describe("firestore:operations:cancel", () => { const sandbox = sinon.createSandbox(); @@ -12,7 +11,6 @@ describe("firestore:operations:cancel", () => { let confirmStub: sinon.SinonStub; let logSuccessStub: sinon.SinonStub; let logWarningStub: sinon.SinonStub; - let loggerInfoStub: sinon.SinonStub; beforeEach(() => { firestoreApiStub = sandbox.createStubInstance(fsi.FirestoreApi); @@ -20,7 +18,6 @@ describe("firestore:operations:cancel", () => { confirmStub = sandbox.stub(prompt, "confirm"); logSuccessStub = sandbox.stub(utils, "logSuccess"); logWarningStub = sandbox.stub(utils, "logWarning"); - loggerInfoStub = sandbox.stub(logger, "info"); }); afterEach(() => { @@ -87,10 +84,8 @@ describe("firestore:operations:cancel", () => { const status = { success: true }; firestoreApiStub.cancelOperation.resolves(status); - await command.runner()(operationName, options); + const jsonResult = await command.runner()(operationName, options); - expect(loggerInfoStub).to.be.calledOnceWith(JSON.stringify(status, undefined, 2)); - expect(logSuccessStub).to.not.be.called; - expect(logWarningStub).to.not.be.called; + expect(jsonResult).to.eql(status); }); }); diff --git a/src/commands/firestore-operations-cancel.ts b/src/commands/firestore-operations-cancel.ts index 5fb158d6b1c..02d2a2c36f6 100644 --- a/src/commands/firestore-operations-cancel.ts +++ b/src/commands/firestore-operations-cancel.ts @@ -7,7 +7,6 @@ import { getShortOperationName } from "./firestore-utils"; import { confirm } from "../prompt"; import * as clc from "colorette"; import * as utils from "../utils"; -import { logger } from "../logger"; export const command = new Command("firestore:operations:cancel ") .description("cancels a long-running Cloud Firestore admin operation") @@ -34,14 +33,10 @@ export const command = new Command("firestore:operations:cancel " const api = new fsi.FirestoreApi(); const status = await api.cancelOperation(options.project, databaseId, operationName); - if (options.json) { - logger.info(JSON.stringify(status, undefined, 2)); + if (status.success) { + utils.logSuccess("Operation cancelled successfully."); } else { - if (status.success) { - utils.logSuccess("Operation cancelled successfully."); - } else { - utils.logWarning("Canceling the operation failed."); - } + utils.logWarning("Canceling the operation failed."); } return status; diff --git a/src/commands/firestore-operations-describe.spec.ts b/src/commands/firestore-operations-describe.spec.ts index bcb371b596c..23af2174079 100644 --- a/src/commands/firestore-operations-describe.spec.ts +++ b/src/commands/firestore-operations-describe.spec.ts @@ -57,10 +57,9 @@ describe("firestore:operations:describe", () => { const operation = { name: "op1", done: false, metadata: {} }; firestoreApiStub.describeOperation.resolves(operation); - await command.runner()(operationName, options); + const jsonResult = await command.runner()(operationName, options); - expect(loggerInfoStub).to.be.calledOnceWith(JSON.stringify(operation, undefined, 2)); - expect(prettyPrintStub).to.not.be.called; + expect(jsonResult).to.eql(operation); }); it("should pretty-print the operation when --json is not specified", async () => { diff --git a/src/commands/firestore-operations-describe.ts b/src/commands/firestore-operations-describe.ts index db411831af5..7c13d9e26ac 100644 --- a/src/commands/firestore-operations-describe.ts +++ b/src/commands/firestore-operations-describe.ts @@ -1,6 +1,5 @@ import { Command } from "../command"; import * as fsi from "../firestore/api"; -import { logger } from "../logger"; import { Emulators } from "../emulator/types"; import { errorMissingProject, warnEmulatorNotSupported } from "../emulator/commandUtils"; import { FirestoreOptions } from "../firestore/options"; @@ -21,12 +20,8 @@ export const command = new Command("firestore:operations:describe { ]; firestoreApiStub.listOperations.resolves({ operations }); - await command.runner()(options); - - expect(loggerInfoStub).to.be.calledOnceWith(JSON.stringify(operations, undefined, 2)); - expect(prettyPrintStub).to.not.be.called; + const jsonResult = await command.runner()(options); + expect(jsonResult).to.eql(operations); }); it("should pretty-print operations when --json is not specified", async () => { diff --git a/src/commands/firestore-operations-list.ts b/src/commands/firestore-operations-list.ts index dc549de8fc7..d87e03fc4ee 100644 --- a/src/commands/firestore-operations-list.ts +++ b/src/commands/firestore-operations-list.ts @@ -1,6 +1,5 @@ import { Command } from "../command"; import * as fsi from "../firestore/api"; -import { logger } from "../logger"; import { Emulators } from "../emulator/types"; import { errorMissingProject, warnEmulatorNotSupported } from "../emulator/commandUtils"; import { FirestoreOptions } from "../firestore/options"; @@ -22,12 +21,8 @@ export const command = new Command("firestore:operations:list") const api = new fsi.FirestoreApi(); const { operations } = await api.listOperations(options.project, databaseId, limit); - if (options.json) { - logger.info(JSON.stringify(operations, undefined, 2)); - } else { - const printer = new PrettyPrint(); - printer.prettyPrintOperations(operations); - } + const printer = new PrettyPrint(); + printer.prettyPrintOperations(operations); return operations; }); diff --git a/src/deploy/apphosting/deploy.spec.ts b/src/deploy/apphosting/deploy.spec.ts index d7fb63545b6..b5300bcbe87 100644 --- a/src/deploy/apphosting/deploy.spec.ts +++ b/src/deploy/apphosting/deploy.spec.ts @@ -19,7 +19,6 @@ const BASE_OPTS = { debug: false, filteredTargets: [], rc: new RC(), - json: false, }; function initializeContext(): Context { diff --git a/src/deploy/apphosting/prepare.spec.ts b/src/deploy/apphosting/prepare.spec.ts index b3737a447e5..b4dc21d99d2 100644 --- a/src/deploy/apphosting/prepare.spec.ts +++ b/src/deploy/apphosting/prepare.spec.ts @@ -21,7 +21,6 @@ const BASE_OPTS = { debug: false, filteredTargets: [], rc: new RC(), - json: false, }; function initializeContext(): Context { diff --git a/src/deploy/apphosting/release.spec.ts b/src/deploy/apphosting/release.spec.ts index 0695f99fd2c..ea8433e89b2 100644 --- a/src/deploy/apphosting/release.spec.ts +++ b/src/deploy/apphosting/release.spec.ts @@ -16,7 +16,6 @@ const BASE_OPTS = { debug: false, filteredTargets: [], rc: new RC(), - json: false, }; describe("apphosting", () => { diff --git a/src/deploy/functions/prompts.spec.ts b/src/deploy/functions/prompts.spec.ts index 61fb3681bbd..a418e7184fa 100644 --- a/src/deploy/functions/prompts.spec.ts +++ b/src/deploy/functions/prompts.spec.ts @@ -35,7 +35,6 @@ const SAMPLE_OPTIONS: Options = { only: "functions", except: "", nonInteractive: false, - json: false, interactive: false, debug: false, force: false, diff --git a/src/deploy/hosting/prepare.spec.ts b/src/deploy/hosting/prepare.spec.ts index e1579990594..d1767dc2176 100644 --- a/src/deploy/hosting/prepare.spec.ts +++ b/src/deploy/hosting/prepare.spec.ts @@ -62,7 +62,6 @@ describe("hosting prepare", () => { except: "", filteredTargets: ["HOSTING"], force: false, - json: false, nonInteractive: false, interactive: true, debug: false, diff --git a/src/emulator/extensions/validation.spec.ts b/src/emulator/extensions/validation.spec.ts index 5e4a95c9a0c..5db83d17eb0 100644 --- a/src/emulator/extensions/validation.spec.ts +++ b/src/emulator/extensions/validation.spec.ts @@ -21,7 +21,6 @@ const TEST_OPTIONS: Options = { filteredTargets: [""], nonInteractive: true, interactive: false, - json: false, debug: false, rc: new RC(), config: new Config("."), diff --git a/src/emulator/storage/rules/config.spec.ts b/src/emulator/storage/rules/config.spec.ts index dc57cfd431f..b0dca1693df 100644 --- a/src/emulator/storage/rules/config.spec.ts +++ b/src/emulator/storage/rules/config.spec.ts @@ -127,7 +127,6 @@ function getOptions(config: any): Options { only: "", except: "", nonInteractive: false, - json: false, interactive: false, debug: false, force: false, diff --git a/src/filterTargets.spec.ts b/src/filterTargets.spec.ts index 43e1316977d..6c81742143c 100644 --- a/src/filterTargets.spec.ts +++ b/src/filterTargets.spec.ts @@ -11,7 +11,6 @@ const SAMPLE_OPTIONS: Options = { only: "", except: "", nonInteractive: false, - json: false, interactive: false, debug: false, force: false, diff --git a/src/gcp/cloudsql/cloudsqladmin.spec.ts b/src/gcp/cloudsql/cloudsqladmin.spec.ts index 03ecd10be99..b559b055697 100644 --- a/src/gcp/cloudsql/cloudsqladmin.spec.ts +++ b/src/gcp/cloudsql/cloudsqladmin.spec.ts @@ -26,7 +26,6 @@ const options: Options = { config: new Config({}, { projectDir: "", cwd: "" }), filteredTargets: [], force: false, - json: false, nonInteractive: false, interactive: false, debug: false, diff --git a/src/init/features/dataconnect/index.ts b/src/init/features/dataconnect/index.ts index 66ab9543271..20d072e99cc 100644 --- a/src/init/features/dataconnect/index.ts +++ b/src/init/features/dataconnect/index.ts @@ -118,12 +118,22 @@ export async function askQuestions(setup: Setup): Promise { "Learn more about Gemini in Firebase and how it uses your data: https://firebase.google.com/docs/gemini-in-firebase#how-gemini-in-firebase-uses-your-data", ); } - info.appDescription = await input({ - message: `Describe your app to automatically generate a schema with Gemini [Enter to use a template]:`, + const wantToGenerate = await confirm({ + message: "Do you want to generate schema and queries with Gemini?", + default: false, }); - if (info.appDescription) { + if (wantToGenerate) { configstore.set("gemini", true); await ensureGIFApiTos(setup.projectId); + info.appDescription = await input({ + message: `Describe your app idea:`, + validate: async (s: string) => { + if (s.length > 0) { + return true; + } + return "Please enter a description for your app idea."; + }, + }); } } if (hasBilling) { @@ -161,9 +171,14 @@ export async function actuate(setup: Setup, config: Config, options: any): Promi await sdk.actuate(setup, config); } finally { void trackGA4("dataconnect_init", { - project_status: setup.projectId ? (setup.isBillingEnabled ? "blaze" : "spark") : "missing", flow: info.analyticsFlow, - provision_cloud_sql: String(info.shouldProvisionCSQL), + project_status: setup.projectId + ? setup.isBillingEnabled + ? info.shouldProvisionCSQL + ? "blaze_provisioned_csql" + : "blaze" + : "spark" + : "missing", }); } @@ -646,7 +661,7 @@ async function promptForLocation(setup: Setup, info: RequiredInfo): Promise({ - message: "What location should the new Cloud SQL instance be in?", + message: "What location would you like to use?", choices, default: FDC_DEFAULT_REGION, }); diff --git a/src/init/features/functions.spec.ts b/src/init/features/functions.spec.ts index d1650ebd87e..cbe16f2afd9 100644 --- a/src/init/features/functions.spec.ts +++ b/src/init/features/functions.spec.ts @@ -53,7 +53,6 @@ describe("functions", () => { except: "", filteredTargets: [], force: false, - json: false, nonInteractive: false, interactive: false, debug: false, diff --git a/src/init/features/genkit/index.spec.ts b/src/init/features/genkit/index.spec.ts index a7617a3ccdc..00bb7266e50 100644 --- a/src/init/features/genkit/index.spec.ts +++ b/src/init/features/genkit/index.spec.ts @@ -42,7 +42,6 @@ describe("genkit", () => { except: "", filteredTargets: [], force: false, - json: false, nonInteractive: false, interactive: false, debug: false, diff --git a/src/management/studio.spec.ts b/src/management/studio.spec.ts index f6179847e3e..3f105f1c249 100644 --- a/src/management/studio.spec.ts +++ b/src/management/studio.spec.ts @@ -35,7 +35,6 @@ describe("Studio Management", () => { except: "", filteredTargets: [], force: false, - json: false, nonInteractive: false, interactive: false, debug: false, diff --git a/src/options.ts b/src/options.ts index 7374ef1b688..18af6a67549 100644 --- a/src/options.ts +++ b/src/options.ts @@ -19,7 +19,6 @@ export interface BaseOptions { projectNumber?: string; projectRoot?: string; account?: string; - json: boolean; nonInteractive: boolean; interactive: boolean; debug: boolean; @@ -30,6 +29,20 @@ export interface BaseOptions { import?: string; isMCP?: boolean; + + /** + * Do not use this field when handling --json. It is never set in commands. + * + * Instead, return an object to be JSONified from the command action callback: + * + * ```typescript + * .action(async (options: Options) => { + * logger.info('Normal output'); // Automatically suppressed with --json. + * return objectToBePrintedWhenTheJsonFlagIsPassed; + * }); + * ``` + */ + json?: undefined; } export interface Options extends BaseOptions { diff --git a/src/requireConfig.spec.ts b/src/requireConfig.spec.ts index cbdfe4dd08c..023b9aeb9a5 100644 --- a/src/requireConfig.spec.ts +++ b/src/requireConfig.spec.ts @@ -14,7 +14,6 @@ const options: Options = { config: new Config({}), filteredTargets: [], force: false, - json: false, nonInteractive: false, interactive: false, debug: false, diff --git a/src/requireTosAcceptance.spec.ts b/src/requireTosAcceptance.spec.ts index 0e5c3d333d9..416c0807906 100644 --- a/src/requireTosAcceptance.spec.ts +++ b/src/requireTosAcceptance.spec.ts @@ -15,7 +15,6 @@ const SAMPLE_OPTIONS: Options = { only: "", except: "", nonInteractive: false, - json: false, interactive: false, debug: false, force: false, diff --git a/tsconfig.compile.json b/tsconfig.compile.json index caedf05e4af..ae163696ed2 100644 --- a/tsconfig.compile.json +++ b/tsconfig.compile.json @@ -2,11 +2,6 @@ "extends": "./tsconfig.json", "compilerOptions": { "noEmit": true, // Don't actually produce any compiled output. - "checkJs": true, // We want to do a pass on JS files. "resolveJsonModule": true, // Makes require(package.json) acceptable (added). - "strict": false, // Need to relax some strictness to check JS (changed). - "strictBindCallApply": true, // This is part of "strict: true" (added). - "strictFunctionTypes": true, // This is part of "strict: true" (added). - "noImplicitThis": true, // This is part of "strict: true" (added). } }