From 200ec975f742de8a4c7d28bdc1362dba9e15a582 Mon Sep 17 00:00:00 2001 From: Blake Matthes Date: Fri, 14 Mar 2025 09:59:53 -0500 Subject: [PATCH] ci(lst): changes to improve the build process --- package.json | 148 +++++++++++++++++------------------ server/scripts/zipUpBuild.ts | 9 ++- 2 files changed, 81 insertions(+), 76 deletions(-) diff --git a/package.json b/package.json index db7c8b0..d199dac 100644 --- a/package.json +++ b/package.json @@ -1,76 +1,76 @@ { - "name": "lstv2", - "version": "2.4.0", - "type": "module", - "scripts": { - "dev": "concurrently -n \"server,frontend\" -c \"#007755,#2f6da3\" \"npm run dev:server\" \"cd frontend && npm run dev\"", - "dev:server": "dotenvx run -f .env -- tsx watch server/index.ts", - "dev:frontend": "cd frontend && npm run dev", - "dev:dbgen": " drizzle-kit generate --config=drizzle-dev.config.ts", - "dev:dbmigrate": " drizzle-kit migrate --config=drizzle-dev.config.ts", - "build": "npm run build:server && npm run build:frontend", - "build:server": "rimraf build && tsc --build && xcopy server\\scripts dist\\server\\scripts /E /I /Y", - "build:frontend": "cd frontend && npm run build", - "start": "set NODE_ENV=production && npm run start:server", - "start:server": "dotenvx run -f .env -- node dist/server/index.js", - "db:generate": "npx drizzle-kit generate", - "db:migrate": "npx drizzle-kit push", - "deploy": "standard-version --conventional-commits && npm run zipServer", - "zipServer": " tsx server/scripts/zipUpBuild.ts \"C:\\Users\\matthes01\\Documents\\lstv2\"", - "prodBuild": "powershell -ExecutionPolicy Bypass -File server/scripts/build.ps1 -dir \"C:\\Users\\matthes01\\Documents\\lstv2", - "commit": "cz", - "prodinstall": "npm i --omit=dev && npm run db:migrate" - }, - "dependencies": { - "@dotenvx/dotenvx": "^1.38.3", - "@hono/node-server": "^1.13.8", - "@hono/zod-openapi": "^0.18.4", - "@scalar/hono-api-reference": "^0.5.175", - "@types/jsonwebtoken": "^9.0.8", - "adm-zip": "^0.5.16", - "axios": "^1.7.9", - "bcrypt": "^5.1.1", - "compression": "^1.8.0", - "cookie": "^1.0.2", - "date-fns": "^4.1.0", - "dotenv": "^16.4.7", - "drizzle-kit": "^0.30.4", - "drizzle-orm": "^0.39.3", - "drizzle-zod": "^0.7.0", - "jsonwebtoken": "^9.0.2", - "mssql": "^11.0.1", - "nodemailer": "^6.10.0", - "nodemailer-express-handlebars": "^7.0.0", - "pg": "^8.13.3", - "pino": "^9.6.0", - "pino-abstract-transport": "^2.0.0", - "pino-pretty": "^13.0.0", - "postgres": "^3.4.5", - "zod": "^3.24.2" - }, - "devDependencies": { - "@types/adm-zip": "^0.5.7", - "@types/bcrypt": "^5.0.2", - "@types/js-cookie": "^3.0.6", - "@types/mssql": "^9.1.7", - "@types/node": "^22.13.5", - "@types/pg": "^8.11.11", - "concurrently": "^8.2.0", - "cz-conventional-changelog": "^3.3.0", - "dotenv": "^16.3.1", - "rimraf": "^6.0.1", - "standard-version": "^9.5.0", - "tsx": "^4.7.1", - "typescript": "~5.7.3" - }, - "config": { - "commitizen": { - "path": "./node_modules/cz-conventional-changelog" + "name": "lstv2", + "version": "2.4.0", + "type": "module", + "scripts": { + "dev": "concurrently -n \"server,frontend\" -c \"#007755,#2f6da3\" \"npm run dev:server\" \"cd frontend && npm run dev\"", + "dev:server": "dotenvx run -f .env -- tsx watch server/index.ts", + "dev:frontend": "cd frontend && npm run dev", + "dev:dbgen": " drizzle-kit generate --config=drizzle-dev.config.ts", + "dev:dbmigrate": " drizzle-kit migrate --config=drizzle-dev.config.ts", + "build": "npm run build:server && npm run build:frontend", + "build:server": "rimraf build && tsc --build && xcopy server\\scripts dist\\server\\scripts /E /I /Y", + "build:frontend": "cd frontend && npm run build", + "start": "set NODE_ENV=production && npm run start:server", + "start:server": "dotenvx run -f .env -- node dist/server/index.js", + "db:generate": "npx drizzle-kit generate", + "db:migrate": "npx drizzle-kit push", + "deploy": "standard-version --conventional-commits && npm run prodBuild", + "zipServer": " tsx server/scripts/zipUpBuild.ts \"C:\\Users\\matthes01\\Documents\\lstv2\"", + "prodBuild": "powershell -ExecutionPolicy Bypass -File server/scripts/build.ps1 -dir \"C:\\Users\\matthes01\\Documents\\lstv2 && npm run zipServer", + "commit": "cz", + "prodinstall": "npm i --omit=dev && npm run db:migrate" + }, + "dependencies": { + "@dotenvx/dotenvx": "^1.38.3", + "@hono/node-server": "^1.13.8", + "@hono/zod-openapi": "^0.18.4", + "@scalar/hono-api-reference": "^0.5.175", + "@types/jsonwebtoken": "^9.0.8", + "adm-zip": "^0.5.16", + "axios": "^1.7.9", + "bcrypt": "^5.1.1", + "compression": "^1.8.0", + "cookie": "^1.0.2", + "date-fns": "^4.1.0", + "dotenv": "^16.4.7", + "drizzle-kit": "^0.30.4", + "drizzle-orm": "^0.39.3", + "drizzle-zod": "^0.7.0", + "jsonwebtoken": "^9.0.2", + "mssql": "^11.0.1", + "nodemailer": "^6.10.0", + "nodemailer-express-handlebars": "^7.0.0", + "pg": "^8.13.3", + "pino": "^9.6.0", + "pino-abstract-transport": "^2.0.0", + "pino-pretty": "^13.0.0", + "postgres": "^3.4.5", + "zod": "^3.24.2" + }, + "devDependencies": { + "@types/adm-zip": "^0.5.7", + "@types/bcrypt": "^5.0.2", + "@types/js-cookie": "^3.0.6", + "@types/mssql": "^9.1.7", + "@types/node": "^22.13.5", + "@types/pg": "^8.11.11", + "concurrently": "^8.2.0", + "cz-conventional-changelog": "^3.3.0", + "dotenv": "^16.3.1", + "rimraf": "^6.0.1", + "standard-version": "^9.5.0", + "tsx": "^4.7.1", + "typescript": "~5.7.3" + }, + "config": { + "commitizen": { + "path": "./node_modules/cz-conventional-changelog" + } + }, + "admConfig": { + "build": 8, + "dest": "C:\\Users\\matthes01\\Documents\\lstv2\\builds", + "src": "C:\\Users\\matthes01\\Documents\\lstv2" } - }, - "admConfig": { - "build": 8, - "dest": "C:\\Users\\matthes01\\Documents\\lstv2\\builds", - "src": "C:\\Users\\matthes01\\Documents\\lstv2" - } -} \ No newline at end of file +} diff --git a/server/scripts/zipUpBuild.ts b/server/scripts/zipUpBuild.ts index 4db1280..194f5e2 100644 --- a/server/scripts/zipUpBuild.ts +++ b/server/scripts/zipUpBuild.ts @@ -158,13 +158,18 @@ export const createZip = async (appLock: string) => { //createZip("C:\\Users\\matthes01\\Documents\\lstv2"); // Only call `createZip` if the script is executed directly -if (import.meta.url === `file://${process.argv[1]}`) { + +if (process.argv.length > 2) { const location = process.argv[2]; if (!location) { - console.error("Error: No location provided."); + createLog("error", "lst", "zipUpBuild", "Error: No location provided."); process.exit(1); + } else { + createLog("info", "lst", "zipUpBuild", "Startiing the zip process."); } createZip(location); +} else { + createLog("error", "lst", "zipUpBuild", "Error: No location provided."); }