Skip to content

Commit 28fa914

Browse files
author
huzh
committed
bump version to v24.1204.1552
1 parent aa6981c commit 28fa914

File tree

6 files changed

+221
-216
lines changed

6 files changed

+221
-216
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -14,53 +14,10 @@ on:
1414
- ".gitignore"
1515
- ".github/**"
1616
- "!.github/workflows/build.yml"
17-
1817
jobs:
19-
build-web-artifacts:
20-
runs-on: ubuntu-latest
21-
steps:
22-
- name: Checkout Code
23-
uses: actions/checkout@v3
24-
25-
- name: Setup Node.js
26-
uses: actions/setup-node@v3
27-
with:
28-
node-version: 18
29-
30-
- name: Install Dependencies
31-
run: npm install
32-
33-
- name: Build Stage Environment
34-
run: npm run build --mode stage
35-
env:
36-
NODE_ENV: staging
37-
38-
- name: Compress Stage Artifacts
39-
run: |
40-
mkdir -p artifacts/stage
41-
tar -czvf artifacts/stage/dist-stage.tar.gz -C dist .
42-
43-
- name: Build Production Environment
44-
run: npm run build --mode production
45-
env:
46-
NODE_ENV: production
47-
48-
- name: Compress Production Artifacts
49-
run: |
50-
mkdir -p artifacts/production
51-
tar -czvf artifacts/production/dist-production.tar.gz -C dist .
52-
53-
- name: Upload Web Artifacts
54-
uses: actions/upload-artifact@v3
55-
with:
56-
name: web-artifacts
57-
path: |
58-
artifacts/stage/dist-stage.tar.gz
59-
artifacts/production/dist-production.tar.gz
60-
retention-days: 5
61-
62-
build-electron-apps:
18+
build:
6319
runs-on: ${{ matrix.os }}
20+
6421
strategy:
6522
matrix:
6623
os: [macos-latest, ubuntu-latest, windows-latest]
@@ -78,34 +35,13 @@ jobs:
7835
run: npm install
7936

8037
- name: Build Release Files
81-
run: npm run build:app
38+
run: npm run build
8239
env:
8340
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8441

85-
- name: Upload Electron Artifacts
42+
- name: Upload Artifact
8643
uses: actions/upload-artifact@v3
8744
with:
88-
name: release_on_${{ matrix.os }}
45+
name: release_on_${{ matrix. os }}
8946
path: release/
9047
retention-days: 5
91-
92-
create-release:
93-
needs: [build-web-artifacts, build-electron-apps]
94-
runs-on: ubuntu-latest
95-
steps:
96-
- name: Download All Artifacts
97-
uses: actions/download-artifact@v3
98-
with:
99-
path: artifacts
100-
101-
- name: Prepare Release
102-
run: |
103-
mkdir -p release
104-
cp -r artifacts/web-artifacts/* release/
105-
cp -r artifacts/release_on_*/* release/
106-
107-
- name: Create GitHub Release
108-
uses: softprops/action-gh-release@v1
109-
with:
110-
files: |
111-
release/*

dist-electron/main/index.js

Lines changed: 39 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,57 @@
1-
import { app, BrowserWindow, ipcMain, shell } from "electron";
2-
import { createRequire } from "node:module";
3-
import { fileURLToPath } from "node:url";
4-
import path from "node:path";
5-
import os from "node:os";
6-
createRequire(import.meta.url);
7-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
8-
process.env.APP_ROOT = path.join(__dirname, "../..");
9-
const MAIN_DIST = path.join(process.env.APP_ROOT, "dist-electron");
10-
const RENDERER_DIST = path.join(process.env.APP_ROOT, "dist");
11-
const VITE_DEV_SERVER_URL = process.env.VITE_DEV_SERVER_URL;
12-
process.env.VITE_PUBLIC = VITE_DEV_SERVER_URL ? path.join(process.env.APP_ROOT, "public") : RENDERER_DIST;
13-
if (os.release().startsWith("6.1")) app.disableHardwareAcceleration();
14-
if (process.platform === "win32") app.setAppUserModelId(app.getName());
15-
if (!app.requestSingleInstanceLock()) {
16-
app.quit();
17-
process.exit(0);
18-
}
19-
let win = null;
20-
const preload = path.join(__dirname, "../preload/index.mjs");
21-
const indexHtml = path.join(RENDERER_DIST, "index.html");
22-
async function createWindow() {
23-
win = new BrowserWindow({
1+
import { app as n, BrowserWindow as s, ipcMain as m, shell as w } from "electron";
2+
import { createRequire as R } from "node:module";
3+
import { fileURLToPath as _ } from "node:url";
4+
import o from "node:path";
5+
import h from "node:os";
6+
R(import.meta.url);
7+
const l = o.dirname(_(import.meta.url));
8+
process.env.APP_ROOT = o.join(l, "../..");
9+
const v = o.join(process.env.APP_ROOT, "dist-electron"), c = o.join(process.env.APP_ROOT, "dist"), t = process.env.VITE_DEV_SERVER_URL;
10+
process.env.VITE_PUBLIC = t ? o.join(process.env.APP_ROOT, "public") : c;
11+
h.release().startsWith("6.1") && n.disableHardwareAcceleration();
12+
process.platform === "win32" && n.setAppUserModelId(n.getName());
13+
n.requestSingleInstanceLock() || (n.quit(), process.exit(0));
14+
let e = null;
15+
const d = o.join(l, "../preload/index.mjs"), p = o.join(c, "index.html");
16+
async function f() {
17+
e = new s({
2418
title: "Main window",
25-
icon: path.join(process.env.VITE_PUBLIC ?? "", "favicon.ico"),
19+
icon: o.join(process.env.VITE_PUBLIC ?? "", "favicon.ico"),
2620
webPreferences: {
27-
preload
21+
preload: d
2822
// Warning: Enable nodeIntegration and disable contextIsolation is not secure in production
2923
// nodeIntegration: true,
3024
// Consider using contextBridge.exposeInMainWorld
3125
// Read more on https://www.electronjs.org/docs/latest/tutorial/context-isolation
3226
// contextIsolation: false,
3327
}
34-
});
35-
if (VITE_DEV_SERVER_URL) {
36-
win.loadURL(VITE_DEV_SERVER_URL);
37-
win.webContents.openDevTools();
38-
} else {
39-
win.loadFile(indexHtml);
40-
}
41-
win.webContents.on("did-finish-load", () => {
42-
win == null ? void 0 : win.webContents.send("main-process-message", (/* @__PURE__ */ new Date()).toLocaleString());
43-
});
44-
win.webContents.setWindowOpenHandler(({ url }) => {
45-
if (url.startsWith("https:")) shell.openExternal(url);
46-
return { action: "deny" };
47-
});
28+
}), t ? (e.loadURL(t), e.webContents.openDevTools()) : e.loadFile(p), e.webContents.on("did-finish-load", () => {
29+
e == null || e.webContents.send("main-process-message", (/* @__PURE__ */ new Date()).toLocaleString());
30+
}), e.webContents.setWindowOpenHandler(({ url: i }) => (i.startsWith("https:") && w.openExternal(i), { action: "deny" }));
4831
}
49-
app.whenReady().then(createWindow);
50-
app.on("window-all-closed", () => {
51-
win = null;
52-
if (process.platform !== "darwin") app.quit();
32+
n.whenReady().then(f);
33+
n.on("window-all-closed", () => {
34+
e = null, process.platform !== "darwin" && n.quit();
5335
});
54-
app.on("second-instance", () => {
55-
if (win) {
56-
if (win.isMinimized()) win.restore();
57-
win.focus();
58-
}
36+
n.on("second-instance", () => {
37+
e && (e.isMinimized() && e.restore(), e.focus());
5938
});
60-
app.on("activate", () => {
61-
const allWindows = BrowserWindow.getAllWindows();
62-
if (allWindows.length) {
63-
allWindows[0].focus();
64-
} else {
65-
createWindow();
66-
}
39+
n.on("activate", () => {
40+
const i = s.getAllWindows();
41+
i.length ? i[0].focus() : f();
6742
});
68-
ipcMain.handle("open-win", (_, arg) => {
69-
const childWindow = new BrowserWindow({
43+
m.handle("open-win", (i, r) => {
44+
const a = new s({
7045
webPreferences: {
71-
preload,
72-
nodeIntegration: true,
73-
contextIsolation: false
46+
preload: d,
47+
nodeIntegration: !0,
48+
contextIsolation: !1
7449
}
7550
});
76-
if (VITE_DEV_SERVER_URL) {
77-
childWindow.loadURL(`${VITE_DEV_SERVER_URL}#${arg}`);
78-
} else {
79-
childWindow.loadFile(indexHtml, { hash: arg });
80-
}
51+
t ? a.loadURL(`${t}#${r}`) : a.loadFile(p, { hash: r });
8152
});
8253
export {
83-
MAIN_DIST,
84-
RENDERER_DIST,
85-
VITE_DEV_SERVER_URL
54+
v as MAIN_DIST,
55+
c as RENDERER_DIST,
56+
t as VITE_DEV_SERVER_URL
8657
};
87-
//# sourceMappingURL=index.js.map

dist-electron/main/index.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)