Skip to content

Remove detailed export format and pretty-printing; output single compact importable JSON#54

Closed
Copilot wants to merge 5 commits intomainfrom
copilot/remove-detailed-export-formatting
Closed

Remove detailed export format and pretty-printing; output single compact importable JSON#54
Copilot wants to merge 5 commits intomainfrom
copilot/remove-detailed-export-formatting

Conversation

Copy link
Contributor

Copilot AI commented Mar 7, 2026

  • Remove --no-detailed and --no-importable CLI options from firestore:export and rtdb:export commands
  • Remove detailed export logic from src/actions/firestore/firestore-export.ts
  • Remove detailed export logic from src/actions/rtdb/rtdb-export.ts
  • Remove pretty-printing (JSON.stringify(..., null, 2)JSON.stringify(...))
  • Rename output files to firestore_export.json / rtdb_export.json (single compact output)
  • Update CLI help text and README documentation
  • Fix options.noSubcollectionsoptions.subcollections !== false to correctly honour Commander's --no-subcollections flag
  • Fix inflated "Collections processed" count — now tracks only top-level collections via a dedicated counter, not Object.keys(importData) which also included synthetic subcollection keys
Original prompt

This section details on the original issue you should resolve

<issue_title>Remove detailed export and pretty formatting; default to single compact importable export (optionally gzipped)</issue_title>
<issue_description>Simplify export output by removing the detailed format and pretty-printing of exported JSON. Produce only a single, compact importable JSON format by default (optionally with gzip compression for large outputs).

Proposal:

  • Remove the detailed export option from both Firestore and RTDB export commands
  • Stop pretty-printing output (remove the JSON.stringify(..., null, 2) formatting)
  • Default to a single importable JSON output file (e.g., firestore_export.json or rtdb_export.json); consider making gzip compression the default for very large exports
  • Update CLI documentation, examples, and help text accordingly

Benefits:

  • Export and import flows are simpler
  • Significantly reduced I/O time and file size
  • Fewer choices and flags required when running export

Related to performance, output design, and user experience.</issue_description>

<agent_instructions>- read issue details and requested changes carefully.

  • Apply your changes without side effects
  • don't overnegineer
  • make sure changes don't effect other unrelated features</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 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.

…ct importable export

Co-authored-by: omer-ayhan <32736625+omer-ayhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove detailed export and pretty formatting for JSON Remove detailed export format and pretty-printing; output single compact importable JSON Mar 7, 2026
@omer-ayhan omer-ayhan marked this pull request as ready for review March 7, 2026 11:24
@omer-ayhan omer-ayhan requested review from Copilot and omer-ayhan March 7, 2026 11:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 / importable export 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.

Comment on lines 72 to 74
// Handle subcollections if enabled
if (!options.noSubcollections) {
const subcollections = await doc.ref.listCollections();
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

--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).

Copilot uses AI. Check for mistakes.
Copy link
Owner

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment on lines 172 to 176
console.log(
chalk.gray(` └── Collections processed: ${Object.keys(allData).length}`)
chalk.gray(
` └── Collections processed: ${Object.keys(importData).length}`
)
);
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

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).

Copilot uses AI. Check for mistakes.
Copy link
Owner

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in cd3cf07. Two issues addressed:

  • Inflated count: replaced Object.keys(importData).length with a dedicated collectionsProcessed counter that only increments for top-level collections, so synthetic subcollection keys (e.g. collection__docId__subcol) no longer inflate the summary.
  • --no-subcollections not working: the options type was using noSubcollections?: boolean, but Commander's --no-subcollections flag sets subcollections: false. Changed the type to subcollections?: boolean and the check to options.subcollections !== false.

Comment on lines +3 to +9
"version": "0.5.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "firebase-tools-cli",
"version": "0.5.1",
"version": "0.5.3",
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

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).

Copilot uses AI. Check for mistakes.
$ 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`
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
$ 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

Copilot uses AI. Check for mistakes.
…export

Co-authored-by: omer-ayhan <32736625+omer-ayhan@users.noreply.github.com>
@omer-ayhan
Copy link
Owner

@copilot base branch must be development

Copy link
Contributor Author

Copilot AI commented Mar 7, 2026

@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 development.

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.

Remove detailed export and pretty formatting; default to single compact importable export (optionally gzipped)

3 participants