1 |
|
2 |
|
3 |
|
4 | 'use strict';
|
5 |
|
6 | const detectLibc = require('detect-libc');
|
7 |
|
8 | const env = process.env;
|
9 |
|
10 | module.exports = function () {
|
11 | const arch = env.npm_config_arch || process.arch;
|
12 | const platform = env.npm_config_platform || process.platform;
|
13 | const libc = process.env.npm_config_libc ||
|
14 |
|
15 | (detectLibc.isNonGlibcLinuxSync() ? detectLibc.familySync() : '');
|
16 | const libcId = platform !== 'linux' || libc === detectLibc.GLIBC ? '' : libc;
|
17 |
|
18 | const platformId = [`${platform}${libcId}`];
|
19 |
|
20 | if (arch === 'arm') {
|
21 | const fallback = process.versions.electron ? '7' : '6';
|
22 | platformId.push(`armv${env.npm_config_arm_version || process.config.variables.arm_version || fallback}`);
|
23 | } else if (arch === 'arm64') {
|
24 | platformId.push(`arm64v${env.npm_config_arm_version || '8'}`);
|
25 | } else {
|
26 | platformId.push(arch);
|
27 | }
|
28 |
|
29 | return platformId.join('-');
|
30 | };
|