Skip to content

Commit

Permalink
chore: replace resolve-cwd with platform capabilities (#529)
Browse files Browse the repository at this point in the history
Replaces all occurrences of resolveCwd(myPath) with path.resolve(process.cwd(), myPath)
Fixes #528
  • Loading branch information
tlouisse authored Feb 9, 2021
1 parent 8d8257e commit 3b38e45
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/extend.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require('json5/lib/register');

var combineJSON = require('./utils/combineJSON'),
deepExtend = require('./utils/deepExtend'),
resolveCwd = require('resolve-cwd'),
path = require('path'),
_ = require('lodash'),
GroupMessages = require('./utils/groupMessages');

Expand Down Expand Up @@ -88,7 +88,7 @@ function extend(opts) {
// Overloaded method, can accept a string as a path that points to a JS or
// JSON file or a plain object. Potentially refactor.
if (_.isString(opts)) {
options = require(resolveCwd(opts));
options = require(path.resolve(process.cwd(), opts));
} else {
options = opts;
}
Expand Down
5 changes: 3 additions & 2 deletions lib/utils/combineJSON.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ var glob = require('glob'),
deepExtend = require('./deepExtend'),
extend = require('lodash/extend'),
path = require('path'),
resolveCwd = require('resolve-cwd'),
fs = require('fs');

function traverseObj(obj, fn) {
Expand Down Expand Up @@ -51,7 +50,9 @@ function combineJSON(arr, deep, collision, source, parsers=[]) {

for (i = 0; i < files.length; i++) {
var filePath = files[i];
var resolvedPath = resolveCwd(path.isAbsolute(filePath) ? filePath : './' + filePath);
var resolvedPath = path.isAbsolute(files[i])
? files[i]
: path.resolve(process.cwd(), files[i]);
var file_content = null;

try {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
"glob": "^7.1.6",
"json5": "^2.1.3",
"lodash": "^4.17.15",
"resolve-cwd": "^3.0.0",
"tinycolor2": "^1.4.1"
},
"devDependencies": {
Expand Down

0 comments on commit 3b38e45

Please sign in to comment.