Skip to content

Commit

Permalink
fix: Fix --relativeModulePath using absolute paths when used with `…
Browse files Browse the repository at this point in the history
…--start`
  • Loading branch information
Roman Seidelsohn committed Apr 16, 2023
1 parent 86a5bea commit 3c83772
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,6 @@ const recursivelyCollectAllDependencies = (options) => {
};

exports.init = function init(args, callback) {
// Fix path if on Windows:
const workingDir = args.start.replace(/\\\\/g, '\\');

debugLog('scanning %s', args.start);

// customPath is a path to a JSON file that defined a custom format
Expand Down Expand Up @@ -629,11 +626,7 @@ exports.init = function init(args, callback) {
/*istanbul ignore else*/
if (data[item]) {
if (args.relativeModulePath && data[item].path != null) {
// Cut the absolute portion of the module path (for forward and backward slashes respectively):
data[item].path = data[item].path
.replace(`${workingDir}/`, '')
.replace(`${workingDir}\\`, '')
.replace(workingDir, '');
data[item].path = path.relative(args.start, data[item].path);
}

if (args.onlyunknown) {
Expand Down

0 comments on commit 3c83772

Please sign in to comment.