build(build): removed from showing in the change log

This commit is contained in:
2025-03-23 11:10:00 -05:00
parent 9bdca3317c
commit e82208fc5e
2 changed files with 165 additions and 124 deletions

View File

@@ -8,7 +8,8 @@
{"type": "refactor", "section": "🛠️ Code Refactor"},
{"type": "perf", "hidden": false, "section": "🚀 Performance"},
{"type": "test", "section": "📝 Testing Code"},
{"type": "ci", "section": "📈 Project changes"}
{"type": "ci", "hidden": false, "section": "📈 Project changes"}
{"type": "build", "hidden": true, "section": "📈 Project Builds"}
],
"commitUrlFormat": "https://git.tuffraid.net/cowch/lstV2/commits/{{hash}}",
"compareUrlFormat": "https://git.tuffraid.net/cowch/lstV2/compare/{{previousTag}}...{{currentTag}}",

View File

@@ -1,9 +1,9 @@
import AdmZip from "adm-zip";
import path from "path";
import fs from "fs";
import {execSync} from "child_process";
import {createLog} from "../services/logger/logger.js";
import {getAppInfo} from "../globalUtils/appInfo.js";
import { execSync } from "child_process";
import { createLog } from "../services/logger/logger.js";
import { getAppInfo } from "../globalUtils/appInfo.js";
// create the ignore list
const ignoreList = [
@@ -90,15 +90,32 @@ const updateBuildNumber = (appLock: string) => {
// Write the updated data back
fs.writeFileSync(packagePath, JSON.stringify(pkgJson, null, 2), "utf8");
createLog("info", "lst", "zipUpBuild", `Build number updated to: ${pkgJson.admConfig.build}`);
createLog(
"info",
"lst",
"zipUpBuild",
`Build number updated to: ${pkgJson.admConfig.build}`
);
// Auto-commit changes
execSync("git add package.json");
execSync(`git commit -m "chore: bump build number to ${pkgJson.admConfig.build}"`);
execSync(
`git commit -m "build: bump build number to ${pkgJson.admConfig.build}"`
);
} else {
createLog("error", "lst", "zipUpBuild", "admConfig.build is missing or not a number");
createLog(
"error",
"lst",
"zipUpBuild",
"admConfig.build is missing or not a number"
);
}
} catch (error) {
createLog("error", "lst", "zipUpBuild", `Error updating build number: ${error}`);
createLog(
"error",
"lst",
"zipUpBuild",
`Error updating build number: ${error}`
);
}
};
@@ -113,10 +130,18 @@ export const createZip = async (appLock: string) => {
addToZip(zip, srcPath, srcPath);
// Write the zip file to disk
const outputZipPath = path.join(destPath, `${app.name}-${app.version}-${app.admConfig.build}.zip`);
const outputZipPath = path.join(
destPath,
`${app.name}-${app.version}-${app.admConfig.build}.zip`
);
zip.writeZip(outputZipPath);
createLog("info", "lst", "zipUpBuild", `Zip file created at ${outputZipPath}`);
createLog(
"info",
"lst",
"zipUpBuild",
`Zip file created at ${outputZipPath}`
);
updateBuildNumber(appLock);
// only keep the last 5 builds for the type we have.
@@ -130,7 +155,12 @@ export const createZip = async (appLock: string) => {
}))
.sort((a, b) => a.time - b.time); // Sort by modification time (oldest first)
createLog("info", "lst", "zipUpBuild", `app Files (sorted by time):", ${JSON.stringify(appFiles)}`);
createLog(
"info",
"lst",
"zipUpBuild",
`app Files (sorted by time):", ${JSON.stringify(appFiles)}`
);
if (appFiles.length > 5) {
appFiles.slice(0, -5).forEach((file) => {
@@ -139,14 +169,24 @@ export const createZip = async (appLock: string) => {
fs.unlinkSync(filePath);
createLog("info", "lst", "zipUpBuild", `Deleted: ${file.name}`);
} catch (error: any) {
createLog("error", "lst", "zipUpBuild", `Failed to delete ${file.name}: ${error.message}`);
createLog(
"error",
"lst",
"zipUpBuild",
`Failed to delete ${file.name}: ${error.message}`
);
}
});
} else {
createLog("info", "lst", "zipUpBuild", "No files to delete.");
}
} catch (error: any) {
createLog("error", "lst", "zipUpBuild", `Error reading directory or deleting files:", ${error.message}`);
createLog(
"error",
"lst",
"zipUpBuild",
`Error reading directory or deleting files:", ${error.message}`
);
}
};