forked from electron/rebuild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharch.ts
37 lines (33 loc) · 790 Bytes
/
arch.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
import { execSync } from 'child_process';
/**
* Runs the `uname` command and returns the trimmed output.
*
* Copied from `@electron/get`.
*/
export function uname(): string {
return execSync('uname -m')
.toString()
.trim();
}
export type ConfigVariables = {
arm_version?: string;
}
/**
* Generates an architecture name that would be used in an Electron or Node.js
* download file name.
*
* Copied from `@electron/get`.
*/
export function getNodeArch(arch: string, configVariables: ConfigVariables): string {
if (arch === 'arm') {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
switch (configVariables.arm_version) {
case '6':
return uname();
case '7':
default:
return 'armv7l';
}
}
return arch;
}