feat: add electron app.

This commit is contained in:
jaywcjlove
2022-09-04 22:09:04 +08:00
parent a66e906eef
commit 76a6f48d0a
62 changed files with 483 additions and 98 deletions

2
electron/app/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
dist
website

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
</dict>
</plist>

35
electron/app/config.json Normal file
View File

@@ -0,0 +1,35 @@
{
"productName": "wxmp",
"appId": "com.wangchujiang.wxmp",
"asar": true,
"directories": {
"output": "dist"
},
"mac": {
"icon": "tools.icns",
"target": {
"target": "default",
"arch": ["arm64", "x64"]
},
"category": "public.app-category.developer-tools",
"type": "distribution",
"entitlements": "assets/entitlements.mac.plist",
"entitlementsInherit": "assets/entitlements.mac.plist"
},
"linux": {
"icon": "tools.icns",
"description": "微信公众号 Markdown 编辑器",
"category": "Development",
"target": ["deb", "rpm"],
"desktop": {
"Name": "Web Tools"
}
},
"win": {
"icon": "tools.ico",
"target": {
"target": "nsis",
"arch": ["x64", "ia32"]
}
}
}

BIN
electron/app/icon.icns Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

BIN
electron/app/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

15
electron/app/main.js Normal file
View File

@@ -0,0 +1,15 @@
const path = require('path');
const { App } = require('@wcj/wxmp-main');
(async () => {
const options = {};
if (process.env.NODE_ENV === 'development') {
options.preload = require.resolve('@wcj/wxmp-preload');
options.webpath = require.resolve('website/build/index.html');
} else {
options.preload = path.resolve(__dirname, 'website/index.js');
options.webpath = 'website/index.html';
}
const app = new App();
await app.createWindow(options);
})();

30
electron/app/package.json Normal file
View File

@@ -0,0 +1,30 @@
{
"name": "wxmp",
"description": "微信公众号 Markdown 编辑器",
"homepage": "https://github.com/jaywcjlove/wxmp.git",
"version": "2.1.0",
"main": "main.js",
"author": "Kenny Wong <398188662@qq.com>",
"private": true,
"scripts": {
"deps": "electron-builder install-app-deps",
"start": "cross-env NODE_ENV=development ELECTRON_DISABLE_SECURITY_WARNINGS=true electron .",
"start:production": "cross-env NODE_ENV=production ELECTRON_DISABLE_SECURITY_WARNINGS=true electron .",
"dist-win32": "electron-builder --win --ia32 --config config.json",
"dist-win64": "electron-builder --win --x64 --config config.json",
"dist-mac": "electron-builder --mac --universal --config config.json",
"dist-linux": "electron-builder --linux --config config.json",
"copy": "cpy './node_modules/@wcj/wxmp-preload/lib/*.js' './node_modules/website/build/**' website",
"build": "npm run copy && cross-env NODE_ENV=production electron-builder build --publish=never --config config.json"
},
"dependencies": {
"@wcj/wxmp-main": "2.1.0"
},
"devDependencies": {
"@wcj/wxmp-preload": "2.1.0",
"cpy-cli": "4.1.0",
"electron": "19.0.5",
"electron-builder": "23.1.0",
"website": "2.1.0"
}
}