Girish Ramakrishnan
9e20c5a3e3
logs: escape and unescape new lines
2026-04-07 12:54:51 +02:00
Girish Ramakrishnan
f12b4faf34
lint
2026-03-12 23:23:23 +05:30
Girish Ramakrishnan
01d0c738bc
replace debug() with our custom logger
...
mostly we want trace() and log(). trace() can be enabled whenever
we want by flipping a flag and restarting box
2026-03-12 23:08:35 +05:30
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
e8a9bd83d3
add comment from 063b102461
2025-09-15 14:01:47 +02:00
Girish Ramakrishnan
8d32c853d5
syslog: use named captures and better logging
2025-09-15 13:33:41 +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
063b102461
syslog: strip empty trailing newlines
...
for unknown reasons, syslog messages are getting generating with
newlines in the end. we then try to parse this empty string as a
syslog message and fail
2025-02-27 11:16:52 +01:00
Girish Ramakrishnan
a884f968e1
syslog: fix parsing of multi-message packets
2024-10-14 13:54:32 +02:00
Girish Ramakrishnan
86c4db8f22
bugs in syslog parsing
2024-09-10 13:46:13 +02:00
Girish Ramakrishnan
8c0c9981de
remove usage of nsyslog-parser-2
...
this module is somehow parsing the syslog incorrectly causing
incorrect directories being created in the logs directory
(since appName got parsed incorrectly)
2024-09-10 13:09:43 +02:00
Girish Ramakrishnan
cb8731b915
syslog: also replace CR (\r)
2024-05-21 16:48:29 +02:00
Johannes Zellner
890de53b0a
syslog: handle potential multiline syslog input
2024-05-15 13:45:32 +02:00
Girish Ramakrishnan
6bd9391160
syslog: fix tests
2024-03-30 19:17:28 +01:00
Girish Ramakrishnan
4ee56782ba
move syslog.js to top level
2024-03-21 19:09:51 +01:00