Skip to content

fix(extensions): revert ext:export option name change and fix bugs - #10982

Merged
ajperel merged 1 commit into
mainfrom
ajp/fix-export-to-kit
Aug 25, 2026
Merged

fix(extensions): revert ext:export option name change and fix bugs#10982
ajperel merged 1 commit into
mainfrom
ajp/fix-export-to-kit

Conversation

@ajperel

@ajperel ajperel commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Description

This commit addresses issues in the ext:export command options and fixes a path resolution bug:

  1. Reverts the --extension-instance option back to --instance (and removes the -e short flag).
  2. Fixes a bug in option registration where extension-instance and kit-instance options were defined incorrectly as separate arguments to .option(), causing Commander to treat them as boolean flags and throw "Too many arguments" errors.
  3. Fixes a typo in the kit instance option name from ---kit-instance to --kit-instance.
  4. Simplifies the export mode check by removing the undocumented and unused kits mode.
  5. Renames loop variables in kitExportTarget to kitInstanceId and configDirPath for better readability and to avoid shadowing.
  6. Fixes a path resolution bug in fnHandler where joining projectDir and already-absolute configDir caused mkdirSync to fail. Ensured kitExportTarget always returns absolute paths and used path.resolve for directory creation.

Scenarios Tested

  • Built the project successfully (npm run build).
  • Verified --help output shows options correctly formatted and documented.
  • Verified running ext:export with --mode functions --instance <id> parses correctly and does not throw "Too many arguments" errors.
  • Verified running with multiple -k options (e.g. -k id -k id) parses correctly.
  • Ran unit tests using npm run tests.
  • Verified exporting extension config locally writes to the correct directory without unexpected path resolution errors.

Sample Commands

  • firebase ext:export --mode functions --instance firestore-bigquery-export
  • firebase ext:export --mode functions --instance firestore-bigquery-export --kit-instance firestore-bigquery-export

TAG=agy
CONV=4603ef45-7e00-4639-b91a-2e65853ba34d

Description

Scenarios Tested

Sample Commands

@wiz-9635d3485b

wiz-9635d3485b Bot commented Aug 25, 2026

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings 9 Medium
Software Management Finding Software Management Findings -
Total 9 Medium

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request reverts the --extension-instance option back to --instance in the ext:export command, removes the unused kits mode, and fixes path resolution bugs by using resolve instead of join. The review feedback suggests throwing a FirebaseError if a specified --kit-instance is not found in firebase.json to prevent silent fallbacks, and simplifying the directory creation logic by directly using the already-resolved writeLocation.configDir path.

Comment thread src/commands/ext-export.ts
Comment thread src/commands/ext-export.ts
@Berlioz Berlioz self-assigned this Aug 25, 2026
@ajperel
ajperel force-pushed the ajp/fix-export-to-kit branch from de364d8 to 53407b6 Compare August 25, 2026 02:22
@ajperel
ajperel enabled auto-merge (squash) August 25, 2026 02:23
… bugs

### Description
This commit addresses issues in the `ext:export` command options and fixes a path resolution bug:
1. Reverts the `--extension-instance` option back to `--instance` (and removes the `-e` short flag).
2. Fixes a bug in option registration where `extension-instance` and `kit-instance` options were defined incorrectly as separate arguments to `.option()`, causing Commander to treat them as boolean flags and throw "Too many arguments" errors.
3. Fixes a typo in the kit instance option name from `---kit-instance` to `--kit-instance`.
4. Simplifies the export mode check by removing the undocumented and unused `kits` mode.
5. Renames loop variables in `kitExportTarget` to `kitInstanceId` and `configDirPath` for better readability and to avoid shadowing.
6. Fixes a path resolution bug in `fnHandler` where joining `projectDir` and already-absolute `configDir` caused `mkdirSync` to fail. Ensured `kitExportTarget` always returns absolute paths and used `path.resolve` for directory creation.
7. Throws a `FirebaseError` if a specified `--kit-instance` is not found in `firebase.json` instead of silently falling through.
8. Removes redundant `console.log` dump of exported environment variables from `fnHandler`.

### Scenarios Tested
- Built the project successfully (`npm run build`).
- Verified `--help` output shows options correctly formatted and documented.
- Verified running `ext:export` with `--mode functions --instance <id>` parses correctly and does not throw "Too many arguments" errors.
- Verified running with multiple `-k` options (e.g. `-k id -k id`) parses correctly.
- Ran unit tests using `npm run tests`.
- Verified exporting extension config locally writes to the correct directory without unexpected path resolution errors.
- Verified running `ext:export` with non-existent `--kit-instance` throws a clear error.
- Verified exporting extension config does not print env variables dump to console.

### Sample Commands
* `firebase ext:export --mode functions --instance firestore-bigquery-export`
* `firebase ext:export --mode functions --instance firestore-bigquery-export --kit-instance firestore-bigquery-export`

TAG=agy
CONV=4603ef45-7e00-4639-b91a-2e65853ba34d
@ajperel
ajperel force-pushed the ajp/fix-export-to-kit branch from 53407b6 to 16e2d47 Compare August 25, 2026 17:57
@ajperel
ajperel merged commit 5c167cb into main Aug 25, 2026
50 of 53 checks passed
@ajperel
ajperel deleted the ajp/fix-export-to-kit branch August 25, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants