Skip to content

Commit

Permalink
Use Object.assign over defaults. (#2687)
Browse files Browse the repository at this point in the history
  • Loading branch information
wtgtybhertgeghgtwtg authored and bestander committed Feb 27, 2017
1 parent 0adbc59 commit f8fd813
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"commander": "^2.9.0",
"death": "^1.0.0",
"debug": "^2.2.0",
"defaults": "^1.0.3",
"detect-indent": "^5.0.0",
"ini": "^1.3.4",
"inquirer": "^3.0.1",
Expand Down
3 changes: 1 addition & 2 deletions src/registries/npm-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import Registry from './base-registry.js';
import {addSuffix, removePrefix} from '../util/misc';
import isRequestToRegistry from './is-request-to-registry.js';

const defaults = require('defaults');
const userHome = require('../util/user-home-dir').default;
const path = require('path');
const url = require('url');
Expand Down Expand Up @@ -139,7 +138,7 @@ export default class NpmRegistry extends Registry {
await fs.mkdirp(mirrorLoc);
}

defaults(this.config, config);
this.config = Object.assign({}, config, this.config);
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/registries/yarn-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import parse from '../lockfile/parse.js';
import * as fs from '../util/fs.js';

const userHome = require('../util/user-home-dir').default;
const defaults = require('defaults');
const path = require('path');
const pkg: { version: string } = require('../../package.json');

Expand Down Expand Up @@ -93,11 +92,11 @@ export default class YarnRegistry extends NpmRegistry {
await fs.mkdirp(mirrorLoc);
}

defaults(this.config, config);
this.config = Object.assign({}, config, this.config);
}

// default yarn config
defaults(this.config, DEFAULTS);
this.config = Object.assign({}, DEFAULTS, this.config);
}

async saveHomeConfig(config: Object): Promise<void> {
Expand Down
36 changes: 20 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ ajv-keywords@^1.0.0, ajv-keywords@^1.1.1:
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c"

ajv@^4.7.0:
version "4.11.2"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.2.tgz#f166c3c11cbc6cb9dcc102a5bcfe5b72c95287e6"
version "4.11.3"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.3.tgz#ce30bdb90d1254f762c75af915fb3a63e7183d22"
dependencies:
co "^4.6.0"
json-stable-stringify "^1.0.1"
Expand Down Expand Up @@ -93,8 +93,8 @@ append-transform@^0.4.0:
default-require-extensions "^1.0.0"

aproba@^1.0.3:
version "1.1.0"
resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.1.0.tgz#4d8f047a318604e18e3c06a0e52230d3d19f147b"
version "1.1.1"
resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.1.1.tgz#95d3600f07710aa0e9298c726ad5ecf2eacbabab"

archy@^1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -1247,8 +1247,8 @@ [email protected]:
object-assign "4.1.0"

[email protected], debug@^2.1.1, debug@^2.2.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b"
version "2.6.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.1.tgz#79855090ba2c4e3115cc7d8769491d58f0491351"
dependencies:
ms "0.7.2"

Expand Down Expand Up @@ -1276,7 +1276,7 @@ default-require-extensions@^1.0.0:
dependencies:
strip-bom "^2.0.0"

defaults@^1.0.0, defaults@^1.0.3:
defaults@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d"
dependencies:
Expand Down Expand Up @@ -1841,7 +1841,7 @@ form-data@~2.1.1:

fs-exists-sync@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz#982d6893af918e72d08dec9e8673ff2b5a8d6add"
resolved "http://registry.npmjs.org/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz#982d6893af918e72d08dec9e8673ff2b5a8d6add"

fs.realpath@^1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -2831,12 +2831,12 @@ [email protected], js-yaml@^3.5.1, js-yaml@^3.7.0:
esprima "^3.1.1"

jsbn@~0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.0.tgz#650987da0dd74f4ebf5a11377a2aa2d273e97dfd"
version "0.1.1"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"

jsdom@^9.8.0:
version "9.10.0"
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.10.0.tgz#72d04d9fd5f1164d016dc350ef889af6d0d1a25a"
version "9.11.0"
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.11.0.tgz#a95b0304e521a2ca5a63c6ea47bf7708a7a84591"
dependencies:
abab "^1.0.3"
acorn "^4.0.4"
Expand All @@ -2853,7 +2853,7 @@ jsdom@^9.8.0:
sax "^1.2.1"
symbol-tree "^3.2.1"
tough-cookie "^2.3.2"
webidl-conversions "^3.0.1"
webidl-conversions "^4.0.0"
whatwg-encoding "^1.0.1"
whatwg-url "^4.3.0"
xml-name-validator "^2.0.1"
Expand Down Expand Up @@ -4299,8 +4299,8 @@ supports-color@^3.1.0, supports-color@^3.1.2:
has-flag "^1.0.0"

symbol-tree@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.1.tgz#8549dd1d01fa9f893c18cc9ab0b106b4d9b168cb"
version "3.2.2"
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6"

table@^3.7.8:
version "3.8.3"
Expand Down Expand Up @@ -4633,10 +4633,14 @@ watchpack@^1.2.0:
chokidar "^1.4.3"
graceful-fs "^4.1.2"

webidl-conversions@^3.0.0, webidl-conversions@^3.0.1:
webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"

webidl-conversions@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.0.tgz#0a8c727ae4e5649687b7742368dcfbf13ed40118"

webpack-sources@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.1.4.tgz#ccc2c817e08e5fa393239412690bb481821393cd"
Expand Down

0 comments on commit f8fd813

Please sign in to comment.