-
-
Notifications
You must be signed in to change notification settings - Fork 522
/
MakerRpm.ts
52 lines (41 loc) · 1.29 KB
/
MakerRpm.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
import path from 'path';
import { MakerBase, MakerOptions } from '@electron-forge/maker-base';
import { ForgeArch, ForgePlatform } from '@electron-forge/shared-types';
import { MakerRpmConfig } from './Config';
export function rpmArch(nodeArch: ForgeArch): string {
switch (nodeArch) {
case 'ia32':
return 'i386';
case 'x64':
return 'x86_64';
case 'armv7l':
return 'armv7hl';
case 'arm':
return 'armv6hl';
default:
return nodeArch;
}
}
export default class MakerRpm extends MakerBase<MakerRpmConfig> {
name = 'rpm';
defaultPlatforms: ForgePlatform[] = ['linux'];
requiredExternalBinaries: string[] = ['rpmbuild'];
isSupportedOnCurrentPlatform(): boolean {
return this.isInstalled('electron-installer-redhat');
}
async make({ dir, makeDir, targetArch }: MakerOptions): Promise<string[]> {
// eslint-disable-next-line node/no-missing-require
const installer = require('electron-installer-redhat');
const outDir = path.resolve(makeDir, 'rpm', targetArch);
await this.ensureDirectory(outDir);
const { packagePaths } = await installer({
...this.config,
arch: rpmArch(targetArch),
src: dir,
dest: outDir,
rename: undefined,
});
return packagePaths;
}
}
export { MakerRpm, MakerRpmConfig };