Closed sharat87 closed 21 hours ago
The changes in this pull request primarily involve transitioning from CommonJS to ES module syntax across various files in the app/client/packages/rts
directory. Key modifications include updating import statements, changing function declarations to use the export
keyword, and enhancing type safety in TypeScript files. Additionally, the entry point for the bundler has been updated to use a TypeScript file. New type definitions have been added for better type safety, and several constants have been introduced in a new constants.ts
file.
File Path | Change Summary |
---|---|
app/client/packages/rts/build.js |
Updated entry point from src/ctl/index.js to src/ctl/index.ts . |
app/client/packages/rts/package.json |
Added @types/nodemailer and @types/readline-sync to devDependencies . |
app/client/packages/rts/src/ctl/backup.test.ts |
Converted require statements to import , added Jest mocks, and updated variable declarations. |
app/client/packages/rts/src/ctl/backup.ts |
Transitioned to ES module syntax, exported several functions, and removed the module exports section. |
app/client/packages/rts/src/ctl/check_replica_set.ts |
Updated to ES module syntax, added type definitions, and exported the exec function. |
app/client/packages/rts/src/ctl/constants.js |
Deleted file containing constants related to backup operations. |
app/client/packages/rts/src/ctl/constants.ts |
Introduced new constants for backup and restore operations. |
app/client/packages/rts/src/ctl/export_db.ts |
Transitioned to ES module syntax and exported exportDatabase and run functions. |
app/client/packages/rts/src/ctl/import_db.ts |
Updated to ES module syntax, added type annotations, and exported the run function. |
app/client/packages/rts/src/ctl/index.ts |
Converted to ES module syntax, streamlined command handling, and updated import statements. |
app/client/packages/rts/src/ctl/logger.ts |
Transitioned to ES module syntax and exported backup_error and backup_info functions. |
app/client/packages/rts/src/ctl/mailer.ts |
Updated to ES module syntax and exported sendBackupErrorToAdmins function. |
app/client/packages/rts/src/ctl/mongo_shell_utils.ts |
Transitioned to ES module syntax and exported exec function. |
app/client/packages/rts/src/ctl/restore.ts |
Updated to ES module syntax and exported run function. |
app/client/packages/rts/src/ctl/utils.test.ts |
Converted require statements to import , no changes to test cases. |
app/client/packages/rts/src/ctl/utils.ts |
Transitioned to ES module syntax, updated function exports, and added return types. |
app/client/packages/rts/src/ctl/version.ts |
Updated to ES module syntax and exported exec function. |
Task
, Frontend
"In code we trust, with types so bright,
From JS to TS, we take flight.
Imports now clear, exports in sight,
Our backups and restores, all done right!
With constants anew, our paths align,
In the world of code, we surely shine!" π
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Deferring CodeRabbit suggestions to the next PR so I don't change the files too much. I want Git to treat the changes as file renames instead of deletions+additions.
This PR converts the Javscript code of the
ctl
module, into Typescript, and in the process already fixing two small bugs that went undetected because... of lack of good type checking.The linting exceptions are still there and will be removed in the next PR. Didn't want to change anymore than necessary or Git will detect these changes as "new files" instead of as "renames".
Automation
/test sanity
:mag: Cypress test results
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
Release Notes
New Features
nodemailer
andreadline-sync
.Improvements
Bug Fixes
Chores