feat: add script hot-reload and compile-on-save

This commit is contained in:
plenarius
2026-04-20 19:50:39 -04:00
parent 59909a7b48
commit 5c840e324b
2 changed files with 77 additions and 1 deletions
+25 -1
View File
@@ -1,5 +1,9 @@
import { Router } from "express";
import { buildModule } from "../services/build.service.js";
import {
buildModule,
hotReloadScripts,
compileSingle,
} from "../services/build.service.js";
const router = Router();
@@ -23,4 +27,24 @@ router.post("/module/pack", async (req, res) => {
}
});
router.post("/deploy", async (_req, res) => {
try {
const result = await hotReloadScripts();
res.json(result);
} catch (err: any) {
res.status(500).json({ error: err.message });
}
});
router.post("/compile-single", async (req, res) => {
const { filePath } = req.body;
if (!filePath) return res.status(400).json({ error: "filePath required" });
try {
const result = await compileSingle(filePath);
res.json(result);
} catch (err: any) {
res.status(500).json({ error: err.message });
}
});
export default router;