From 4c786915c8d252a179ce0f6b9f2e9a949a7b465d Mon Sep 17 00:00:00 2001 From: Haze <709547807@qq.com> Date: Wed, 11 Mar 2026 15:40:08 +0800 Subject: [PATCH] fix(js): update Electron build configuration and dependencies (#411) --- .github/workflows/release.yml | 4 ++-- electron-builder.yml | 4 ++-- package.json | 2 +- pnpm-lock.yaml | 6 +++--- scripts/after-pack.cjs | 4 ++-- scripts/bundle-openclaw-plugins.mjs | 4 ++-- scripts/bundle-openclaw.mjs | 4 ++-- vite.config.ts | 7 ++++++- 8 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 93390e283..5984fd843 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,9 +37,9 @@ jobs: fetch-depth: 0 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: '20' + node-version: '24' - name: Setup pnpm uses: pnpm/action-setup@v4 diff --git a/electron-builder.yml b/electron-builder.yml index a0aee3610..4ad359851 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -100,9 +100,9 @@ dmg: # Windows Configuration 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 - signAndEditExecutable: true extraResources: - from: resources/bin/win32-${arch} to: bin diff --git a/package.json b/package.json index 105231b6c..5acfdb701 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "postversion": "git push && git push --tags" }, "dependencies": { - "@wecom/wecom-openclaw-plugin": "^1.0.6", "clawhub": "^0.5.0", "electron-store": "^11.0.2", "electron-updater": "^6.8.3", @@ -77,6 +76,7 @@ "@typescript-eslint/eslint-plugin": "^8.56.0", "@typescript-eslint/parser": "^8.56.0", "@vitejs/plugin-react": "^5.1.4", + "@wecom/wecom-openclaw-plugin": "^1.0.6", "autoprefixer": "^10.4.24", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9ac2a393e..83c5a0309 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,9 +8,6 @@ importers: .: dependencies: - '@wecom/wecom-openclaw-plugin': - specifier: ^1.0.6 - version: 1.0.6 clawhub: specifier: ^0.5.0 version: 0.5.0 @@ -102,6 +99,9 @@ importers: '@vitejs/plugin-react': 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)) + '@wecom/wecom-openclaw-plugin': + specifier: ^1.0.6 + version: 1.0.6 autoprefixer: specifier: ^10.4.24 version: 10.4.24(postcss@8.5.6) diff --git a/scripts/after-pack.cjs b/scripts/after-pack.cjs index 3446d291f..eb97cd159 100644 --- a/scripts/after-pack.cjs +++ b/scripts/after-pack.cjs @@ -221,7 +221,7 @@ function bundlePlugin(nodeModulesRoot, npmName, destDir) { } let realPluginPath; - try { realPluginPath = realpathSync(normWin(pkgPath)); } catch { realPluginPath = pkgPath; } + try { realPluginPath = realpathSync(pkgPath); } catch { realPluginPath = pkgPath; } // Copy plugin package itself 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 (SKIP_PACKAGES.has(name) || SKIP_SCOPES.some(s => name.startsWith(s))) continue; let rp; - try { rp = realpathSync(normWin(fullPath)); } catch { continue; } + try { rp = realpathSync(fullPath); } catch { continue; } if (collected.has(rp)) continue; collected.set(rp, name); const depVirtualNM = getVirtualStoreNodeModules(rp); diff --git a/scripts/bundle-openclaw-plugins.mjs b/scripts/bundle-openclaw-plugins.mjs index ad4fa6318..1d3412cf1 100644 --- a/scripts/bundle-openclaw-plugins.mjs +++ b/scripts/bundle-openclaw-plugins.mjs @@ -86,7 +86,7 @@ function bundleOnePlugin({ npmName, pluginId }) { 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); echo`📦 Bundling plugin ${npmName} -> ${outputDir}`; @@ -126,7 +126,7 @@ function bundleOnePlugin({ npmName, pluginId }) { let realPath; try { - realPath = fs.realpathSync(normWin(fullPath)); + realPath = fs.realpathSync(fullPath); } catch { continue; } diff --git a/scripts/bundle-openclaw.mjs b/scripts/bundle-openclaw.mjs index 030cd43c2..a119853a3 100644 --- a/scripts/bundle-openclaw.mjs +++ b/scripts/bundle-openclaw.mjs @@ -38,7 +38,7 @@ if (!fs.existsSync(openclawLink)) { process.exit(1); } -const openclawReal = fs.realpathSync(normWin(openclawLink)); +const openclawReal = fs.realpathSync(openclawLink); echo` openclaw resolved: ${openclawReal}`; // 2. Clean and create output directory @@ -152,7 +152,7 @@ while (queue.length > 0) { let realPath; try { - realPath = fs.realpathSync(normWin(fullPath)); + realPath = fs.realpathSync(fullPath); } catch { continue; // broken symlink, skip } diff --git a/vite.config.ts b/vite.config.ts index f06d78a57..8b712c8f2 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,6 +6,11 @@ import { resolve } from 'path'; // https://vitejs.dev/config/ 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: [ react(), electron([ @@ -19,7 +24,7 @@ export default defineConfig({ build: { outDir: 'dist-electron/main', rollupOptions: { - external: ['electron', 'electron-store', 'electron-updater', 'ws'], + external: ['electron-store', 'electron-updater', 'ws'], }, }, },