CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
1const path = require('path')2const minimist = require('minimist')3const getAbi = require('node-abi').getAbi4const detectLibc = require('detect-libc')5const napi = require('napi-build-utils')6 7const env = process.env8 9const libc = env.LIBC || process.env.npm_config_libc ||10  (detectLibc.isNonGlibcLinuxSync() && detectLibc.familySync()) || ''11 12// Get the configuration13module.exports = function (pkg) {14  const pkgConf = pkg.config || {}15  const buildFromSource = env.npm_config_build_from_source16 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_download34  }, 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.libc57 58  return rc59}60 61// Print the configuration values when executed standalone for testing purposses62if (!module.parent) {63  console.log(JSON.stringify(module.exports({}), null, 2))64}65