Skip to content

Commit

Permalink
feat: log add version
Browse files Browse the repository at this point in the history
  • Loading branch information
liangskyli committed Sep 24, 2023
1 parent 1d1e0ae commit 6eade52
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 7 deletions.
18 changes: 17 additions & 1 deletion .umirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electron-demo",
"version": "0.0.1",
"version": "0.1.0",
"private": true,
"scripts": {
"prepare": "husky install",
Expand All @@ -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"
},
Expand Down
36 changes: 32 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/common/logger/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6eade52

Please sign in to comment.