Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prebuildify

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prebuildify - npm Package Compare versions

Comparing version 1.0.2 to 2.0.0

59

index.js

@@ -20,4 +20,7 @@ #!/usr/bin/env node

var cwd = argv._[0] || '.'
var builds = path.join(cwd, 'prebuilds')
var builds = path.join(cwd, 'prebuilds', platform + '-' + arch)
var output = path.join(cwd, 'build', argv.debug ? 'Debug' : 'Release')
if (arch) process.env.ARCH = process.env.PREBUILD_ARCH = arch
var targets = [].concat(argv.target || []).map(function (v) {

@@ -56,13 +59,39 @@ if (v.indexOf('@') === -1) v = 'node@' + v

build(next.target, next.runtime, function (err, filename) {
copySharedLibs(output, builds, function (err) {
if (err) return loop(err)
var a = abi.getAbi(next.target, next.runtime)
var name = platform + '-' + arch + '-' + next.runtime + '-' + a + '.node'
var dest = path.join(builds, name)
build(next.target, next.runtime, function (err, filename) {
if (err) return loop(err)
fs.rename(filename, dest, loop)
var name = next.runtime + '-' + abi.getAbi(next.target, next.runtime) + '.node'
var dest = path.join(builds, name)
fs.rename(filename, dest, loop)
})
})
}
function copySharedLibs (builds, folder, cb) {
fs.readdir(builds, function (err, files) {
if (err) return cb(err)
var libs = files.filter(function (name) {
return /\.dylib$/.test(name) || /\.so(\.\d+)?$/.test(name) || /\.dll$/.test(name)
})
loop()
function loop (err) {
if (err) return cb(err)
var next = libs.shift()
if (!next) return cb()
strip(path.join(builds, next), function (err) {
if (err) return cb(err)
copy(path.join(builds, next), path.join(folder, next), loop)
})
}
})
}
function preinstall (cb) {

@@ -99,4 +128,2 @@ if (!argv.preinstall) return cb()

var output = path.join(cwd, 'build', argv.debug ? 'Debug' : 'Release')
var child = proc.spawn(os.platform() === 'win32' ? 'node-gyp.cmd' : 'node-gyp', args, {

@@ -112,3 +139,2 @@ cwd: cwd,

if (err) return cb(err)
if (!argv.strip) return cb(null, output)

@@ -137,3 +163,3 @@ strip(output, function (err) {

function strip (file, cb) {
if (platform !== 'darwin' && platform !== 'linux') return process.nextTick(cb)
if (!argv.strip || platform !== 'darwin' && platform !== 'linux') return process.nextTick(cb)

@@ -152,1 +178,14 @@ var args = platform === 'darwin' ? [file, '-Sx'] : [file, '--strip-all']

}
function copy (a, b, cb) {
fs.stat(a, function (err, st) {
if (err) return cb(err)
fs.readFile(a, function (err, buf) {
if (err) return cb(err)
fs.writeFile(b, buf, function (err) {
if (err) return cb(err)
fs.chmod(b, st.mode, cb)
})
})
})
}

2

package.json
{
"name": "prebuildify",
"version": "1.0.2",
"version": "2.0.0",
"description": "Create and package prebuilds for native modules",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc