Skip to content

refactor: migrate pg backups pt 7 to esm#3462

Merged
michaelmalave merged 8 commits intov11.0.0from
mm/refactor/pg-backups-pt-7
Jan 13, 2026
Merged

refactor: migrate pg backups pt 7 to esm#3462
michaelmalave merged 8 commits intov11.0.0from
mm/refactor/pg-backups-pt-7

Conversation

@michaelmalave
Copy link
Copy Markdown
Contributor

@michaelmalave michaelmalave commented Jan 8, 2026

Summary

Migrated 7 pg:backups commands from src/oldCommands to src/commands and updated them to use ESM and the new UX helpers from @heroku/heroku-cli-util (hux). Replaced ux.log with ux.stdout, replaced lodash sorts with native JavaScript, and updated all imports for ESM compatibility. Fixed nls.ts to work with ESM by using readFileSync instead of JSON imports. Updated and fixed all unit tests to work with the new hux.table() output format.

Type of Change

  • fix: Bug fix or issue (patch semvar update)
  • feat: Introduces a new feature to the codebase (minor semvar update)
  • perf: Performance improvement
  • docs: Documentation only changes
  • tests: Adding missing tests or correcting existing tests
  • chore: Code cleanup tasks, dependency updates, or other changes

Verification

Test in a non-private space database. You can test with an essential-0 database.
To create one: heroku addons:create heroku-postgresql:essential-0 -app $APP_NAME

./bin/run pg:backups --app $APP_NAME
./bin/run pg:backups:info --app $APP_NAME
./bin/run pg:backups:restore --app $APP_NAME
./bin/run pg:backups:schedule --app $APP_NAME --at "9:00 PST"
./bin/run pg:backups:schedules --app $APP_NAME
./bin/run pg:backups:unschedule --app $APP_NAME
./bin/run pg:backups:url --app $APP_NAME

Additional Context

  • Replaced ux.log with ux.stdout per @oclif/core API
  • Replaced lodash.sortBy with native Array.prototype.sort()
  • Updated imports to use .js extensions for ESM compatibility
  • Updated test expectations to use removeAllWhitespace() helper for flexible table output matching (following pattern from releases/index.unit.test.ts)
  • Created ESM wrapper for backupsFactory in test/helpers/wrappers/backups-wrapper.ts to enable mocking in tests

Related Issue

Closes #W-19701068

Copy link
Copy Markdown
Contributor

@eablack eablack left a comment

Choose a reason for hiding this comment

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

looks mostly good to me, one question to be resolved before merging

Comment thread packages/cli/test/helpers/wrappers/backups-wrapper.ts Outdated
@michaelmalave michaelmalave merged commit fef07cd into v11.0.0 Jan 13, 2026
13 checks passed
@michaelmalave michaelmalave deleted the mm/refactor/pg-backups-pt-7 branch January 13, 2026 17:40
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.

2 participants