Girish Ramakrishnan
|
96dc79cfe6
|
Migrate codebase from CommonJS to ES Modules
- Convert all require()/module.exports to import/export across 260+ files
- Add "type": "module" to package.json to enable ESM by default
- Add migrations/package.json with "type": "commonjs" to keep db-migrate compatible
- Convert eslint.config.js to ESM with sourceType: "module"
- Replace __dirname/__filename with import.meta.dirname/import.meta.filename
- Replace require.main === module with process.argv[1] === import.meta.filename
- Remove 'use strict' directives (implicit in ESM)
- Convert dynamic require() in switch statements to static import lookup maps
(dns.js, domains.js, backupformats.js, backupsites.js, network.js)
- Extract self-referencing exports.CONSTANT patterns into standalone const
declarations (apps.js, services.js, locks.js, users.js, mail.js, etc.)
- Lazify SERVICES object in services.js to avoid circular dependency TDZ issues
- Add clearMailQueue() to mailer.js for ESM-safe queue clearing in tests
- Add _setMockApp() to ldapserver.js for ESM-safe test mocking
- Add _setMockResolve() wrapper to dig.js for ESM-safe DNS mocking in tests
- Convert backupupload.js to use dynamic imports so --check exits before
loading the module graph (which requires BOX_ENV)
- Update check-install to use ESM import for infra_version.js
- Convert scripts/ (hotfix, release, remote_hotfix.js, find-unused-translations)
- All 1315 tests passing
Migration stats (AI-assisted using Cursor with Claude):
- Wall clock time: ~3-4 hours
- Assistant completions: ~80-100
- Estimated token usage: ~1-2M tokens
Co-authored-by: Cursor <cursoragent@cursor.com>
|
2026-02-14 15:11:45 +01:00 |
|
Girish Ramakrishnan
|
12e073e8cf
|
use node: prefix for requires
mostly because code is being autogenerated by all the AI stuff using
this prefix. it's also used in the stack trace.
|
2025-08-14 12:55:35 +05:30 |
|
Girish Ramakrishnan
|
989d843fcb
|
shell: make shell.sudo promise based and waitable
|
2025-07-16 22:04:24 +02:00 |
|
Girish Ramakrishnan
|
8f6637773b
|
shell: add option for maxLines
|
2024-11-18 07:59:05 +05:30 |
|
Girish Ramakrishnan
|
df5ba25010
|
shell: add explicit bash() function
|
2024-10-16 10:40:17 +02:00 |
|
Girish Ramakrishnan
|
6c3ca9c364
|
shell: rework code to use shell.spawn
spawn gives out streams and we have more control over the stdout/stderr
buffers. otherwise, we have to provide a max buffer capture size to exec
|
2024-10-15 12:13:46 +02:00 |
|
Girish Ramakrishnan
|
a9e1d7641d
|
shell: make require take a tag
|
2024-10-14 21:08:32 +02:00 |
|
Girish Ramakrishnan
|
a6f078330f
|
shell: no need to promise scoping
|
2024-02-21 19:40:27 +01:00 |
|
Girish Ramakrishnan
|
cfd5c0f82b
|
shell: rewrite exec to use execFile
this also renames execFile to execArgs
|
2024-02-21 18:54:43 +01:00 |
|
Girish Ramakrishnan
|
2237d2bbb7
|
shell: remove usage of .spawn
|
2024-02-21 13:27:04 +01:00 |
|
Girish Ramakrishnan
|
9b94cf18d0
|
convert more execSync to async
|
2024-02-21 11:00:12 +01:00 |
|
Girish Ramakrishnan
|
3da3ccedcb
|
volumes: only wait for 5 seconds for mount status
mountpoint -q can never exit if the nfs mount disappears, for example
|
2024-02-20 21:38:57 +01:00 |
|
Girish Ramakrishnan
|
26eb739b46
|
shell: add options to exec
|
2024-02-20 21:11:09 +01:00 |
|
Girish Ramakrishnan
|
a8760f6c2c
|
tests: cleanup common variables
|
2021-08-13 11:34:05 -07:00 |
|
Girish Ramakrishnan
|
4937cbbc0b
|
shell: add promises test
|
2021-06-03 19:36:37 -07:00 |
|
Girish Ramakrishnan
|
0447dce0d6
|
graphite: restart collectd as well
|
2021-03-23 16:34:36 -07:00 |
|
Girish Ramakrishnan
|
802011bb7e
|
Fix args to shell.sudo
|
2018-11-25 14:57:51 -08:00 |
|
Girish Ramakrishnan
|
9b4fffde29
|
Use shell.exec instead of shell.execSync
|
2018-11-23 11:18:45 -08:00 |
|
Girish Ramakrishnan
|
fd4057df94
|
shell.exec -> shell.spawn
|
2018-11-17 19:26:19 -08:00 |
|
Girish Ramakrishnan
|
547a80f17b
|
make shell.exec options non-optional
|
2017-09-09 19:54:31 -07:00 |
|
Girish Ramakrishnan
|
d71d09c1ba
|
Add shell.execSync
|
2016-05-24 10:22:39 -07:00 |
|
Girish Ramakrishnan
|
df9d321ac3
|
app.portBindings and newManifest.tcpPorts may be null
|
2015-07-20 00:10:36 -07:00 |
|