Commit Graph

10 Commits

Author SHA1 Message Date
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 c1c16ab54e test: add simple gitlab-ci file 2024-09-20 18:48:55 +02:00
Johannes Zellner 4d29592450 Do not invalidate session sudo but only for the command we want to test 2023-12-04 01:42:46 +01:00
Girish Ramakrishnan 943325baa3 better sudoers configuration check 2023-12-03 17:50:50 +01:00
Girish Ramakrishnan 57772662aa move provisioning routes into /provision/ 2023-08-10 16:52:10 +05:30
Girish Ramakrishnan c6db1c70c0 docker: fix image prune
it seems docker images --digests cloudron/sftp --format "{{.ID}} {{.Repository}}:{{.Tag}}@{{.Digest}}
broke at some point
2023-08-08 21:21:00 +05:30
Girish Ramakrishnan 4c422e48b2 check-install: print all sudo instructions at once 2023-07-11 14:58:09 +05:30
Girish Ramakrishnan ff539e2669 remove crashnotifier
it's not really used
2023-05-15 11:08:00 +02:00
Girish Ramakrishnan 8e0d1b61af Make tests run again 2023-03-11 23:41:01 +01:00
Girish Ramakrishnan 7cb326cfff no camel case in filenames 2022-10-14 08:22:04 +02:00