Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Commit

Permalink
BUGFIX: fixed behavior when not using relative path
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Heckendorf committed Dec 4, 2019
1 parent fbf2703 commit dab0d7f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/lib/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ const fileUtils = {
// Use a junction on Windows like Yarn do.
// See: https://github.com/yarnpkg/yarn/blob/fc94a16b7ca90a188d084aef8cea406b60e8c38f/src/util/fs.js#L695-L696
const type = stats.isDirectory() ? 'junction' : 'file';
let targetRelative = target;

if (relative) {
targetRelative = path.relative(path.dirname(dist), target);
const targetRelative = path.relative(path.dirname(dist), target);
const currDur = process.cwd();
process.chdir(distDir);
await utils.symlinkAsync(targetRelative, path.basename(target), type);
process.chdir(currDur);
} else {
await utils.symlinkAsync(target, dist, type);
}

const currDur = process.cwd();
process.chdir(distDir);
await utils.symlinkAsync(targetRelative, path.basename(target), type);
process.chdir(currDur);
},

/**
Expand Down

0 comments on commit dab0d7f

Please sign in to comment.