Skip to content

Commit

Permalink
electron-builder 4 win admin
Browse files Browse the repository at this point in the history
  • Loading branch information
tanzheng committed Dec 6, 2022
1 parent 1bcef2c commit 4704587
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 91 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules/
out/
package-lock.json
build/
package-lock.json
yarn.lock
yarn-error.log
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@ English | [简体中文](./README_zh.md)
```
node v16.17.0
npm 8.15.0
electron 20.1.4
electron-rebuild ^3.2.9
electron node 16.15.0
yarn 1.22.19
electron 22.0.0
electron node 16.17.1
```

## Installation

```
npm install
yarn install
```

## Start

```
npm start
yarn start
```

## Package

```
npm make
yarn dist
./out/make/.../* setup.exe
./build/* setup *.exe
```

## API Reference
Expand All @@ -61,7 +61,7 @@ npm make

|Environment|Test|
|:-:|:-:|
|Win 10|Yes|
|Win 10 x64|Yes|

## License

Expand Down
16 changes: 8 additions & 8 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@
```
node v16.17.0
npm 8.15.0
electron 20.1.4
electron-rebuild ^3.2.9
electron node 16.15.0
yarn 1.22.19
electron 22.0.0
electron node 16.17.1
```

## 安装

```
npm install
yarn install
```

## 运行

```
npm start
yarn start
```

## 打包

```
npm make
yarn dist
./out/make/.../* setup.exe
./build/* setup *.exe
```

## 接口文档
Expand All @@ -61,7 +61,7 @@ npm make

|环境|测试|
|:-:|:-:|
|Win 10|Yes|
|Win 10 x64|Yes|

## 许可

Expand Down
36 changes: 0 additions & 36 deletions forge.config.js

This file was deleted.

18 changes: 2 additions & 16 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
if(require('electron-squirrel-startup')) return;

// var sudo = require('sudo-prompt');
// var options = {
// name: 'MathLabTool'
// };
// sudo.exec('echo hello', options,
// function(error, stdout, stderr) {
// if (error) throw error;
// console.log('stdout: ' + stdout);
// }
// );

const { app, BrowserWindow, Menu, ipcMain } = require('electron')
const { exec } = require('child_process')
const path = require('path')
const fs = require('fs')
const mlt_addon = require('./addon/mathlabtool')
// console.log(mlt_addon.getNApiInfo())
// const { SerialPort } = require('serialport')
// const iconv = require("iconv-lite")
const { auth_code } = require('./src/authorization_code')
console.log(auth_code);
// console.log(auth_code);

// console.log('process.versions.electron', process.versions.electron)
// console.log('process.versions.node', process.versions.node)
Expand Down Expand Up @@ -90,7 +76,6 @@ function fileDisplay(filePath, handle, tree_parent, filename) {
// console.log(ports);
// event.reply('pong', 'whaaaaaaaa');
// if(ports[0]){
// var utfstr_friendlyName = iconv.decode(Buffer.from(ports[0]['friendlyName']), 'gb2312')
// console.log('中文', utfstr_friendlyName);
// event.reply('pong', '中文');
// }
Expand Down Expand Up @@ -122,6 +107,7 @@ ipcMain.on("ping", (event, arg) => {
var msg_array = arg.split('|');
if(msg_array[0] == 'page_handle') {
page_handle = event;
page_handle.sender.send('pong', 'page_console_log|' + auth_code);
} else if(msg_array[0] == 'get_dir') {
if(msg_array[1] == 'MyComputer') {
get_dir_root(event, msg_array[1]);
Expand Down
54 changes: 33 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
{
"name": "MathLabTool",
"version": "1.0.0",
"description": "math,lab,tool.",
"description": "MathLabTool",
"main": "main.js",
"scripts": {
"start": "electron-forge start",
"test": "echo \"Error: no test specified\" && exit 1",
"package": "electron-forge package",
"make": "electron-forge make"
"start": "electron main.js",
"dist": "electron-builder"
},
"repository": "https://github.com/xxyjskx1987/MathLabTool",
"author": "xxyjskx1987",
"license": "ISC",
"dependencies": {
"electron-squirrel-startup": "^1.0.0",
"iconv-lite": "^0.6.3",
"serialport": "^10.4.0",
"sudo-prompt": "^9.2.1"
},
"license": "GPL-3.0",
"devDependencies": {
"@electron-forge/cli": "^6.0.0-beta.66",
"@electron-forge/maker-deb": "^6.0.0-beta.66",
"@electron-forge/maker-rpm": "^6.0.0-beta.66",
"@electron-forge/maker-squirrel": "^6.0.0-beta.66",
"@electron-forge/maker-zip": "^6.0.0-beta.66",
"electron": "20.1.4",
"electron-rebuild": "^3.2.9"
"electron": "^22.0.0",
"electron-builder": "^23.6.0"
},
"config": {
"forge": "./forge.config.js"
"build": {
"productName":"MathLabTool",
"appId": "com.xxyjskx1987.MathLabTool",
"copyright":"© 2022 MathLabTool",
"directories": {
"output": "build"
},
"nsis": {
"oneClick": false,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"createDesktopShortcut": true,
"createStartMenuShortcut": true
},
"win": {
"requestedExecutionLevel": "requireAdministrator",
"icon": "public/icon/mathlabtool.ico",
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
}
]
}
}
}

0 comments on commit 4704587

Please sign in to comment.