From 0b2430f66b1d81d060c2ad9a97ff2563a44d8c41 Mon Sep 17 00:00:00 2001 From: Wanda Mora Date: Thu, 20 Aug 2026 21:20:10 +0000 Subject: [PATCH 1/2] refactor(functions): rename "npm_package" to "package" for kits:install --- src/commands/functions-kits-install.spec.ts | 58 ++++++++++----------- src/commands/functions-kits-install.ts | 8 +-- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/commands/functions-kits-install.spec.ts b/src/commands/functions-kits-install.spec.ts index e970237b43b..cb776aed5e3 100644 --- a/src/commands/functions-kits-install.spec.ts +++ b/src/commands/functions-kits-install.spec.ts @@ -584,7 +584,7 @@ describe("functions:kits:install", () => { await expect( command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export", + package: "@firebase-functions-kits/firestore-bigquery-export", cwd: "/mock/project", nonInteractive: true, }), @@ -596,14 +596,14 @@ describe("functions:kits:install", () => { it("should throw an error if not in a Firebase project directory", async () => { await expect( command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export", + package: "@firebase-functions-kits/firestore-bigquery-export", cwd: "/mock/project", nonInteractive: true, }), ).to.be.rejectedWith(FirebaseError, /firebase.json not found/); }); - it("should throw an error if --npm_package is not provided", async () => { + it("should throw an error if --package is not provided", async () => { const mockConfig = { projectDir: "/mock/project", src: { @@ -620,11 +620,11 @@ describe("functions:kits:install", () => { }), ).to.be.rejectedWith( FirebaseError, - /set the --npm_package option to a valid NPM package and try again\./, + /set the --package option to a valid NPM package and try again\./, ); }); - it("should throw an error if --npm_package has an invalid package name", async () => { + it("should throw an error if --package has an invalid package name", async () => { const mockConfig = { projectDir: "/mock/project", src: { @@ -635,7 +635,7 @@ describe("functions:kits:install", () => { await expect( command.runner()({ - npm_package: "@scope/pkg/extra@1.0.0", + package: "@scope/pkg/extra@1.0.0", cwd: "/mock/project", config: mockConfig, nonInteractive: true, @@ -654,7 +654,7 @@ describe("functions:kits:install", () => { await expect( command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export", + package: "@firebase-functions-kits/firestore-bigquery-export", template: "invalid-template", cwd: "/mock/project", config: mockConfig, @@ -685,7 +685,7 @@ describe("functions:kits:install", () => { } as unknown as Config; await command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export@1.0.0", + package: "@firebase-functions-kits/firestore-bigquery-export@1.0.0", template: "migration", cwd: "/mock/project", config: mockConfig, @@ -722,7 +722,7 @@ describe("functions:kits:install", () => { } as unknown as Config; await command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export@1.0.0", + package: "@firebase-functions-kits/firestore-bigquery-export@1.0.0", template: "installation", cwd: "/mock/project", config: mockConfig, @@ -759,7 +759,7 @@ describe("functions:kits:install", () => { } as unknown as Config; await command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export@1.0.0", + package: "@firebase-functions-kits/firestore-bigquery-export@1.0.0", cwd: "/mock/project", config: mockConfig, nonInteractive: true, @@ -839,7 +839,7 @@ describe("functions:kits:install", () => { .resolves("my-instance"); await command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export@1.0.0", + package: "@firebase-functions-kits/firestore-bigquery-export@1.0.0", cwd: "/mock/project", config: mockConfig, }); @@ -880,7 +880,7 @@ describe("functions:kits:install", () => { } as unknown as Config; await command.runner()({ - npm_package: "@third-party/custom-kit", + package: "@third-party/custom-kit", cwd: "/mock/project", config: mockConfig, nonInteractive: true, @@ -922,7 +922,7 @@ describe("functions:kits:install", () => { await expect( command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export", + package: "@firebase-functions-kits/firestore-bigquery-export", cwd: "/mock/project", config: mockConfig, }), @@ -955,7 +955,7 @@ describe("functions:kits:install", () => { } as unknown as Config; await command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export@1.0.0", + package: "@firebase-functions-kits/firestore-bigquery-export@1.0.0", cwd: "/mock/project", config: mockConfig, nonInteractive: true, @@ -994,7 +994,7 @@ describe("functions:kits:install", () => { await expect( command.runner()({ - npm_package: "@firebase-functions-kits/my-kit", + package: "@firebase-functions-kits/my-kit", cwd: "/mock/project", config: mockConfig, }), @@ -1029,7 +1029,7 @@ describe("functions:kits:install", () => { await expect( command.runner()({ - npm_package: "@firebase-functions-kits/my-kit", + package: "@firebase-functions-kits/my-kit", cwd: "/mock/project", config: mockConfig, }), @@ -1052,7 +1052,7 @@ describe("functions:kits:install", () => { } as unknown as Config; await command.runner()({ - npm_package: "@firebase-functions-kits/my-kit", + package: "@firebase-functions-kits/my-kit", cwd: "/mock/project", config: mockConfig, nonInteractive: true, @@ -1083,7 +1083,7 @@ describe("functions:kits:install", () => { } as unknown as Config; await command.runner()({ - npm_package: "@third-party/custom-kit", + package: "@third-party/custom-kit", cwd: "/mock/project", config: mockConfig, nonInteractive: true, @@ -1113,7 +1113,7 @@ describe("functions:kits:install", () => { } as unknown as Config; await command.runner()({ - npm_package: "@third-party/custom-kit", + package: "@third-party/custom-kit", cwd: "/mock/project", config: mockConfig, nonInteractive: true, @@ -1148,7 +1148,7 @@ describe("functions:kits:install", () => { await expect( command.runner()({ - npm_package: "@firebase-functions-kits/my-kit", + package: "@firebase-functions-kits/my-kit", cwd: "/mock/project", config: mockConfig, nonInteractive: true, @@ -1169,7 +1169,7 @@ describe("functions:kits:install", () => { await expect( command.runner()({ - npm_package: "@third-party/custom-kit", + package: "@third-party/custom-kit", cwd: "/mock/project", config: mockConfig, nonInteractive: true, @@ -1190,7 +1190,7 @@ describe("functions:kits:install", () => { await expect( command.runner()({ - npm_package: "@third-party/custom-kit", + package: "@third-party/custom-kit", cwd: "/mock/project", config: mockConfig, nonInteractive: true, @@ -1230,7 +1230,7 @@ describe("functions:kits:install", () => { } as unknown as Config; await command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export", + package: "@firebase-functions-kits/firestore-bigquery-export", cwd: "/mock/project", config: mockConfig, nonInteractive: true, @@ -1292,7 +1292,7 @@ describe("functions:kits:install", () => { sinon.stub(prompt, "input").resolves("custom-instance-2"); await command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export", + package: "@firebase-functions-kits/firestore-bigquery-export", cwd: "/mock/project", config: mockConfig, project: "my-target-proj", @@ -1356,7 +1356,7 @@ describe("functions:kits:install", () => { sinon.stub(prompt, "input").resolves("inst-2"); await command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export", + package: "@firebase-functions-kits/firestore-bigquery-export", cwd: "/mock/project", config: mockConfig, project: "my-target-proj", @@ -1419,7 +1419,7 @@ describe("functions:kits:install", () => { await expect( command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export", + package: "@firebase-functions-kits/firestore-bigquery-export", cwd: "/mock/project", config: mockConfig, }), @@ -1454,7 +1454,7 @@ describe("functions:kits:install", () => { sinon.stub(prompt, "select").resolves("addEnv"); await command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export", + package: "@firebase-functions-kits/firestore-bigquery-export", cwd: "/mock/project", config: mockConfig, project: "my-staging-project", @@ -1492,7 +1492,7 @@ describe("functions:kits:install", () => { sinon.stub(prompt, "select").resolves("addEnv"); await command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export", + package: "@firebase-functions-kits/firestore-bigquery-export", cwd: "/mock/project", config: mockConfig, }); @@ -1531,7 +1531,7 @@ describe("functions:kits:install", () => { selectStub.onSecondCall().resolves("inst-2"); await command.runner()({ - npm_package: "@firebase-functions-kits/firestore-bigquery-export", + package: "@firebase-functions-kits/firestore-bigquery-export", cwd: "/mock/project", config: mockConfig, project: "prod-project", diff --git a/src/commands/functions-kits-install.ts b/src/commands/functions-kits-install.ts index 52d26decf3e..0a1625d31be 100644 --- a/src/commands/functions-kits-install.ts +++ b/src/commands/functions-kits-install.ts @@ -53,7 +53,7 @@ export const DEFAULT_TEMPLATE: TemplateType = "installation"; export const FUNCTION_KITS_DIR = "function-kits"; export interface FunctionsKitsInstallOptions extends Options { - npm_package?: string; + package?: string; template?: string; } @@ -678,7 +678,7 @@ export async function printKitFirstDeployReport( export const command = new Command("functions:kits:install") .description("install a function kit into your project") - .option("--npm_package ", "NPM package name or specifier to install as a function kit") + .option("--package ", "NPM package name or specifier to install as a function kit") .option( `--template [${Object.keys(TEMPLATES).join("|")}]`, "template to use for the kit index file", @@ -701,9 +701,9 @@ export const command = new Command("functions:kits:install") ); } - const rawPkgName = options.npm_package; + const rawPkgName = options.package; if (!rawPkgName) { - throw new FirebaseError("set the --npm_package option to a valid NPM package and try again."); + throw new FirebaseError("set the --package option to a valid NPM package and try again."); } const { packageName, version } = parseNpmPackageSpecifier(rawPkgName); From f5ca12e0827da01766f9cd59f97038d21a6e5981 Mon Sep 17 00:00:00 2001 From: Wanda Mora Date: Thu, 20 Aug 2026 22:28:29 +0000 Subject: [PATCH 2/2] nit: capitalize error string for malformed package --- src/commands/functions-kits-install.spec.ts | 2 +- src/commands/functions-kits-install.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/functions-kits-install.spec.ts b/src/commands/functions-kits-install.spec.ts index cb776aed5e3..4ae35c7c1fe 100644 --- a/src/commands/functions-kits-install.spec.ts +++ b/src/commands/functions-kits-install.spec.ts @@ -620,7 +620,7 @@ describe("functions:kits:install", () => { }), ).to.be.rejectedWith( FirebaseError, - /set the --package option to a valid NPM package and try again\./, + /Set the --package option to a valid NPM package and try again\./, ); }); diff --git a/src/commands/functions-kits-install.ts b/src/commands/functions-kits-install.ts index 0a1625d31be..c550b61d83f 100644 --- a/src/commands/functions-kits-install.ts +++ b/src/commands/functions-kits-install.ts @@ -703,7 +703,7 @@ export const command = new Command("functions:kits:install") const rawPkgName = options.package; if (!rawPkgName) { - throw new FirebaseError("set the --package option to a valid NPM package and try again."); + throw new FirebaseError("Set the --package option to a valid NPM package and try again."); } const { packageName, version } = parseNpmPackageSpecifier(rawPkgName);