refactor(builds): refactored how the builds works to include the build number now
this will be for the new lst - ccc
This commit is contained in:
@@ -9,6 +9,7 @@ import { routeHitMiddleware } from "./middleware/routeHit.middleware.js";
|
|||||||
import { setupRoutes } from "./routeHandler.routes.js";
|
import { setupRoutes } from "./routeHandler.routes.js";
|
||||||
import { auth } from "./utils/auth.utils.js";
|
import { auth } from "./utils/auth.utils.js";
|
||||||
import { lstCors } from "./utils/cors.utils.js";
|
import { lstCors } from "./utils/cors.utils.js";
|
||||||
|
import { getAppVersion } from "./utils/version.utils.js";
|
||||||
|
|
||||||
const createApp = async () => {
|
const createApp = async () => {
|
||||||
const log = createLogger({ module: "system", subModule: "main start" });
|
const log = createLogger({ module: "system", subModule: "main start" });
|
||||||
@@ -35,6 +36,7 @@ const createApp = async () => {
|
|||||||
app.all(`${baseUrl}/api/auth/*splat`, toNodeHandler(auth));
|
app.all(`${baseUrl}/api/auth/*splat`, toNodeHandler(auth));
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
|
|
||||||
|
const version = await getAppVersion();
|
||||||
app.get(`${baseUrl}/api/lst-config.js`, (_, res) => {
|
app.get(`${baseUrl}/api/lst-config.js`, (_, res) => {
|
||||||
res.type("application/javascript");
|
res.type("application/javascript");
|
||||||
res.setHeader("Cache-Control", "no-store");
|
res.setHeader("Cache-Control", "no-store");
|
||||||
@@ -47,7 +49,9 @@ const createApp = async () => {
|
|||||||
appVersion: ${JSON.stringify(umamiConfig.appVersion ?? "dev")},
|
appVersion: ${JSON.stringify(umamiConfig.appVersion ?? "dev")},
|
||||||
umamiHost: ${JSON.stringify(umamiConfig.umamiHost ?? "")},
|
umamiHost: ${JSON.stringify(umamiConfig.umamiHost ?? "")},
|
||||||
umamiWebsiteId: ${JSON.stringify(umamiConfig.umamiWebsiteId ?? "")},
|
umamiWebsiteId: ${JSON.stringify(umamiConfig.umamiWebsiteId ?? "")},
|
||||||
timezone: ${JSON.stringify(process.env.TIMEZONE ?? "America/Chicago")}
|
timezone: ${JSON.stringify(process.env.TIMEZONE ?? "America/Chicago")},
|
||||||
|
version: ${JSON.stringify(version.version)},
|
||||||
|
lastBuildTIme: ${JSON.stringify(version.lastBuildTime)}
|
||||||
};
|
};
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,12 +17,13 @@ import { prodStopSpec } from "../scaler/prodSqlStop.spec.js";
|
|||||||
import { prodRegisterSpec } from "../scaler/register.spec.js";
|
import { prodRegisterSpec } from "../scaler/register.spec.js";
|
||||||
// all the specs
|
// all the specs
|
||||||
import { statusSpec } from "../scaler/stats.spec.js";
|
import { statusSpec } from "../scaler/stats.spec.js";
|
||||||
|
import { getAppVersion } from "../utils/version.utils.js";
|
||||||
|
|
||||||
export const openApiBase: OpenAPIV3_1.Document = {
|
export const openApiBase: OpenAPIV3_1.Document = {
|
||||||
openapi: "3.1.0",
|
openapi: "3.1.0",
|
||||||
info: {
|
info: {
|
||||||
title: "LST API",
|
title: "LST API",
|
||||||
version: "3.0.0",
|
version: (await getAppVersion()).version ?? "",
|
||||||
description: "Label System Tracking API",
|
description: "Label System Tracking API",
|
||||||
},
|
},
|
||||||
servers: [
|
servers: [
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { createServer } from "node:http";
|
import { createServer } from "node:http";
|
||||||
import os from "node:os";
|
import os from "node:os";
|
||||||
|
|
||||||
import createApp from "./app.js";
|
import createApp from "./app.js";
|
||||||
import { db } from "./db/db.controller.js";
|
import { db } from "./db/db.controller.js";
|
||||||
import { startDbNotificationListener } from "./db/db.listener.js";
|
import { startDbNotificationListener } from "./db/db.listener.js";
|
||||||
@@ -32,6 +33,7 @@ import { ppooMonitoring } from "./warehousing/warehousing.ppooMonitor.js";
|
|||||||
|
|
||||||
const port = Number(process.env.PORT) || 3000;
|
const port = Number(process.env.PORT) || 3000;
|
||||||
export let systemSettings: Setting[] = [];
|
export let systemSettings: Setting[] = [];
|
||||||
|
|
||||||
const start = async () => {
|
const start = async () => {
|
||||||
const { app, baseUrl } = await createApp();
|
const { app, baseUrl } = await createApp();
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,15 @@ import {
|
|||||||
type SqlQuery,
|
type SqlQuery,
|
||||||
sqlQuerySelector,
|
sqlQuerySelector,
|
||||||
} from "../prodSql/prodSqlQuerySelector.utils.js";
|
} from "../prodSql/prodSqlQuerySelector.utils.js";
|
||||||
|
|
||||||
import { isServerRunning } from "../tcpServer/tcp.server.js";
|
import { isServerRunning } from "../tcpServer/tcp.server.js";
|
||||||
|
import { getAppVersion } from "../utils/version.utils.js";
|
||||||
|
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
router.get("/", async (_, res) => {
|
router.get("/", async (_, res) => {
|
||||||
const used = process.memoryUsage();
|
const used = process.memoryUsage();
|
||||||
|
const version = await getAppVersion();
|
||||||
|
|
||||||
const query = sqlQuerySelector("prodSqlStats") as SqlQuery;
|
const query = sqlQuerySelector("prodSqlStats") as SqlQuery;
|
||||||
|
|
||||||
@@ -20,6 +23,8 @@ router.get("/", async (_, res) => {
|
|||||||
status: "ok",
|
status: "ok",
|
||||||
uptime: process.uptime(),
|
uptime: process.uptime(),
|
||||||
nodeVersion: process.version,
|
nodeVersion: process.version,
|
||||||
|
appVersion: version.version ?? "",
|
||||||
|
lastBuildDate: version.lastBuildTime ?? "",
|
||||||
memoryUsage: `Heap: ${(used.heapUsed / 1024 / 1024).toFixed(2)} MB / RSS: ${(
|
memoryUsage: `Heap: ${(used.heapUsed / 1024 / 1024).toFixed(2)} MB / RSS: ${(
|
||||||
used.rss / 1024 / 1024
|
used.rss / 1024 / 1024
|
||||||
).toFixed(2)} MB`,
|
).toFixed(2)} MB`,
|
||||||
|
|||||||
16
backend/utils/version.utils.ts
Normal file
16
backend/utils/version.utils.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import fsp from "node:fs/promises";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
|
export const getAppVersion = async () => {
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
const version = path.join(__dirname, "../../package.json");
|
||||||
|
const raw = await fsp.readFile(`${version}`, "utf8");
|
||||||
|
const config = JSON.parse(raw);
|
||||||
|
|
||||||
|
return {
|
||||||
|
version: `${config.version}.${parseInt((config.build as string) ?? "1", 0) - 1}`,
|
||||||
|
lastBuildTime: config.lastBuildDate,
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -2,6 +2,7 @@ import fs from "node:fs";
|
|||||||
import fsp from "node:fs/promises";
|
import fsp from "node:fs/promises";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import archiver from "archiver";
|
import archiver from "archiver";
|
||||||
|
import { format } from "date-fns";
|
||||||
import { createLogger } from "../logger/logger.controller.js";
|
import { createLogger } from "../logger/logger.controller.js";
|
||||||
import { emitBuildLog } from "./build.utils.js";
|
import { emitBuildLog } from "./build.utils.js";
|
||||||
import { updateAppStats } from "./updateAppStats.utils.js";
|
import { updateAppStats } from "./updateAppStats.utils.js";
|
||||||
@@ -17,33 +18,31 @@ const exists = async (target: string) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getNextBuildNumber = async (buildNumberFile: string) => {
|
const getNextBuildNumber = async (versionPath: string) => {
|
||||||
if (!(await exists(buildNumberFile))) {
|
const raw = await fsp.readFile(versionPath, "utf8");
|
||||||
await fsp.writeFile(buildNumberFile, "1", "utf8");
|
const config = JSON.parse(raw);
|
||||||
return 1;
|
const current = Number.parseInt(config.build.trim(), 10);
|
||||||
}
|
|
||||||
|
|
||||||
const raw = await fsp.readFile(buildNumberFile, "utf8");
|
|
||||||
const current = Number.parseInt(raw.trim(), 10);
|
|
||||||
|
|
||||||
|
let nextBuild: string;
|
||||||
if (Number.isNaN(current) || current < 1) {
|
if (Number.isNaN(current) || current < 1) {
|
||||||
await fsp.writeFile(buildNumberFile, "1", "utf8");
|
nextBuild = "1";
|
||||||
return 1;
|
} else {
|
||||||
|
nextBuild = String(current + 1); // Incrementing the build number
|
||||||
}
|
}
|
||||||
|
|
||||||
const next = current + 1;
|
const updatedConfig = {
|
||||||
|
...config,
|
||||||
|
build: nextBuild,
|
||||||
|
lastBuildDate: format(new Date(Date.now()), "M/d/yyyy HH:mm"),
|
||||||
|
};
|
||||||
|
|
||||||
await fsp.writeFile(buildNumberFile, String(next), "utf8");
|
await fsp.writeFile(
|
||||||
|
versionPath,
|
||||||
|
JSON.stringify(updatedConfig, null, 4) + "\n",
|
||||||
|
"utf8",
|
||||||
|
);
|
||||||
|
|
||||||
// update the server with the next build number
|
return { version: config.version, build: config.build };
|
||||||
|
|
||||||
await updateAppStats({
|
|
||||||
currentBuild: next,
|
|
||||||
lastBuildAt: new Date(),
|
|
||||||
building: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
return next;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const cleanupOldBuilds = async (buildFolder: string, maxBuilds: number) => {
|
const cleanupOldBuilds = async (buildFolder: string, maxBuilds: number) => {
|
||||||
@@ -53,7 +52,8 @@ const cleanupOldBuilds = async (buildFolder: string, maxBuilds: number) => {
|
|||||||
|
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
if (!entry.isFile()) continue;
|
if (!entry.isFile()) continue;
|
||||||
if (!/^LSTV3-\d+\.zip$/i.test(entry.name)) continue;
|
//if (!/^LSTV3-\d+\.zip$/i.test(entry.name)) continue;
|
||||||
|
if (!entry.name.includes("LSTV3")) continue;
|
||||||
|
|
||||||
const fullPath = path.join(buildFolder, entry.name);
|
const fullPath = path.join(buildFolder, entry.name);
|
||||||
const stat = await fsp.stat(fullPath);
|
const stat = await fsp.stat(fullPath);
|
||||||
@@ -85,7 +85,7 @@ export const zipBuild = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const includesFile = path.join(appDir, ".includes");
|
const includesFile = path.join(appDir, ".includes");
|
||||||
const buildNumberFile = path.join(appDir, ".buildNumber");
|
const version = path.join(appDir, "package.json");
|
||||||
const buildFolder = path.join(appDir, "builds");
|
const buildFolder = path.join(appDir, "builds");
|
||||||
const tempFolder = path.join(appDir, "temp", "zip-temp");
|
const tempFolder = path.join(appDir, "temp", "zip-temp");
|
||||||
if (!(await exists(includesFile))) {
|
if (!(await exists(includesFile))) {
|
||||||
@@ -95,11 +95,13 @@ export const zipBuild = async () => {
|
|||||||
|
|
||||||
await fsp.mkdir(buildFolder, { recursive: true });
|
await fsp.mkdir(buildFolder, { recursive: true });
|
||||||
|
|
||||||
const buildNumber = await getNextBuildNumber(buildNumberFile);
|
const lstVersion = await getNextBuildNumber(version);
|
||||||
const zipFileName = `LSTV3-${buildNumber}.zip`;
|
const zipFileName = `LSTV3-${lstVersion.version}.${lstVersion.build}.zip`;
|
||||||
const zipFile = path.join(buildFolder, zipFileName);
|
const zipFile = path.join(buildFolder, zipFileName);
|
||||||
// make the folders in case they are not created already
|
// make the folders in case they are not created already
|
||||||
emitBuildLog(`Using build number: ${buildNumber}`);
|
emitBuildLog(
|
||||||
|
`Using version, build number: ${lstVersion.version}.${lstVersion.build}`,
|
||||||
|
);
|
||||||
|
|
||||||
if (await exists(tempFolder)) {
|
if (await exists(tempFolder)) {
|
||||||
await fsp.rm(tempFolder, { recursive: true, force: true });
|
await fsp.rm(tempFolder, { recursive: true, force: true });
|
||||||
@@ -170,7 +172,7 @@ export const zipBuild = async () => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
buildNumber,
|
build: lstVersion.build,
|
||||||
zipFile,
|
zipFile,
|
||||||
zipFileName,
|
zipFileName,
|
||||||
};
|
};
|
||||||
|
|||||||
224
package.json
224
package.json
@@ -1,113 +1,115 @@
|
|||||||
{
|
{
|
||||||
"name": "lst_v3",
|
"name": "lst_v3",
|
||||||
"version": "0.1.0-alpha.3",
|
"version": "0.1.0-alpha.3",
|
||||||
"description": "The tool that supports us in our everyday alplaprod",
|
"build": "175",
|
||||||
"main": "index.js",
|
"lastBuildDate": "6/17/2026 10:26",
|
||||||
"scripts": {
|
"description": "The tool that supports us in our everyday alplaprod",
|
||||||
"test": "dotenvx run -f .env -- vitest",
|
"main": "index.js",
|
||||||
"test:run": "dotenvx run -f .env -- vitest run",
|
"scripts": {
|
||||||
"dev": "concurrently -n \"server,frontend\" -c \"#007755, #1F73D1\" \"npm run dev:app\" \"npm run dev:frontend\"",
|
"test": "dotenvx run -f .env -- vitest",
|
||||||
"dev:app": "dotenvx run -f .env -- tsx watch backend/server.ts",
|
"test:run": "dotenvx run -f .env -- vitest run",
|
||||||
"dev:frontend": "cd frontend && npm run dev",
|
"dev": "concurrently -n \"server,frontend\" -c \"#007755, #1F73D1\" \"npm run dev:app\" \"npm run dev:frontend\"",
|
||||||
"dev:db:migrate": "npx drizzle-kit push",
|
"dev:app": "dotenvx run -f .env -- tsx watch backend/server.ts",
|
||||||
"dev:db:generate": "tsc && npx drizzle-kit generate --config=drizzle.config.ts",
|
"dev:frontend": "cd frontend && npm run dev",
|
||||||
"build": "rimraf dist && npm run dev:db:generate && npm run dev:db:migrate && npm run build:app && npm run build:copySql && npm run build:copyGpSql && npm run build:emailTemplate && cd frontend && npm run build",
|
"dev:db:migrate": "npx drizzle-kit push",
|
||||||
"build:app": "tsc",
|
"dev:db:generate": "tsc && npx drizzle-kit generate --config=drizzle.config.ts",
|
||||||
"agent": "powershell -ExecutionPolicy Bypass -File scripts/agentController.ps1",
|
"build": "rimraf dist && npm run dev:db:generate && npm run dev:db:migrate && npm run build:app && npm run build:copySql && npm run build:copyGpSql && npm run build:emailTemplate && cd frontend && npm run build",
|
||||||
"build:docker": "rimraf dist && npm run build:app && npm run build:copySql && npm run build:copyGpSql && npm run build:emailTemplate",
|
"build:app": "tsc",
|
||||||
"build:emailTemplate": "cpy \"backend/utils/mailViews/**/*\" dist/utils/mailViews --parents",
|
"agent": "powershell -ExecutionPolicy Bypass -File scripts/agentController.ps1",
|
||||||
"build:copyGpSql": "cpy \"backend/gpSql/queries/**/*\" dist/gpSql/queries --parents",
|
"build:docker": "rimraf dist && npm run build:app && npm run build:copySql && npm run build:copyGpSql && npm run build:emailTemplate",
|
||||||
"build:copySql": "cpy \"backend/prodSql/queries/**/*\" dist/prodSql/queries --parents",
|
"build:emailTemplate": "cpy \"backend/utils/mailViews/**/*\" dist/utils/mailViews --parents",
|
||||||
"lint": "tsc && biome lint",
|
"build:copyGpSql": "cpy \"backend/gpSql/queries/**/*\" dist/gpSql/queries --parents",
|
||||||
"start": "npm run start:server",
|
"build:copySql": "cpy \"backend/prodSql/queries/**/*\" dist/prodSql/queries --parents",
|
||||||
"start:server": "dotenvx run -f .env -- node dist/server.js",
|
"lint": "tsc && biome lint",
|
||||||
"start:docker": "node dist/server.js",
|
"start": "npm run start:server",
|
||||||
"version": "changeset version",
|
"start:server": "dotenvx run -f .env -- node dist/server.js",
|
||||||
"specCheck": "node scripts/check-route-specs.mjs",
|
"start:docker": "node dist/server.js",
|
||||||
"commit": "cz",
|
"version": "changeset version",
|
||||||
"release": "npm run build && commit-and-tag-version",
|
"specCheck": "node scripts/check-route-specs.mjs",
|
||||||
"build:apk": "cd lstMobile && expo prebuild --clean && cd android && gradlew.bat assembleRelease "
|
"commit": "cz",
|
||||||
},
|
"release": "npm run build && commit-and-tag-version",
|
||||||
"repository": {
|
"build:apk": "cd lstMobile && expo prebuild --clean && cd android && gradlew.bat assembleRelease "
|
||||||
"type": "git",
|
},
|
||||||
"url": "https://git.tuffraid.net/cowch/lst_v3.git"
|
"repository": {
|
||||||
},
|
"type": "git",
|
||||||
"keywords": [],
|
"url": "https://git.tuffraid.net/cowch/lst_v3.git"
|
||||||
"author": "",
|
},
|
||||||
"license": "ISC",
|
"keywords": [],
|
||||||
"type": "module",
|
"author": "",
|
||||||
"devDependencies": {
|
"license": "ISC",
|
||||||
"@biomejs/biome": "2.4.8",
|
"type": "module",
|
||||||
"@commitlint/cli": "^20.5.0",
|
"devDependencies": {
|
||||||
"@commitlint/config-conventional": "^20.5.0",
|
"@biomejs/biome": "2.4.8",
|
||||||
"@types/archiver": "^7.0.0",
|
"@commitlint/cli": "^20.5.0",
|
||||||
"@types/cors": "^2.8.19",
|
"@commitlint/config-conventional": "^20.5.0",
|
||||||
"@types/express": "^5.0.6",
|
"@types/archiver": "^7.0.0",
|
||||||
"@types/morgan": "^1.9.10",
|
"@types/cors": "^2.8.19",
|
||||||
"@types/mssql": "^9.1.9",
|
"@types/express": "^5.0.6",
|
||||||
"@types/multer": "^2.1.0",
|
"@types/morgan": "^1.9.10",
|
||||||
"@types/net-snmp": "^3.23.0",
|
"@types/mssql": "^9.1.9",
|
||||||
"@types/node": "^25.5.0",
|
"@types/multer": "^2.1.0",
|
||||||
"@types/nodemailer": "^7.0.11",
|
"@types/net-snmp": "^3.23.0",
|
||||||
"@types/nodemailer-express-handlebars": "^4.0.6",
|
"@types/node": "^25.5.0",
|
||||||
"@types/pg": "^8.18.0",
|
"@types/nodemailer": "^7.0.11",
|
||||||
"@types/supertest": "^7.2.0",
|
"@types/nodemailer-express-handlebars": "^4.0.6",
|
||||||
"@types/swagger-jsdoc": "^6.0.4",
|
"@types/pg": "^8.18.0",
|
||||||
"@types/swagger-ui-express": "^4.1.8",
|
"@types/supertest": "^7.2.0",
|
||||||
"commit-and-tag-version": "^12.7.1",
|
"@types/swagger-jsdoc": "^6.0.4",
|
||||||
"commitizen": "^4.3.1",
|
"@types/swagger-ui-express": "^4.1.8",
|
||||||
"cpy-cli": "^7.0.0",
|
"commit-and-tag-version": "^12.7.1",
|
||||||
"cz-conventional-changelog": "^3.3.0",
|
"commitizen": "^4.3.1",
|
||||||
"npm-check-updates": "^19.6.5",
|
"cpy-cli": "^7.0.0",
|
||||||
"openapi-types": "^12.1.3",
|
"cz-conventional-changelog": "^3.3.0",
|
||||||
"supertest": "^7.2.2",
|
"npm-check-updates": "^19.6.5",
|
||||||
"ts-node-dev": "^2.0.0",
|
"openapi-types": "^12.1.3",
|
||||||
"tsx": "^4.21.0",
|
"supertest": "^7.2.2",
|
||||||
"typescript": "^5.9.3",
|
"ts-node-dev": "^2.0.0",
|
||||||
"vitest": "^4.1.8"
|
"tsx": "^4.21.0",
|
||||||
},
|
"typescript": "^5.9.3",
|
||||||
"dependencies": {
|
"vitest": "^4.1.8"
|
||||||
"@dotenvx/dotenvx": "^1.57.0",
|
},
|
||||||
"@scalar/express-api-reference": "^0.9.20",
|
"dependencies": {
|
||||||
"@socket.io/admin-ui": "^0.5.1",
|
"@dotenvx/dotenvx": "^1.57.0",
|
||||||
"archiver": "^7.0.1",
|
"@scalar/express-api-reference": "^0.9.20",
|
||||||
"axios": "^1.13.6",
|
"@socket.io/admin-ui": "^0.5.1",
|
||||||
"bcryptjs": "^3.0.3",
|
"archiver": "^7.0.1",
|
||||||
"better-auth": "^1.5.5",
|
"axios": "^1.13.6",
|
||||||
"chokidar": "^5.0.0",
|
"bcryptjs": "^3.0.3",
|
||||||
"concurrently": "^9.2.1",
|
"better-auth": "^1.5.5",
|
||||||
"cors": "^2.8.6",
|
"chokidar": "^5.0.0",
|
||||||
"croner": "^10.0.1",
|
"concurrently": "^9.2.1",
|
||||||
"date-fns": "^4.1.0",
|
"cors": "^2.8.6",
|
||||||
"date-fns-tz": "^3.2.0",
|
"croner": "^10.0.1",
|
||||||
"drizzle-kit": "^0.31.10",
|
"date-fns": "^4.1.0",
|
||||||
"drizzle-orm": "^0.45.1",
|
"date-fns-tz": "^3.2.0",
|
||||||
"drizzle-zod": "^0.8.3",
|
"drizzle-kit": "^0.31.10",
|
||||||
"excel-date-to-js": "^1.1.5",
|
"drizzle-orm": "^0.45.1",
|
||||||
"express": "^5.2.1",
|
"drizzle-zod": "^0.8.3",
|
||||||
"husky": "^9.1.7",
|
"excel-date-to-js": "^1.1.5",
|
||||||
"ldapts": "^8.1.7",
|
"express": "^5.2.1",
|
||||||
"modbus-serial": "^8.0.25",
|
"husky": "^9.1.7",
|
||||||
"morgan": "^1.10.1",
|
"ldapts": "^8.1.7",
|
||||||
"mssql": "^12.2.1",
|
"modbus-serial": "^8.0.25",
|
||||||
"multer": "^2.1.1",
|
"morgan": "^1.10.1",
|
||||||
"net-snmp": "^3.26.1",
|
"mssql": "^12.2.1",
|
||||||
"nodemailer": "^8.0.3",
|
"multer": "^2.1.1",
|
||||||
"nodemailer-express-handlebars": "^7.0.0",
|
"net-snmp": "^3.26.1",
|
||||||
"pg": "^8.20.0",
|
"nodemailer": "^8.0.3",
|
||||||
"pino": "^10.3.1",
|
"nodemailer-express-handlebars": "^7.0.0",
|
||||||
"pino-pretty": "^13.1.3",
|
"pg": "^8.20.0",
|
||||||
"postgres": "^3.4.8",
|
"pino": "^10.3.1",
|
||||||
"powershell": "^2.3.3",
|
"pino-pretty": "^13.1.3",
|
||||||
"socket.io": "^4.8.3",
|
"postgres": "^3.4.8",
|
||||||
"socket.io-client": "^4.8.3",
|
"powershell": "^2.3.3",
|
||||||
"xlsx": "^0.18.5",
|
"socket.io": "^4.8.3",
|
||||||
"zod": "^4.3.6",
|
"socket.io-client": "^4.8.3",
|
||||||
"zod-openapi": "^6.0.0"
|
"xlsx": "^0.18.5",
|
||||||
},
|
"zod": "^4.3.6",
|
||||||
"config": {
|
"zod-openapi": "^6.0.0"
|
||||||
"commitizen": {
|
},
|
||||||
"path": "cz-conventional-changelog"
|
"config": {
|
||||||
}
|
"commitizen": {
|
||||||
}
|
"path": "cz-conventional-changelog"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,24 +31,32 @@ function Update-Server {
|
|||||||
[string]$Server,
|
[string]$Server,
|
||||||
[string]$Token
|
[string]$Token
|
||||||
)
|
)
|
||||||
$buildFile = Join-Path $AppDir ".buildNumber"
|
|
||||||
|
$buildFile = Join-Path $AppDir "package.json"
|
||||||
$BuildNumber = 1
|
$BuildNumber = 1
|
||||||
$BuildFolder = Join-Path $AppDir "builds"
|
$BuildFolder = Join-Path $AppDir "builds"
|
||||||
|
|
||||||
if (Test-Path $BuildFile) {
|
$packageJson = Get-Content $buildFile -Raw | ConvertFrom-Json
|
||||||
$content = Get-Content $BuildFile | Select-Object -First 1
|
|
||||||
$num = $content.Trim() -as [int] # safe cast
|
# Extract the .build property and cast it safely to an integer
|
||||||
|
$num = "$($packageJson.version).$(([int]$packageJson.build) -1)"
|
||||||
|
# if (Test-Path $BuildFile) {
|
||||||
|
# # Parse the entire JSON file into a PowerShell object
|
||||||
|
# $packageJson = Get-Content $buildFile -Raw | ConvertFrom-Json
|
||||||
|
|
||||||
|
# # Extract the .build property and cast it safely to an integer
|
||||||
|
# $num = "($packageJson.version).($packageJson.build)"
|
||||||
|
|
||||||
if ($num) {
|
# if ($null -ne $num) {
|
||||||
$BuildNumber = $num + 1
|
# $BuildNumber = $num + 1
|
||||||
}
|
# }
|
||||||
else {
|
# else {
|
||||||
$BuildNumber = 1
|
# $BuildNumber = 1
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
|
|
||||||
# Get The current Build we have zipped up
|
# Get The current Build we have zipped up
|
||||||
$BuildNumber = ([int]$BuildNumber - 1).ToString()
|
$BuildNumber = $num
|
||||||
|
|
||||||
|
|
||||||
# copy the latest build over
|
# copy the latest build over
|
||||||
|
|||||||
Reference in New Issue
Block a user