2 Commits
v1.0.0 ... main

Author SHA1 Message Date
3d7512ab79 add build commands 2024-01-09 13:38:48 +01:00
ad2b590281 feat: add logging 2024-01-09 11:51:26 +01:00
3 changed files with 228 additions and 2110 deletions

2314
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -15,9 +15,11 @@
"dev": "electron-vite dev", "dev": "electron-vite dev",
"build": "npm run typecheck && electron-vite build", "build": "npm run typecheck && electron-vite build",
"postinstall": "electron-builder install-app-deps", "postinstall": "electron-builder install-app-deps",
"build:win": "npm run build && electron-builder --win --config --x64", "build:win": "electron-builder --win --config --x64",
"build:mac": "electron-vite build && electron-builder --mac --config --universal", "build:mac": "electron-builder --mac --config --x64",
"build:linux": "electron-vite build && electron-builder --linux --config --x64" "build:mac:arm": "electron-builder --mac --config --arm64",
"build:linux": "electron-builder --linux --config --x64",
"build:all": "npm run build && npm run build:win && npm run build:mac && npm run build:mac:arm && npm run build:linux"
}, },
"dependencies": { "dependencies": {
"@electron-toolkit/preload": "^2.0.0", "@electron-toolkit/preload": "^2.0.0",
@@ -25,9 +27,10 @@
"@fontsource/roboto": "^5.0.8", "@fontsource/roboto": "^5.0.8",
"@it-incubator/md-bundler": "0.0.10", "@it-incubator/md-bundler": "0.0.10",
"@it-incubator/mdx-components": "0.0.11", "@it-incubator/mdx-components": "0.0.11",
"@it-incubator/ui-kit": "0.2.20", "@it-incubator/ui-kit": "0.2.24",
"builtin-modules": "^3.3.0", "builtin-modules": "^3.3.0",
"chokidar": "^3.5.3", "chokidar": "^3.5.3",
"electron-log": "^5.0.3",
"electron-store": "^8.1.0", "electron-store": "^8.1.0",
"electron-updater": "^6.1.4", "electron-updater": "^6.1.4",
"esbuild": "^0.19.5", "esbuild": "^0.19.5",

View File

@@ -2,6 +2,7 @@ import fs from 'fs'
import { is } from '@electron-toolkit/utils' import { is } from '@electron-toolkit/utils'
import { BrowserWindow, app, ipcMain } from 'electron' import { BrowserWindow, app, ipcMain } from 'electron'
import log from 'electron-log/main'
import { bundleMdxAndSend } from './bundle-mdx-and-send' import { bundleMdxAndSend } from './bundle-mdx-and-send'
import { handleAppReady } from './handlers/handle-app-ready' import { handleAppReady } from './handlers/handle-app-ready'
@@ -10,6 +11,11 @@ import { prepareAndSendDir } from './prepare-and-send-dir'
import { setupWatcher } from './setup-watcher' import { setupWatcher } from './setup-watcher'
import { store } from './store' import { store } from './store'
// Optional, initialize the logger for any renderer process
log.initialize()
log.info('Log from the main process')
let mainWindow: BrowserWindow | null = null let mainWindow: BrowserWindow | null = null
function setMainWindow(win: BrowserWindow) { function setMainWindow(win: BrowserWindow) {
@@ -89,9 +95,12 @@ ipcMain.on('open-file', (_event, filePath) => {
process process
.on('unhandledRejection', (reason, p) => { .on('unhandledRejection', (reason, p) => {
console.error(reason, 'Unhandled Rejection at Promise', p) log.error('Unhandled Rejection at Promise', reason, p)
console.error('Unhandled Rejection at Promise', reason, p)
}) })
.on('uncaughtException', err => { .on('uncaughtException', err => {
log.error('Uncaught Exception', err)
// https://github.com/paulmillr/chokidar/issues/566 // https://github.com/paulmillr/chokidar/issues/566
// this has been open for over 7 years, still hasn't been fixed. // this has been open for over 7 years, still hasn't been fixed.
// for some reason it doesn't even go into the chokidar error handler, so had to do it here // for some reason it doesn't even go into the chokidar error handler, so had to do it here
@@ -107,3 +116,5 @@ process
process.exit(1) process.exit(1)
} }
}) })
log.errorHandler.startCatching()