Skip to content

Commit

Permalink
replace xtend with object.assign(...) (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiask88 committed Jan 24, 2018
1 parent cd60f37 commit 0f3c4b7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
3 changes: 1 addition & 2 deletions bin.js
Expand Up @@ -3,7 +3,6 @@
var path = require('path')
var log = require('npmlog')
var fs = require('fs')
var extend = require('xtend')

var pkg = require(path.resolve('package.json'))
var rc = require('./rc')(pkg)
Expand Down Expand Up @@ -35,7 +34,7 @@ if (rc.help) {

log.info('begin', 'Prebuild-install version', prebuildClientVersion)

var opts = extend(rc, {pkg: pkg, log: log})
var opts = Object.assign({}, rc, {pkg: pkg, log: log})

var execPath = process.env.npm_execpath || process.env.NPM_CLI_JS

Expand Down
3 changes: 1 addition & 2 deletions download.js
Expand Up @@ -3,8 +3,7 @@ var fs = require('fs')
var get = require('simple-get')
var pump = require('pump')
var tfs = require('tar-fs')
var extend = require('xtend')
var noop = extend({
var noop = Object.assign({
http: function () {},
silly: function () {}
}, require('noop-logger'))
Expand Down
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -32,8 +32,7 @@
"rc": "^1.1.6",
"simple-get": "^2.7.0",
"tar-fs": "^1.13.0",
"tunnel-agent": "^0.6.0",
"xtend": "4.0.1"
"tunnel-agent": "^0.6.0"
},
"devDependencies": {
"a-native-module": "^1.0.0",
Expand Down
3 changes: 1 addition & 2 deletions test/rc-test.js
@@ -1,7 +1,6 @@
var test = require('tape')
var path = require('path')
var exec = require('child_process').exec
var xtend = require('xtend')

test('custom config and aliases', function (t) {
var args = [
Expand Down Expand Up @@ -103,7 +102,7 @@ test('use default ABI', function (t) {

function runRc (t, args, env, cb) {
var cmd = 'node ' + path.resolve(__dirname, '..', 'rc.js') + ' ' + args
env = xtend(process.env, env)
env = Object.assign({}, process.env, env)
exec(cmd, { env: env }, function (err, stdout, stderr) {
t.error(err, 'no error')
t.equal(stderr.length, 0, 'no stderr')
Expand Down
5 changes: 2 additions & 3 deletions test/util-test.js
Expand Up @@ -3,7 +3,6 @@ var fs = require('fs')
var home = require('os-homedir')
var util = require('../util')
var path = require('path')
var xtend = require('xtend')

test('prebuildCache() for different environments', function (t) {
var NPMCACHE = process.env.npm_config_cache
Expand Down Expand Up @@ -77,7 +76,7 @@ test('urlTemplate() returns different templates based on pkg and rc', function (
var t6 = util.urlTemplate(o6)
t.equal(t6, 'http://foo.com/w00t/{name}-{major}.{minor}-{runtime}-v{abi}-{platform}-{arch}.tar.gz', 'pkg.binary.package_name is added after host and remote_path, custom format')
var o7 = {
pkg: xtend(require('../package.json')),
pkg: require('../package.json'),
download: true
}
delete o7.binary
Expand All @@ -87,7 +86,7 @@ test('urlTemplate() returns different templates based on pkg and rc', function (
delete process.env[envProperty]
t.equal(t7, 'http://overriden-url.com/overriden-path/v{version}/{name}-v{version}-{runtime}-v{abi}-{platform}{libc}-{arch}.tar.gz', '--download with host mirror override')
var o8 = {
pkg: xtend(require('../package.json'), {
pkg: Object.assign({}, require('../package.json'), {
binary: {
host: 'http://foo.com',
remote_path: 'w00t',
Expand Down

0 comments on commit 0f3c4b7

Please sign in to comment.