diff --git a/.umirc.ts b/.umirc.ts index 3f7dbc1..5ced65c 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -3,7 +3,23 @@ import { defineConfig } from '@umijs/max'; export default defineConfig({ npmClient: 'pnpm', plugins: ['@liangskyli/umijs-plugin-electron'], - electron: {}, + electron: { + builderOptions: { + appId: 'com.electron.demo.app', + productName: 'electron-demo1', + dmg: { + title: '${productName}-${version}', + artifactName: '${productName}-setup-${version}-${arch}.${ext}', + }, + nsis: { + artifactName: '${productName}-setup-${version}.${ext}', + }, + publish: { + provider: 'generic', + url: 'url', + }, + }, + }, dva: { immer: { enableES5: true, diff --git a/package.json b/package.json index 94aa9ef..e4adb10 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron-demo", - "version": "0.0.1", + "version": "0.1.0", "private": true, "scripts": { "prepare": "husky install", @@ -27,6 +27,7 @@ "dependencies": { "@umijs/max": "^4.0.81", "electron-log": "5.0.0-beta.29", + "electron-updater": "^6.1.4", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3d11805..5b523d6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ dependencies: electron-log: specifier: 5.0.0-beta.29 version: 5.0.0-beta.29 + electron-updater: + specifier: ^6.1.4 + version: 6.1.4 react: specifier: ^18.2.0 version: 18.2.0 @@ -2986,7 +2989,7 @@ packages: resolution: {integrity: sha512-hy8b7Y1J8OGe6LbAjj3xniQrj3v6lsivCcrmf4TzSgPzLkhIeKgc5IZnT7ReIqmEuodjfO8EYAuoFvIrHi/+jQ==} deprecated: This is a stub types definition. history provides its own type definitions, so you do not need this installed. dependencies: - history: 4.10.1 + history: 5.3.0 dev: false /@types/hoist-non-react-statics@3.3.1: @@ -3089,7 +3092,7 @@ packages: '@types/history': 4.7.11 '@types/react': 18.2.21 '@types/react-router': 5.1.20 - redux: 3.7.2 + redux: 4.2.1 dev: false /@types/react-router@5.1.20: @@ -4588,7 +4591,6 @@ packages: sax: 1.2.4 transitivePeerDependencies: - supports-color - dev: true /builder-util@24.5.0: resolution: {integrity: sha512-STnBmZN/M5vGcv01u/K8l+H+kplTaq4PAIn3yeuufUKSpcdro0DhJWxPI81k5XcNfC//bjM3+n9nr8F9uV4uAQ==} @@ -5512,6 +5514,21 @@ packages: /electron-to-chromium@1.4.522: resolution: {integrity: sha512-KGKjcafTpOxda0kqwQ72M0tDmX6RsGhUJTy0Hr7slt0+CgHh9Oex8JdjY9Og68dUkTLUlBOJC0A5W5Mw3QSGCg==} + /electron-updater@6.1.4: + resolution: {integrity: sha512-yYAJc6RQjjV4WtInZVn+ZcLyXRhbVXoomKEfUUwDqIk5s2wxzLhWaor7lrNgxODyODhipjg4SVPMhJHi5EnsCA==} + dependencies: + builder-util-runtime: 9.2.1 + fs-extra: 10.1.0 + js-yaml: 4.1.0 + lazy-val: 1.0.5 + lodash.escaperegexp: 4.1.2 + lodash.isequal: 4.5.0 + semver: 7.5.4 + tiny-typed-emitter: 2.1.0 + transitivePeerDependencies: + - supports-color + dev: false + /electron@26.2.1: resolution: {integrity: sha512-SNT24Cf/wRvfcFZQoERXjzswUlg5ouqhIuA2t9x2L7VdTn+2Jbs0QXRtOfzcnOV/raVMz3e8ICyaU2GGeciKLg==} engines: {node: '>= 12.20.55'} @@ -7300,7 +7317,6 @@ packages: /lazy-val@1.0.5: resolution: {integrity: sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q==} - dev: true /less@4.1.3: resolution: {integrity: sha512-w16Xk/Ta9Hhyei0Gpz9m7VS8F28nieJaL/VyShID7cYvP6IL5oHeL6p4TXSDJqZE/lNv0oJ2pGVjJsRkfwm5FA==} @@ -7491,6 +7507,14 @@ packages: /lodash.debounce@4.0.8: resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==} + /lodash.escaperegexp@4.1.2: + resolution: {integrity: sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw==} + dev: false + + /lodash.isequal@4.5.0: + resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} + dev: false + /lodash.merge@4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} @@ -10653,6 +10677,10 @@ packages: resolution: {integrity: sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw==} dev: false + /tiny-typed-emitter@2.1.0: + resolution: {integrity: sha512-qVtvMxeXbVej0cQWKqVSSAHmKZEHAvxdF8HEUBFWts8h+xEo5m/lEiPakuyZ3BnCBjOD8i24kzNOiOLLgsSxhA==} + dev: false + /tiny-warning@1.0.3: resolution: {integrity: sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==} dev: false diff --git a/src/common/logger/main.ts b/src/common/logger/main.ts index 2f5518e..42cc783 100644 --- a/src/common/logger/main.ts +++ b/src/common/logger/main.ts @@ -7,12 +7,13 @@ import path from 'path'; const mainLogger = (app: App) => { logger.initialize({ preload: true }); Object.assign(console, logger.functions); + const version = app.getVersion(); logger.errorHandler.startCatching({}); logger.transports.console.level = false; logger.transports.file.maxSize = 1024 * 1024 * 2; logger.transports.file.archiveLogFn = archiveLogFn; - logger.variables.version = '0.0.1'; // todo + logger.variables.version = version; logger.transports.file.resolvePathFn = ( variables: PathVariables, message?: LogMessage,