/
MakerDeb.ts
54 lines (42 loc) · 1.32 KB
/
MakerDeb.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import path from 'path';
import { MakerBase, MakerOptions } from '@electron-forge/maker-base';
import { ForgeArch, ForgePlatform } from '@electron-forge/shared-types';
import { MakerDebConfig } from './Config';
export function debianArch(nodeArch: ForgeArch): string {
switch (nodeArch) {
case 'ia32':
return 'i386';
case 'x64':
return 'amd64';
case 'armv7l':
return 'armhf';
case 'arm':
return 'armel';
default:
return nodeArch;
}
}
export default class MakerDeb extends MakerBase<MakerDebConfig> {
name = 'deb';
defaultPlatforms: ForgePlatform[] = ['linux'];
requiredExternalBinaries: string[] = ['dpkg', 'fakeroot'];
isSupportedOnCurrentPlatform(): boolean {
return this.isInstalled('electron-installer-debian');
}
async make({ dir, makeDir, targetArch }: MakerOptions): Promise<string[]> {
// eslint-disable-next-line node/no-missing-require
const installer = require('electron-installer-debian');
const outDir = path.resolve(makeDir, 'deb', targetArch);
await this.ensureDirectory(outDir);
const { packagePaths } = await installer({
options: {},
...this.config,
arch: debianArch(targetArch),
src: dir,
dest: outDir,
rename: undefined,
});
return packagePaths;
}
}
export { MakerDeb, MakerDebConfig };