feat: add electron app.
2
electron/app/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
dist
|
||||
website
|
||||
8
electron/app/assets/entitlements.mac.plist
Normal 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
@@ -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
BIN
electron/app/icons.iconset/icon_128x128.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
electron/app/icons.iconset/icon_128x128@2x.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
electron/app/icons.iconset/icon_16x16.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
electron/app/icons.iconset/icon_16x16@2x.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
electron/app/icons.iconset/icon_256x256.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
electron/app/icons.iconset/icon_256x256@2x.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
BIN
electron/app/icons.iconset/icon_32x32.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
electron/app/icons.iconset/icon_32x32@2x.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
electron/app/icons.iconset/icon_512x512.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
BIN
electron/app/icons.iconset/icon_512x512@2x.png
Normal file
|
After Width: | Height: | Size: 275 KiB |
BIN
electron/app/logo.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
15
electron/app/main.js
Normal 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
@@ -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"
|
||||
}
|
||||
}
|
||||