refactor(compile): changes to keep the last 20 builds

This commit is contained in:
2025-04-01 16:22:01 -05:00
parent 544e82c01d
commit bc2336e46d

View File

@@ -88,7 +88,11 @@ const updateBuildNumber = (appLock: string) => {
pkgJson.admConfig.build += 1; pkgJson.admConfig.build += 1;
// Write the updated data back // Write the updated data back
fs.writeFileSync(packagePath, JSON.stringify(pkgJson, null, 2), "utf8"); fs.writeFileSync(
packagePath,
JSON.stringify(pkgJson, null, 2),
"utf8"
);
createLog( createLog(
"info", "info",
@@ -162,12 +166,17 @@ export const createZip = async (appLock: string) => {
`app Files (sorted by time):", ${JSON.stringify(appFiles)}` `app Files (sorted by time):", ${JSON.stringify(appFiles)}`
); );
if (appFiles.length > 5) { if (appFiles.length > 20) {
appFiles.slice(0, -5).forEach((file) => { appFiles.slice(0, -20).forEach((file) => {
const filePath = path.join(destPath, file.name); const filePath = path.join(destPath, file.name);
try { try {
fs.unlinkSync(filePath); fs.unlinkSync(filePath);
createLog("info", "lst", "zipUpBuild", `Deleted: ${file.name}`); createLog(
"info",
"lst",
"zipUpBuild",
`Deleted: ${file.name}`
);
} catch (error: any) { } catch (error: any) {
createLog( createLog(
"error", "error",