How to use the node-abi.supportedTargets function in node-abi

To help you get started, we’ve selected a few node-abi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github prebuild / prebuildify / index.js View on Github external
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
}
github prebuild / prebuildify / index.js View on Github external
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
}
github prebuild / prebuild-ci / index.js View on Github external
#!/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) {
github prebuild / prebuild / rc.js View on Github external
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: '.',

node-abi

Get the Node ABI for a given target and runtime, and vice versa.

MIT
Latest version published 2 months ago

Package Health Score

88 / 100
Full package analysis