Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function resolveTargets (targets, all, napi) {
targets = targets.map(function (v) {
if (typeof v === 'object' && v !== null) return v
if (v.indexOf('@') === -1) v = 'node@' + v
return {
runtime: v.split('@')[0],
target: v.split('@')[1].replace(/^v/, '')
}
})
// TODO: also support --lts and get versions from travis
if (all) {
targets = abi.supportedTargets.slice(0)
}
// Should be the default once napi is stable
if (napi && targets.length === 0) {
targets = [
abi.supportedTargets.filter(onlyNode).pop(),
abi.supportedTargets.filter(onlyElectron).pop()
]
if (targets[0].target === '9.0.0') targets[0].target = '9.6.1'
}
return targets
}
return {
runtime: v.split('@')[0],
target: v.split('@')[1].replace(/^v/, '')
}
})
// TODO: also support --lts and get versions from travis
if (all) {
targets = abi.supportedTargets.slice(0)
}
// Should be the default once napi is stable
if (napi && targets.length === 0) {
targets = [
abi.supportedTargets.filter(onlyNode).pop(),
abi.supportedTargets.filter(onlyElectron).pop()
]
if (targets[0].target === '9.0.0') targets[0].target = '9.6.1'
}
return targets
}
#!/usr/bin/env node
const spawn = require('cross-spawn')
const npmRunPath = require('npm-run-path-compat')
const log = require('npmlog')
const versionChanged = require('version-changed')
const version = require('./package').version
const runSeries = require('run-series')
const supportedTargets = require('node-abi').supportedTargets
const buildTargets = require('./build-targets')
const path = require('path')
const pkg = require(path.resolve('package.json'))
if (!process.env.CI) process.exit()
log.heading = 'prebuild-ci'
log.level = 'verbose'
const token = process.env.PREBUILD_TOKEN
if (!token) {
log.error('PREBUILD_TOKEN required')
process.exit(0)
}
function prebuild (runtime, target, cb) {
var minimist = require('minimist')
var targets = require('node-abi').supportedTargets
var detectLibc = require('detect-libc')
var napi = require('napi-build-utils')
var libc = process.env.LIBC || (detectLibc.isNonGlibcLinux && detectLibc.family) || ''
var rc = require('rc')('prebuild', {
target: process.versions.node,
runtime: 'node',
arch: process.arch,
libc: libc,
platform: process.platform,
all: false,
force: false,
debug: false,
verbose: false,
path: '.',