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
a9ae34b149
community: download iconUrl
...
also rename existing db field appStoreIcon to packageIcon
2026-02-06 19:13:55 +01:00
Girish Ramakrishnan
28c0d63f89
app archive: fix download config
2025-10-06 22:34:28 +02:00
Girish Ramakrishnan
5dd5a20fc1
code -> sqlCode
2025-09-29 12:18:26 +02: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
cbc73f5c9a
remove uuid module
...
built into node.js now
2025-07-28 12:54:09 +02:00
Girish Ramakrishnan
cd8be9ffb5
archive: appConfig is null for pre-8.2 backups
...
use backups.manifest when possible instead
2024-12-19 15:21:33 +01:00
Girish Ramakrishnan
96f2c6e2aa
archive: add button to download the config
2024-12-11 09:50:54 +01:00
Girish Ramakrishnan
41bc08a07e
backup: move appConfig to backups table
...
this is useful for clone also to copy notes, operators, checklist
of the time when the backup was made (as opposed to current)
at this point, it's not clear why we need a archives table. it's
an optimization to not have to store icon for every backup.
2024-12-10 21:04:37 +01:00
Girish Ramakrishnan
fbe334e7d7
install/unarchive: add support for various fields
2024-12-10 18:39:16 +01:00
Girish Ramakrishnan
9a155491cb
move unarchive to apps model
2024-12-10 17:19:12 +01:00
Girish Ramakrishnan
ab8ec07f2f
clone/unarchive: handle notes and checklist
2024-12-10 17:16:06 +01:00
Girish Ramakrishnan
0e181cdc82
archive: implement unarchive
...
made a separate route instead of reusing install route. this was
because we want to copy over all the old app config as much as
possible.
2024-12-10 16:49:19 +01:00
Girish Ramakrishnan
30b0d4cced
archives: add listing
2024-12-10 12:30:10 +01:00
Girish Ramakrishnan
f973536f7f
archives: add eventlog
2024-12-10 11:10:35 +01:00
Girish Ramakrishnan
490840b71d
archives: use separate table
...
Cleaner to separate things from the backups table.
* icon, appConfig, appStoreIcon etc are only valid for archives
* older version cloudron does not have appConfig in backups table (so it
cannot be an archive entry)
2024-12-10 10:36:44 +01:00