Remove detailed export format and pretty-printing; output single compact importable JSON#54
Remove detailed export format and pretty-printing; output single compact importable JSON#54
Conversation
…ct importable export Co-authored-by: omer-ayhan <32736625+omer-ayhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Simplifies Firestore/RTDB export behavior by removing the “detailed” format and pretty-printed JSON, standardizing exports to a single compact, importable JSON file with a stable filename.
Changes:
- Removed
detailed/importableexport options and corresponding CLI flags. - Updated export actions to write a single compact JSON file (
firestore_export.json,rtdb_export.json) and adjusted summaries/logging. - Updated documentation and lockfiles to reflect the new export workflow and dependency state.
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Updates locked esbuild platform artifact entry. |
| src/commands/rtdb/rtdb-export.ts | Removes format flags and updates help examples. |
| src/commands/firestore/firestore-export.ts | Removes format flags from command options. |
| src/actions/rtdb/rtdb-export.ts | Drops multi-format exports; writes single compact rtdb_export.json. |
| src/actions/firestore/firestore-export.ts | Drops multi-format exports; writes single compact firestore_export.json. |
| npm-shrinkwrap.json | Updates shrinkwrap metadata and expands esbuild optional platform packages. |
| README.md | Updates export/import docs and filenames to underscore-based exports. |
Files not reviewed (1)
- npm-shrinkwrap.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Handle subcollections if enabled | ||
| if (!options.noSubcollections) { | ||
| const subcollections = await doc.ref.listCollections(); |
There was a problem hiding this comment.
--no-subcollections from Commander sets options.subcollections (default true), but this code checks options.noSubcollections. As a result, passing --no-subcollections will not disable subcollection traversal. Align the option name and type with Commander’s behavior (e.g., use subcollections?: boolean and check options.subcollections === false).
There was a problem hiding this comment.
This was already fixed in cd3cf07 — the options type now uses subcollections?: boolean and the check was updated to options.subcollections !== false, which correctly handles Commander's --no-subcollections flag setting subcollections: false.
| console.log( | ||
| chalk.gray(` └── Collections processed: ${Object.keys(allData).length}`) | ||
| chalk.gray( | ||
| ` └── Collections processed: ${Object.keys(importData).length}` | ||
| ) | ||
| ); |
There was a problem hiding this comment.
The “Collections processed” summary is computed from Object.keys(importData).length, but importData also contains synthetic keys for subcollections (e.g., collection__docId__subcol). This inflates the reported count and makes the summary misleading. Track top-level collections processed separately (or count only keys that correspond to top-level collections).
There was a problem hiding this comment.
Fixed in cd3cf07. Two issues addressed:
- Inflated count: replaced
Object.keys(importData).lengthwith a dedicatedcollectionsProcessedcounter that only increments for top-level collections, so synthetic subcollection keys (e.g.collection__docId__subcol) no longer inflate the summary. --no-subcollectionsnot working: the options type was usingnoSubcollections?: boolean, but Commander's--no-subcollectionsflag setssubcollections: false. Changed the type tosubcollections?: booleanand the check tooptions.subcollections !== false.
npm-shrinkwrap.json
Outdated
| "version": "0.5.3", | ||
| "lockfileVersion": 3, | ||
| "requires": true, | ||
| "packages": { | ||
| "": { | ||
| "name": "firebase-tools-cli", | ||
| "version": "0.5.1", | ||
| "version": "0.5.3", |
There was a problem hiding this comment.
The shrinkwrap’s top-level version field was updated (0.5.1 → 0.5.3). This is unrelated to the export-format change and can make the PR harder to review; if the intent is not a release/version bump, consider keeping lockfile metadata unchanged (or calling out explicitly why the lockfile version fields need to change).
| $ firebase-tools-cli rtdb:export --database-url https://my-project-default-rtdb.firebaseio.com/ --output ./backups/ | ||
| $ firebase-tools-cli rtdb:export --database-url https://my-project-default-rtdb.firebaseio.com/ --exclude users logs --output ./backups/ | ||
| $ firebase-tools-cli rtdb:export --database-url https://my-project-default-rtdb.firebaseio.com/ --no-subcollections --no-detailed` | ||
| $ firebase-tools-cli rtdb:export --database-url https://my-project-default-rtdb.firebaseio.com/ --no-subcollections` |
There was a problem hiding this comment.
The help text example string ends with an unmatched backtick, which will be shown to users in --help output. Remove the trailing backtick so the example renders correctly.
| $ firebase-tools-cli rtdb:export --database-url https://my-project-default-rtdb.firebaseio.com/ --no-subcollections` | |
| $ firebase-tools-cli rtdb:export --database-url https://my-project-default-rtdb.firebaseio.com/ --no-subcollections |
…export Co-authored-by: omer-ayhan <32736625+omer-ayhan@users.noreply.github.com>
|
@copilot base branch must be development |
Changing the PR base branch is a GitHub setting I'm unable to modify through available tools. You can update it manually via the GitHub UI: on the PR page, click "Edit" next to the title and change the base branch to |
--no-detailedand--no-importableCLI options fromfirestore:exportandrtdb:exportcommandssrc/actions/firestore/firestore-export.tssrc/actions/rtdb/rtdb-export.tsJSON.stringify(..., null, 2)→JSON.stringify(...))firestore_export.json/rtdb_export.json(single compact output)options.noSubcollections→options.subcollections !== falseto correctly honour Commander's--no-subcollectionsflagObject.keys(importData)which also included synthetic subcollection keysOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.