Skip to content

Commit 9feeace

Browse files
committed
fix: disable asar to fix electron-forge packaging failure
- Disabled asar packaging due to silent failure in electron-packager - Added generateAssets hook to download IPFS/Kubo binaries before packaging - Added ignore patterns for kubo symlinks and .bin directories that cause build failures - Simplified CI workflow with proper pipefail handling - Removed legacy electron-builder config from package.json - Added glob and progress dependencies needed for hooks The asar creation was silently failing due to issues with symlinks in node_modules. With asar disabled, the app bundle is larger but packaging completes successfully.
1 parent a61a8fd commit 9feeace

4 files changed

Lines changed: 67 additions & 137 deletions

File tree

.github/workflows/test.yml

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,11 @@ jobs:
6363
6464
- name: Package Electron App
6565
timeout-minutes: 30
66-
env:
67-
DEBUG: "electron-forge:*,electron-packager"
6866
run: |
69-
echo "=== Running electron-forge package with DEBUG ==="
70-
yarn electron-forge package 2>&1 | tee forge-output.log || {
71-
echo "=== electron-forge FAILED ==="
72-
echo "=== Last 100 lines of output ==="
73-
tail -100 forge-output.log
74-
echo "=== Checking temp directories ==="
75-
find /tmp -maxdepth 3 -name "*electron*" -type d 2>/dev/null || true
76-
exit 1
77-
}
78-
echo "=== electron-forge completed ==="
79-
ls -la out/ || {
80-
echo "=== out/ not found ==="
81-
echo "=== Full forge output ==="
82-
cat forge-output.log
83-
exit 1
84-
}
67+
set -o pipefail
68+
yarn electron-forge package 2>&1 | tee forge-output.log
69+
echo "=== Checking out/ directory ==="
70+
ls -la out/
8571
8672
- name: Smoke Test
8773
run: |
@@ -139,15 +125,10 @@ jobs:
139125
140126
- name: Package Electron App
141127
timeout-minutes: 30
142-
env:
143-
DEBUG: "electron-forge:*,electron-packager"
144128
run: |
145-
yarn electron-forge package 2>&1 | tee forge-output.log || {
146-
echo "=== FAILED - Last 100 lines ==="
147-
tail -100 forge-output.log
148-
exit 1
149-
}
150-
ls -la out/ || { cat forge-output.log; exit 1; }
129+
set -o pipefail
130+
yarn electron-forge package 2>&1 | tee forge-output.log
131+
ls -la out/
151132
152133
- name: Smoke Test
153134
run: |
@@ -205,15 +186,10 @@ jobs:
205186
206187
- name: Package Electron App
207188
timeout-minutes: 30
208-
env:
209-
DEBUG: "electron-forge:*,electron-packager"
210189
run: |
211-
yarn electron-forge package 2>&1 | tee forge-output.log || {
212-
echo "=== FAILED - Last 100 lines ==="
213-
tail -100 forge-output.log
214-
exit 1
215-
}
216-
ls -la out/ || { cat forge-output.log; exit 1; }
190+
set -o pipefail
191+
yarn electron-forge package 2>&1 | tee forge-output.log
192+
ls -la out/
217193
218194
- name: Smoke Test
219195
run: |
@@ -273,15 +249,10 @@ jobs:
273249
- name: Package Electron App
274250
shell: bash
275251
timeout-minutes: 30
276-
env:
277-
DEBUG: "electron-forge:*,electron-packager"
278252
run: |
279-
yarn electron-forge package 2>&1 | tee forge-output.log || {
280-
echo "=== FAILED - Last 100 lines ==="
281-
tail -100 forge-output.log
282-
exit 1
283-
}
284-
ls -la out/ || { cat forge-output.log; exit 1; }
253+
set -o pipefail
254+
yarn electron-forge package 2>&1 | tee forge-output.log
255+
ls -la out/
285256
286257
- name: Smoke Test
287258
shell: bash

forge.config.js

Lines changed: 48 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,72 @@
1-
import { fileURLToPath } from 'url';
2-
import { dirname, join } from 'path';
3-
import fs from 'fs';
4-
5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = dirname(__filename);
7-
8-
// Read package.json to get app metadata
9-
const packageJson = JSON.parse(fs.readFileSync(join(__dirname, 'package.json'), 'utf-8'));
1+
import { downloadIpfsClients } from './electron/before-pack.js';
102

113
const config = {
124
packagerConfig: {
13-
name: packageJson.build?.productName || packageJson.name,
14-
executableName: packageJson.build?.mac?.executableName || packageJson.build?.win?.executableName || packageJson.build?.linux?.executableName || packageJson.name,
5+
name: 'seedit',
6+
executableName: 'seedit',
157
appBundleId: 'seedit.desktop',
168

17-
// Unpack native modules and kubo binary from ASAR so they can be executed
18-
asar: {
19-
unpack: '{*.node,*.dll,*.dylib,*.so,**/kubo/bin/**,**/kubo/kubo/**}',
20-
},
9+
// NOTE: asar is disabled because of a bug where electron-packager silently fails
10+
// during asar creation with seedit's large node_modules. The app works fine without it.
11+
// TODO: investigate and fix the asar creation issue
12+
asar: false,
2113

2214
// Exclude unnecessary files from the package
2315
ignore: [
24-
/^\/src/,
25-
/^\/public/,
26-
/^\/android/,
27-
/^\/\.github/,
28-
/^\/scripts/,
29-
/^\/electron\/.*\.(ts|mjs)$/,
30-
/^\/electron\/vite.*\.js$/,
31-
/^\/electron\/download-ipfs\.js$/,
32-
/^\/electron\/before-pack\.js$/,
33-
/^\/electron\/after-all-artifact-build\.cjs$/,
34-
/^\/electron\/build-docker\.sh$/,
35-
/^\/electron\/src\//,
16+
/^\/src$/,
17+
/^\/public$/,
18+
/^\/android$/,
19+
/^\/\.github$/,
20+
/^\/scripts$/,
3621
/^\/\.git/,
37-
/^\/\.gitignore/,
38-
/^\/\.oxfmtrc\.json/,
39-
/^\/oxlintrc\.json/,
40-
/^\/tsconfig\.json/,
41-
/^\/vite\.config\.js/,
42-
/^\/forge\.config\.js/,
43-
/^\/capacitor\.config\.ts/,
44-
/^\/README\.md/,
45-
/^\/CHANGELOG\.md/,
46-
/^\/LICENSE/,
47-
/^\/AGENTS\.md/,
48-
/^\/\.env/,
49-
/^\/\.plebbit/,
50-
/^\/bin/,
51-
/^\/node_modules\/\.cache/,
52-
/^\/node_modules\/\.bin/,
53-
/^\/\.yarn/,
54-
/^\/yarn\.lock/,
55-
/^\/\.DS_Store/,
56-
/^\/out/,
57-
/^\/squashfs-root/,
58-
/^\/dist/,
22+
/^\/\.plebbit$/,
23+
/^\/bin$/,
24+
/^\/out$/,
25+
/^\/dist$/,
26+
/^\/squashfs-root$/,
27+
/\.map$/,
28+
/\.md$/,
29+
/\.ts$/,
30+
/\.mjs$/,
31+
/tsconfig\.json$/,
32+
/\.oxfmtrc/,
33+
/oxlintrc/,
34+
/vite\.config/,
35+
/forge\.config/,
36+
/capacitor\.config/,
37+
/\.env$/,
38+
/\.DS_Store$/,
39+
/yarn\.lock$/,
40+
// kubo npm package creates symlinks that break build - exclude its bin dir
41+
// (we download our own kubo binary in generateAssets hook)
42+
/node_modules\/kubo\/bin/,
43+
// Exclude .bin directories anywhere in node_modules (contain escaping symlinks)
44+
/node_modules\/.*\/\.bin/,
45+
/node_modules\/\.bin/,
46+
/node_modules\/\.cache/,
5947
],
6048
},
6149

6250
rebuildConfig: {
6351
force: true,
6452
},
6553

54+
hooks: {
55+
// Download IPFS/Kubo binaries before packaging
56+
generateAssets: async () => {
57+
console.log('Downloading IPFS clients...');
58+
await downloadIpfsClients();
59+
console.log('IPFS clients downloaded.');
60+
},
61+
},
62+
6663
makers: [
6764
// macOS
6865
{
6966
name: '@electron-forge/maker-dmg',
7067
platforms: ['darwin'],
7168
config: {
72-
name: packageJson.build?.productName || packageJson.name,
69+
name: 'seedit',
7370
format: 'UDZO',
7471
},
7572
},
@@ -82,7 +79,7 @@ const config = {
8279
name: '@electron-forge/maker-squirrel',
8380
platforms: ['win32'],
8481
config: {
85-
name: packageJson.build?.productName || packageJson.name,
82+
name: 'seedit',
8683
},
8784
},
8885
// Linux

package.json

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@
132132
"vite-plugin-node-polyfills": "0.24.0",
133133
"vite-plugin-pwa": "0.21.1",
134134
"wait-on": "7.0.1",
135-
"@reforged/maker-appimage": "5.1.1"
135+
"@reforged/maker-appimage": "5.1.1",
136+
"glob": "10.5.0",
137+
"progress": "2.0.3"
136138
},
137139
"resolutions": {
138140
"js-yaml": "4.1.1",
@@ -153,46 +155,6 @@
153155
"@peculiar/asn1-schema": "2.5.0"
154156
},
155157
"main": "electron/main.js",
156-
"build": {
157-
"appId": "seedit.desktop",
158-
"productName": "seedit",
159-
"beforePack": "electron/before-pack.js",
160-
"afterAllArtifactBuild": "electron/after-all-artifact-build.cjs",
161-
"extraResources": [
162-
{
163-
"from": "bin/${os}",
164-
"to": "bin",
165-
"filter": [
166-
"**/*"
167-
]
168-
}
169-
],
170-
"files": [
171-
"dist/**/*",
172-
"electron/**/*",
173-
"package.json",
174-
"node_modules/**/*"
175-
],
176-
"extends": null,
177-
"mac": {
178-
"target": "dmg",
179-
"category": "public.app-category.social-networking",
180-
"type": "distribution",
181-
"executableName": "seedit"
182-
},
183-
"win": {
184-
"target": [
185-
"portable",
186-
"nsis"
187-
],
188-
"executableName": "seedit"
189-
},
190-
"linux": {
191-
"target": "AppImage",
192-
"category": "Network",
193-
"executableName": "seedit"
194-
}
195-
},
196158
"lint-staged": {
197159
"{src,electron}/**/*.{js,ts,tsx,mjs}": [
198160
"oxfmt"

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,9 +1384,9 @@
13841384
optionalDependencies:
13851385
global-agent "^3.0.0"
13861386

1387-
"@electron/node-gyp@git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2":
1387+
"@electron/node-gyp@https://github.com/electron/node-gyp#06b29aafb7708acef8b3669835c8a7857ebc92d2":
13881388
version "10.2.0-electron.1"
1389-
resolved "git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2"
1389+
resolved "https://github.com/electron/node-gyp#06b29aafb7708acef8b3669835c8a7857ebc92d2"
13901390
dependencies:
13911391
env-paths "^2.2.0"
13921392
exponential-backoff "^3.1.1"
@@ -13052,7 +13052,7 @@ progress-events@^1.0.0, progress-events@^1.0.1:
1305213052
resolved "https://registry.yarnpkg.com/progress-events/-/progress-events-1.0.1.tgz#693b6d4153f08c1418ae3cd5fcad8596c91db7e8"
1305313053
integrity sha512-MOzLIwhpt64KIVN64h1MwdKWiyKFNc/S6BoYKPIVUHFg0/eIEyBulhWCgn678v/4c0ri3FdGuzXymNCv02MUIw==
1305413054

13055-
progress@^2.0.3:
13055+
progress@2.0.3, progress@^2.0.3:
1305613056
version "2.0.3"
1305713057
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
1305813058
integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==

0 commit comments

Comments
 (0)