Girish Ramakrishnan
b5a1554631
Fix various linter errors
2026-02-15 19:37:30 +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
989d843fcb
shell: make shell.sudo promise based and waitable
2025-07-16 22:04:24 +02:00
Girish Ramakrishnan
e03beba9bc
sudo: add kill-child.sh
...
ultimately, a non-previlieged child cannot kill previlieged parent.
all the notes and research in shell.js are not useful.
2025-07-16 21:26:57 +02:00
Girish Ramakrishnan
e4ceedcac6
logs: use child_process.spawn directly for sudo
...
shell.sudo will move to a promise based API shortly
2025-07-16 20:23:57 +02:00
Girish Ramakrishnan
a9e1d7641d
shell: make require take a tag
2024-10-14 21:08:32 +02:00
Girish Ramakrishnan
23f9b5f2fc
logs: when no timestamp, use the last known
2024-10-14 16:30:30 +02:00
Girish Ramakrishnan
69f48ed11a
apps: do not log app logs to output
2024-08-07 15:51:04 +02:00
Girish Ramakrishnan
9399040cd3
Fix log recursion
...
shell.sudo logs output to stdout/stderr intentionally. It is not meant
for scripts that generate much output (basically scripts/* files).
core of the issue is that none of the log commands require to use sudo.
they can just use normal tail. only app logs requires sudo because of the
logPaths directive in the manifest.
2024-07-25 17:48:58 +02:00
Girish Ramakrishnan
b6fbc46b58
Revert "Add option to not log shell subprocess stdout+stderr"
...
This reverts commit 51bb2d2bc2 .
2024-07-25 11:53:56 +02:00
Johannes Zellner
51bb2d2bc2
Add option to not log shell subprocess stdout+stderr
...
When tailing the box log file this leads to logline recursion
2024-07-25 10:22:02 +02:00
Girish Ramakrishnan
54c6f9c4f8
logs: do not push empty lines
2024-05-13 08:37:49 +02:00
Girish Ramakrishnan
13e62bc738
logs: use stream.destroy() instead of custom hooks
2024-02-24 17:35:37 +01:00
Girish Ramakrishnan
d0dc104ede
logs: make logPaths work
...
we have to tail via sudo script
Fixes #811
2024-02-23 17:46:22 +01:00
Girish Ramakrishnan
4ebff09f73
lint
2024-02-22 16:50:35 +01:00
Girish Ramakrishnan
603f92251e
refactor tail invokation into logtail.sh
2023-03-27 11:39:34 +02:00