Commit Graph

19 Commits

Author SHA1 Message Date
Girish Ramakrishnan f4ff63485a domains: validate well known 2026-02-25 05:55:14 +01:00
Johannes Zellner 2f951dc272 Support card/cal dav well-known endpoints 2026-02-20 15:46:43 +01:00
Girish Ramakrishnan 36aa641cb9 migrate to "export default"
also, set no-use-before-define in linter
2026-02-14 15:43:24 +01:00
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 6ac0cd421a use the @cloudron/superagent module 2025-07-10 10:56:05 +02:00
Girish Ramakrishnan 8e58349bfa replace with custom superagent based on fetch API 2025-02-15 15:14:09 +01:00
Girish Ramakrishnan eee49a8291 move dashboard setting into dashboard.js 2023-08-11 21:04:10 +05:30
Girish Ramakrishnan 4cdf37b060 settings: move mailFqdn/Domain into mailServer 2023-08-04 22:02:24 +05:30
Johannes Zellner 909c68b924 Only respond to dashboardFqdn for oidc well-known 2023-04-06 10:27:37 +02:00
Johannes Zellner 3b0442c972 Only serve oidc well-known from dashboard domain 2023-04-05 18:11:46 +02:00
Johannes Zellner 22f9ffd119 Fixup many linter errors 2023-03-21 14:46:09 +01:00
Johannes Zellner e9fc355ac5 Move openid provider into its own express server 2023-03-21 14:39:58 +01:00
Johannes Zellner 8a1cb6b9b3 Support .well-known/openid-configuration directly 2023-03-20 15:48:38 +01:00
Girish Ramakrishnan 66fcf92a24 wellknown: asyncify 2021-08-30 23:07:19 -07:00
Girish Ramakrishnan 5bcf1bc47b merge domaindb.js into domains.js 2021-08-16 14:41:42 -07:00
Girish Ramakrishnan 205dab02be wellknown: serve up matrix/client 2021-07-29 12:05:21 -07:00
Girish Ramakrishnan ac484a02f2 merge maildb.js into mail.js 2021-06-29 15:59:02 -07:00
Girish Ramakrishnan ef68cb70c0 email autoconfig 2021-01-28 16:58:37 -08:00