Commit Graph

61 Commits

Author SHA1 Message Date
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 ee836e6646 mail: 'my' location is available as mail location
move the reserve domains check to app location validation code
2023-08-01 19:33:59 +05:30
Girish Ramakrishnan b70572a6e9 dns: fqdn only needs domain string
This is from the caas days, when we had hyphenated subdomains flag
2022-11-28 21:56:25 +01:00
Girish Ramakrishnan 185d5d66ad even more constness 2022-04-14 20:30:00 -05:00
Girish Ramakrishnan e8d08968a1 rename location to subdomain
the primary subdomain was previously called 'location'. but the alias/secondary/redirect
subdomain is called 'subdomain'. this makes it all consistent.

location terminology is now used for { subdomain, domain } pair
2022-01-16 12:48:29 -08:00
Girish Ramakrishnan 51d067cbe3 sysinfo: async'ify
in the process, provision, dyndns, mail, dns also got further asyncified
2021-09-02 16:19:46 -07:00
Girish Ramakrishnan 77f5cb183b merge appdb.js into apps.js 2021-08-23 15:35:38 -07:00
Girish Ramakrishnan 5bcf1bc47b merge domaindb.js into domains.js 2021-08-16 14:41:42 -07:00
Girish Ramakrishnan a8760f6c2c tests: cleanup common variables 2021-08-13 11:34:05 -07:00
Girish Ramakrishnan 8da4eaf4a3 fix tests 2021-06-03 16:08:39 -07:00
Girish Ramakrishnan 44ac406e57 admin -> dashboard 2021-05-05 12:29:04 -07:00
Girish Ramakrishnan 199eda82d1 Use Array.isArray instead 2021-05-02 11:26:47 -07:00
Girish Ramakrishnan 5833d6ed5d Fix failing dns and network test 2021-04-14 21:43:51 -07:00
Girish Ramakrishnan 663e0952fc move wellKnownJson to domains
after some more thought:
* If app moves to another location, user has to remember to move all this config
* It's not really associated with an app. It's to do with the domain info
* We can put some hints in the UI if app is missing.

part of #703
2020-12-23 17:13:22 -08:00
Girish Ramakrishnan 9b74bb73aa config.js is dead, long live config.js
we use settings now
2019-07-26 14:51:51 -07:00
Johannes Zellner e43f974d34 Rework namecheap tests 2019-05-20 22:21:20 +02:00
Johannes Zellner 3fe539436b Sinon was only used in old namecheap tests 2019-05-20 16:35:23 +02:00
Girish Ramakrishnan 76f94eb559 namecheap module is not used 2019-05-18 09:41:05 -07:00
Girish Ramakrishnan 9447c45406 enable the gcdns test 2019-05-15 10:18:30 -07:00
Girish Ramakrishnan cfe9af5c3c Disable this test as well 2019-03-23 13:35:12 -07:00
Girish Ramakrishnan 9647ce153d Make tests work
the namecheap test never seems to work
2019-03-23 10:14:21 -07:00
Girish Ramakrishnan 1c69b1695a lint 2019-02-08 11:24:33 -08:00
Tomer S ac391bfc17 Added NameCheap as option for DNS 2019-01-21 12:59:08 +00:00
Girish Ramakrishnan 0c5cb9c98f Remove settings.initialize/uninitialize
this simplifies the startup sequence
2018-11-10 14:55:23 -08:00
Girish Ramakrishnan 953b55439c eventlog: add domain events 2018-11-10 01:25:34 -08:00
Girish Ramakrishnan 6f398144cb validate hyphenatedSubdomain 2018-08-25 18:29:55 -07:00
Johannes Zellner b1b843fdd8 Fix dns tests 2018-06-30 13:59:23 +02:00
Girish Ramakrishnan 6ca28d9a58 validate dns config parameters 2018-06-17 22:21:51 -07:00
Girish Ramakrishnan c3fbead658 Allow zoneName to be changed in domain update route 2018-05-15 15:39:30 -07:00
Johannes Zellner d0e07d995a Add name.com dns tests 2018-05-09 18:13:21 +02:00
Girish Ramakrishnan e8875ccd2e godaddy: add tests 2018-05-07 16:09:00 -07:00
Girish Ramakrishnan 2b3656404b route53: fix tests 2018-05-07 15:53:08 -07:00
Girish Ramakrishnan 60b5e6f711 gandi: add tests 2018-05-07 15:51:51 -07:00
Girish Ramakrishnan 3b987f1970 DNS -> Dns 2018-02-08 12:05:29 -08:00
Girish Ramakrishnan 72f56ff91c rename the gcdns key file 2018-02-03 22:18:04 -08:00
Johannes Zellner d1ef35ae1d Fixup all the tests to use domain tlsConfig 2018-01-31 18:09:38 +01:00
Johannes Zellner c3211c7603 Add domain and enable mail on it for many tests 2018-01-26 20:36:27 +01:00
Girish Ramakrishnan 2f5ab98284 remove config.zoneName() use 2018-01-24 15:01:54 -08:00
Girish Ramakrishnan ee66893875 more config.fqdn() removal in tests 2018-01-24 14:58:37 -08:00
Girish Ramakrishnan 2ac12de204 Add domains.provider 2018-01-09 15:32:49 -08:00
Girish Ramakrishnan e6eb54d572 More test fixing 2017-11-27 18:19:20 -08:00
Girish Ramakrishnan efe75f0c4e make tests finish
database.uninitialize must be called to drop the connection
2017-11-27 11:57:09 -08:00
Johannes Zellner 8d69e5f3b9 More test cleanups to support domains api 2017-11-21 02:46:20 +01:00
Johannes Zellner a08ff89b78 Fix ldap and dns tests 2017-11-20 20:01:50 +01:00
Johannes Zellner 9aa4fdc829 Fixup the dns provider tests 2017-11-20 20:01:50 +01:00
Johannes Zellner 3265d7151c Migrate dns test to domains.js 2017-11-20 19:59:26 +01:00
Girish Ramakrishnan 020ccc8a99 gcdns: fix update/del confusion
in the DNS api, we always update/del all records of same type
2017-09-15 01:54:39 -07:00
Girish Ramakrishnan db1e39be11 Do not overwrite subdomain when location was changed
* Install in subdomain 'test'
* Move to subdomain 'test2'
* Move to another existing subdomain 'www' (this should be detected as conflict)
* Move to subdomain 'www2' (this should not remove 'www'). This is why dnsRecordId exists.
2017-09-14 22:31:48 -07:00
Aleksandr Bogdanov 6fce729ed2 Adding Google Cloud DNS 2017-09-09 17:45:26 +02:00