2026-01-30 12:28:41 +08:00
|
|
|
import { downloadIpfsClients } from './electron/before-pack.js';
|
|
|
|
|
|
|
|
|
|
const config = {
|
|
|
|
|
packagerConfig: {
|
|
|
|
|
name: '5chan',
|
|
|
|
|
executableName: '5chan',
|
|
|
|
|
appBundleId: '5chan.desktop',
|
2026-01-30 13:50:17 +08:00
|
|
|
icon: './public/icon', // electron-forge adds the correct extension per platform
|
2026-01-30 12:28:41 +08:00
|
|
|
|
|
|
|
|
// NOTE: asar is disabled because of a bug where electron-packager silently fails
|
|
|
|
|
// during asar creation with 5chan's large node_modules. The app works fine without it.
|
|
|
|
|
// TODO: investigate and fix the asar creation issue
|
|
|
|
|
asar: false,
|
|
|
|
|
|
|
|
|
|
// Exclude unnecessary files from the package
|
|
|
|
|
ignore: [
|
|
|
|
|
/^\/src$/,
|
|
|
|
|
/^\/public$/,
|
|
|
|
|
/^\/android$/,
|
|
|
|
|
/^\/\.github$/,
|
|
|
|
|
/^\/scripts$/,
|
|
|
|
|
/^\/\.git/,
|
2026-04-17 10:48:27 +07:00
|
|
|
/^\/\.pkc$/,
|
2026-01-30 12:28:41 +08:00
|
|
|
/^\/out$/,
|
|
|
|
|
/^\/dist$/,
|
|
|
|
|
/^\/squashfs-root$/,
|
|
|
|
|
/\.map$/,
|
|
|
|
|
/\.md$/,
|
|
|
|
|
/\.ts$/,
|
|
|
|
|
/tsconfig\.json$/,
|
|
|
|
|
/\.oxfmtrc/,
|
|
|
|
|
/oxlintrc/,
|
|
|
|
|
/vite\.config/,
|
|
|
|
|
/forge\.config/,
|
|
|
|
|
/capacitor\.config/,
|
|
|
|
|
/\.env$/,
|
|
|
|
|
/\.DS_Store$/,
|
|
|
|
|
/yarn\.lock$/,
|
|
|
|
|
// Exclude build-time scripts from the package
|
|
|
|
|
/electron\/before-pack\.js/,
|
|
|
|
|
// Exclude .bin directories anywhere in node_modules (contain escaping symlinks)
|
|
|
|
|
/node_modules\/.*\/\.bin/,
|
|
|
|
|
/node_modules\/\.bin/,
|
|
|
|
|
/node_modules\/\.cache/,
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
rebuildConfig: {
|
2026-03-17 18:22:56 +08:00
|
|
|
// Only better-sqlite3 is intentionally prepared and verified before packaging.
|
|
|
|
|
// Using `onlyModules` prevents Forge from rebuilding unrelated optional addons
|
|
|
|
|
// that inflate Windows package times.
|
|
|
|
|
onlyModules: ['better-sqlite3'],
|
2026-01-30 12:28:41 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
hooks: {
|
|
|
|
|
// Download IPFS/Kubo binaries before packaging
|
|
|
|
|
generateAssets: async () => {
|
|
|
|
|
console.log('Downloading IPFS clients...');
|
|
|
|
|
await downloadIpfsClients();
|
|
|
|
|
console.log('IPFS clients downloaded.');
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
makers: [
|
|
|
|
|
// macOS
|
|
|
|
|
{
|
|
|
|
|
name: '@electron-forge/maker-dmg',
|
|
|
|
|
platforms: ['darwin'],
|
|
|
|
|
config: {
|
|
|
|
|
name: '5chan',
|
2026-02-16 16:16:05 +08:00
|
|
|
icon: './public/icon.icns',
|
2026-01-30 15:26:17 +08:00
|
|
|
format: 'ULFO',
|
2026-01-30 12:28:41 +08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '@electron-forge/maker-zip',
|
|
|
|
|
platforms: ['darwin'],
|
|
|
|
|
},
|
|
|
|
|
// Windows
|
|
|
|
|
{
|
|
|
|
|
name: '@electron-forge/maker-squirrel',
|
|
|
|
|
platforms: ['win32'],
|
|
|
|
|
config: {
|
|
|
|
|
name: '5chan',
|
2026-01-30 15:26:17 +08:00
|
|
|
setupIcon: './public/windows-icon.ico',
|
2026-01-30 12:28:41 +08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
// Linux
|
|
|
|
|
{
|
|
|
|
|
name: '@reforged/maker-appimage',
|
|
|
|
|
platforms: ['linux'],
|
|
|
|
|
config: {
|
|
|
|
|
options: {
|
2026-01-30 13:50:17 +08:00
|
|
|
name: '5chan',
|
|
|
|
|
icon: './public/icon.png',
|
2026-01-30 12:28:41 +08:00
|
|
|
categories: ['Network'],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default config;
|