source: node_modules/prebuild-install/rc.js@ 62b2964

finki-main main
Last change on this file since 62b2964 was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago

Initial commit

  • Property mode set to 100644
File size: 2.1 KB
RevLine 
[81bc7da]1const path = require('path')
2const minimist = require('minimist')
3const getAbi = require('node-abi').getAbi
4const detectLibc = require('detect-libc')
5const napi = require('napi-build-utils')
6
7const env = process.env
8
9const libc = env.LIBC || process.env.npm_config_libc ||
10 (detectLibc.isNonGlibcLinuxSync() && detectLibc.familySync()) || ''
11
12// Get the configuration
13module.exports = function (pkg) {
14 const pkgConf = pkg.config || {}
15 const buildFromSource = env.npm_config_build_from_source
16
17 const rc = require('rc')('prebuild-install', {
18 target: pkgConf.target || env.npm_config_target || process.versions.node,
19 runtime: pkgConf.runtime || env.npm_config_runtime || 'node',
20 arch: pkgConf.arch || env.npm_config_arch || process.arch,
21 libc: libc,
22 platform: env.npm_config_platform || process.platform,
23 debug: env.npm_config_debug === 'true',
24 force: false,
25 verbose: env.npm_config_verbose === 'true',
26 buildFromSource: buildFromSource === pkg.name || buildFromSource === 'true',
27 path: '.',
28 proxy: env.npm_config_proxy || env.http_proxy || env.HTTP_PROXY,
29 'https-proxy': env.npm_config_https_proxy || env.https_proxy || env.HTTPS_PROXY,
30 'local-address': env.npm_config_local_address,
31 'local-prebuilds': 'prebuilds',
32 'tag-prefix': 'v',
33 download: env.npm_config_download
34 }, minimist(process.argv, {
35 alias: {
36 target: 't',
37 runtime: 'r',
38 help: 'h',
39 arch: 'a',
40 path: 'p',
41 version: 'v',
42 download: 'd',
43 buildFromSource: 'build-from-source',
44 token: 'T'
45 }
46 }))
47
48 rc.path = path.resolve(rc.path === true ? '.' : rc.path || '.')
49
50 if (napi.isNapiRuntime(rc.runtime) && rc.target === process.versions.node) {
51 rc.target = napi.getBestNapiBuildVersion()
52 }
53
54 rc.abi = napi.isNapiRuntime(rc.runtime) ? rc.target : getAbi(rc.target, rc.runtime)
55
56 rc.libc = rc.platform !== 'linux' || rc.libc === detectLibc.GLIBC ? '' : rc.libc
57
58 return rc
59}
60
61// Print the configuration values when executed standalone for testing purposses
62if (!module.parent) {
63 console.log(JSON.stringify(module.exports({}), null, 2))
64}
Note: See TracBrowser for help on using the repository browser.