-
-
Notifications
You must be signed in to change notification settings - Fork 506
/
MakerDeb.ts
48 lines (39 loc) · 1.2 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
import MakerBase, { MakerOptions } from '@electron-forge/maker-base';
import { ForgeArch, ForgePlatform } from '@electron-forge/shared-types';
import path from 'path';
import { MakerDebConfig } from './Config';
export function debianArch(nodeArch: ForgeArch) {
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'];
isSupportedOnCurrentPlatform() {
return this.isInstalled('electron-installer-debian') && process.platform === 'linux';
}
async make({
dir,
makeDir,
targetArch,
}: MakerOptions) {
// eslint-disable-next-line global-require, import/no-unresolved
const installer = require('electron-installer-debian');
const outDir = path.resolve(makeDir);
await this.ensureDirectory(outDir);
const { packagePaths } = await installer({
options: {},
...this.config,
arch: debianArch(targetArch),
src: dir,
dest: outDir,
rename: undefined,
});
return packagePaths;
}
}