Updates for packaging.

This commit is contained in:
Patrick Fic
2025-03-24 08:28:11 -07:00
parent a814326aa3
commit 4462cefb54
3 changed files with 26 additions and 21 deletions

View File

@@ -13,6 +13,7 @@ asarUnpack:
- resources/** - resources/**
win: win:
executableName: bodyshop-desktop executableName: bodyshop-desktop
nsis: nsis:
artifactName: ${name}-${version}-setup.${ext} artifactName: ${name}-${version}-setup.${ext}
shortcutName: ${productName} shortcutName: ${productName}
@@ -26,7 +27,7 @@ mac:
- NSMicrophoneUsageDescription: Application requests access to the device's microphone. - NSMicrophoneUsageDescription: Application requests access to the device's microphone.
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder. - NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder. - NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
notarize: false
dmg: dmg:
artifactName: ${name}-${version}.${ext} artifactName: ${name}-${version}.${ext}
linux: linux:
@@ -41,7 +42,7 @@ appImage:
npmRebuild: false npmRebuild: false
publish: publish:
provider: s3 provider: s3
bucket: bodyshop-desktop-updater bucket: imex-partner
region: ca-central-1 region: ca-central-1
electronDownload: electronDownload:
mirror: https://npmmirror.com/mirrors/electron/ mirror: https://npmmirror.com/mirrors/electron/

View File

@@ -135,27 +135,25 @@ async function ImportJob(filepath: string): Promise<void> {
delete jobObject.clmt_ph2; delete jobObject.clmt_ph2;
delete jobObject.clmt_ea; delete jobObject.clmt_ea;
// Save jobObject to a timestamped JSON file if (import.meta.env.DEV) {
const timestamp = new Date() // Save jobObject to a timestamped JSON file
.toISOString() const timestamp = new Date()
.replace(/:/g, "-") .toISOString()
.replace(/\..+/, ""); .replace(/:/g, "-")
const fileName = `job_${timestamp}_${parsedFilePath.name}.json`; .replace(/\..+/, "");
const logsDir = path.join(process.cwd(), "logs"); const fileName = `job_${timestamp}_${parsedFilePath.name}.json`;
const logsDir = path.join(process.cwd(), "logs");
// Create logs directory if it doesn't exist // Create logs directory if it doesn't exist
if (!fs.existsSync(logsDir)) { if (!fs.existsSync(logsDir)) {
fs.mkdirSync(logsDir, { recursive: true }); fs.mkdirSync(logsDir, { recursive: true });
}
const filePath = path.join(logsDir, fileName);
fs.writeFileSync(filePath, JSON.stringify(jobObject, null, 2), "utf8");
log.info(`Job data saved to: ${filePath}`);
} }
const filePath = path.join(logsDir, fileName);
fs.writeFileSync(filePath, JSON.stringify(jobObject, null, 2), "utf8");
log.info(`Job data saved to: ${filePath}`);
log.debug("Job Object", {
jobObject,
});
const newAvailableJob: AvailableJobSchema = { const newAvailableJob: AvailableJobSchema = {
uploaded_by: store.get("user.email"), uploaded_by: store.get("user.email"),
bodyshopid: store.get("app.bodyshop.id"), bodyshopid: store.get("app.bodyshop.id"),
@@ -183,7 +181,7 @@ async function ImportJob(filepath: string): Promise<void> {
newAvailableJob.est_data.vehicleid = existingVehicleRecord.vehicles[0].id; newAvailableJob.est_data.vehicleid = existingVehicleRecord.vehicles[0].id;
} }
console.log(newAvailableJob); console.log("Available Job record to upload;", newAvailableJob);
const existingJobRecord: QueryJobByClmNoResult = await client.request( const existingJobRecord: QueryJobByClmNoResult = await client.request(
QUERY_JOB_BY_CLM_NO_TYPED, QUERY_JOB_BY_CLM_NO_TYPED,

View File

@@ -6,6 +6,7 @@ import icon from "../../resources/icon.png?asset";
import ErrorTypeCheck from "../util/errorTypeCheck"; import ErrorTypeCheck from "../util/errorTypeCheck";
import client from "./graphql/graphql-client"; import client from "./graphql/graphql-client";
import store from "./store/store"; import store from "./store/store";
import { autoUpdater } from "electron-updater";
log.initialize(); log.initialize();
const isMac = process.platform === "darwin"; const isMac = process.platform === "darwin";
@@ -247,6 +248,11 @@ app.whenReady().then(async () => {
}); });
} }
//Check for app updates.
autoUpdater.logger = log;
autoUpdater.checkForUpdatesAndNotify();
createWindow(); createWindow();
app.on("activate", function () { app.on("activate", function () {