mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-09-11 17:16:18 -07:00
feat(launcher): bundle a private Bun runtime
This commit is contained in:
@@ -13,7 +13,22 @@ const {
|
||||
} = require('./electron-builder-after-pack.cjs') as {
|
||||
LINUX_FFMPEG_LIBRARY: string;
|
||||
MACOS_WINDOW_HELPER: string;
|
||||
default: (context: { appOutDir: string; electronPlatformName: string }) => Promise<void>;
|
||||
default: (
|
||||
context: {
|
||||
appOutDir: string;
|
||||
arch?: number;
|
||||
electronPlatformName: string;
|
||||
packager?: { appInfo?: { productFilename?: string } };
|
||||
},
|
||||
deps?: {
|
||||
stageBunRuntime?: (options: {
|
||||
appOutDir: string;
|
||||
platform: string;
|
||||
arch: number | undefined;
|
||||
productFilename: string;
|
||||
}) => Promise<void>;
|
||||
},
|
||||
) => Promise<void>;
|
||||
stageLinuxAppImageSharedLibrary: (context: {
|
||||
appOutDir: string;
|
||||
electronPlatformName: string;
|
||||
@@ -156,3 +171,47 @@ test('afterPack propagates Linux staging failures', async () => {
|
||||
fs.rmSync(workspace, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test('afterPack preserves Linux staging and forwards the electron-builder target to Bun staging', async () => {
|
||||
const workspace = createWorkspace('subminer-after-pack-target');
|
||||
const appOutDir = path.join(workspace, 'SubMiner-linux-arm64');
|
||||
const sourceLibraryPath = path.join(appOutDir, LINUX_FFMPEG_LIBRARY);
|
||||
const targetLibraryPath = path.join(appOutDir, 'usr', 'lib', LINUX_FFMPEG_LIBRARY);
|
||||
let stagedOptions:
|
||||
| {
|
||||
appOutDir: string;
|
||||
platform: string;
|
||||
arch: number | undefined;
|
||||
productFilename: string;
|
||||
}
|
||||
| undefined;
|
||||
|
||||
fs.mkdirSync(appOutDir, { recursive: true });
|
||||
fs.writeFileSync(sourceLibraryPath, 'bundled ffmpeg', 'utf8');
|
||||
|
||||
try {
|
||||
await afterPack(
|
||||
{
|
||||
appOutDir,
|
||||
arch: 3,
|
||||
electronPlatformName: 'linux',
|
||||
packager: { appInfo: { productFilename: 'SubMiner Preview' } },
|
||||
},
|
||||
{
|
||||
stageBunRuntime: async (options) => {
|
||||
stagedOptions = options;
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
assert.deepEqual(stagedOptions, {
|
||||
appOutDir,
|
||||
platform: 'linux',
|
||||
arch: 3,
|
||||
productFilename: 'SubMiner Preview',
|
||||
});
|
||||
assert.equal(fs.readFileSync(targetLibraryPath, 'utf8'), 'bundled ffmpeg');
|
||||
} finally {
|
||||
fs.rmSync(workspace, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user