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