fix(js): update Electron build configuration and dependencies (#411)

This commit is contained in:
Haze
2026-03-11 15:40:08 +08:00
committed by GitHub
Unverified
parent a575977e3c
commit 4c786915c8
8 changed files with 20 additions and 15 deletions

View File

@@ -37,9 +37,9 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v6
with: with:
node-version: '20' node-version: '24'
- name: Setup pnpm - name: Setup pnpm
uses: pnpm/action-setup@v4 uses: pnpm/action-setup@v4

View File

@@ -100,9 +100,9 @@ dmg:
# Windows Configuration # Windows Configuration
win: win:
forceCodeSigning: false # Skip update signature verification: we ship via OSS + GitHub without a
# code-signing certificate, so verifying would always fail on the updater.
verifyUpdateCodeSignature: false verifyUpdateCodeSignature: false
signAndEditExecutable: true
extraResources: extraResources:
- from: resources/bin/win32-${arch} - from: resources/bin/win32-${arch}
to: bin to: bin

View File

@@ -44,7 +44,6 @@
"postversion": "git push && git push --tags" "postversion": "git push && git push --tags"
}, },
"dependencies": { "dependencies": {
"@wecom/wecom-openclaw-plugin": "^1.0.6",
"clawhub": "^0.5.0", "clawhub": "^0.5.0",
"electron-store": "^11.0.2", "electron-store": "^11.0.2",
"electron-updater": "^6.8.3", "electron-updater": "^6.8.3",
@@ -77,6 +76,7 @@
"@typescript-eslint/eslint-plugin": "^8.56.0", "@typescript-eslint/eslint-plugin": "^8.56.0",
"@typescript-eslint/parser": "^8.56.0", "@typescript-eslint/parser": "^8.56.0",
"@vitejs/plugin-react": "^5.1.4", "@vitejs/plugin-react": "^5.1.4",
"@wecom/wecom-openclaw-plugin": "^1.0.6",
"autoprefixer": "^10.4.24", "autoprefixer": "^10.4.24",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",
"clsx": "^2.1.1", "clsx": "^2.1.1",

6
pnpm-lock.yaml generated
View File

@@ -8,9 +8,6 @@ importers:
.: .:
dependencies: dependencies:
'@wecom/wecom-openclaw-plugin':
specifier: ^1.0.6
version: 1.0.6
clawhub: clawhub:
specifier: ^0.5.0 specifier: ^0.5.0
version: 0.5.0 version: 0.5.0
@@ -102,6 +99,9 @@ importers:
'@vitejs/plugin-react': '@vitejs/plugin-react':
specifier: ^5.1.4 specifier: ^5.1.4
version: 5.1.4(vite@7.3.1(@types/node@25.3.0)(jiti@1.21.7)(yaml@2.8.2)) version: 5.1.4(vite@7.3.1(@types/node@25.3.0)(jiti@1.21.7)(yaml@2.8.2))
'@wecom/wecom-openclaw-plugin':
specifier: ^1.0.6
version: 1.0.6
autoprefixer: autoprefixer:
specifier: ^10.4.24 specifier: ^10.4.24
version: 10.4.24(postcss@8.5.6) version: 10.4.24(postcss@8.5.6)

View File

@@ -221,7 +221,7 @@ function bundlePlugin(nodeModulesRoot, npmName, destDir) {
} }
let realPluginPath; let realPluginPath;
try { realPluginPath = realpathSync(normWin(pkgPath)); } catch { realPluginPath = pkgPath; } try { realPluginPath = realpathSync(pkgPath); } catch { realPluginPath = pkgPath; }
// Copy plugin package itself // Copy plugin package itself
if (existsSync(normWin(destDir))) rmSync(normWin(destDir), { recursive: true, force: true }); if (existsSync(normWin(destDir))) rmSync(normWin(destDir), { recursive: true, force: true });
@@ -258,7 +258,7 @@ function bundlePlugin(nodeModulesRoot, npmName, destDir) {
if (name === skipPkg) continue; if (name === skipPkg) continue;
if (SKIP_PACKAGES.has(name) || SKIP_SCOPES.some(s => name.startsWith(s))) continue; if (SKIP_PACKAGES.has(name) || SKIP_SCOPES.some(s => name.startsWith(s))) continue;
let rp; let rp;
try { rp = realpathSync(normWin(fullPath)); } catch { continue; } try { rp = realpathSync(fullPath); } catch { continue; }
if (collected.has(rp)) continue; if (collected.has(rp)) continue;
collected.set(rp, name); collected.set(rp, name);
const depVirtualNM = getVirtualStoreNodeModules(rp); const depVirtualNM = getVirtualStoreNodeModules(rp);

View File

@@ -86,7 +86,7 @@ function bundleOnePlugin({ npmName, pluginId }) {
throw new Error(`Missing dependency "${npmName}". Run pnpm install first.`); throw new Error(`Missing dependency "${npmName}". Run pnpm install first.`);
} }
const realPluginPath = fs.realpathSync(normWin(pkgPath)); const realPluginPath = fs.realpathSync(pkgPath);
const outputDir = path.join(OUTPUT_ROOT, pluginId); const outputDir = path.join(OUTPUT_ROOT, pluginId);
echo`📦 Bundling plugin ${npmName} -> ${outputDir}`; echo`📦 Bundling plugin ${npmName} -> ${outputDir}`;
@@ -126,7 +126,7 @@ function bundleOnePlugin({ npmName, pluginId }) {
let realPath; let realPath;
try { try {
realPath = fs.realpathSync(normWin(fullPath)); realPath = fs.realpathSync(fullPath);
} catch { } catch {
continue; continue;
} }

View File

@@ -38,7 +38,7 @@ if (!fs.existsSync(openclawLink)) {
process.exit(1); process.exit(1);
} }
const openclawReal = fs.realpathSync(normWin(openclawLink)); const openclawReal = fs.realpathSync(openclawLink);
echo` openclaw resolved: ${openclawReal}`; echo` openclaw resolved: ${openclawReal}`;
// 2. Clean and create output directory // 2. Clean and create output directory
@@ -152,7 +152,7 @@ while (queue.length > 0) {
let realPath; let realPath;
try { try {
realPath = fs.realpathSync(normWin(fullPath)); realPath = fs.realpathSync(fullPath);
} catch { } catch {
continue; // broken symlink, skip continue; // broken symlink, skip
} }

View File

@@ -6,6 +6,11 @@ import { resolve } from 'path';
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
// Required for Electron: all asset URLs must be relative because the renderer
// loads via file:// in production. vite-plugin-electron-renderer sets this
// automatically, but we declare it explicitly so the intent is clear and the
// build remains correct even if plugin order ever changes.
base: './',
plugins: [ plugins: [
react(), react(),
electron([ electron([
@@ -19,7 +24,7 @@ export default defineConfig({
build: { build: {
outDir: 'dist-electron/main', outDir: 'dist-electron/main',
rollupOptions: { rollupOptions: {
external: ['electron', 'electron-store', 'electron-updater', 'ws'], external: ['electron-store', 'electron-updater', 'ws'],
}, },
}, },
}, },