Skip to content

Commit

Permalink
fix(add): use symlinks in node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Jan 2, 2019
1 parent efe5889 commit 4a05d83
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,9 @@ export const addPackages = async (
}
if (!doPure) {
const destModulesDir = join(workingDir, 'node_modules', name)
if (options.link || options.linkDep || isSymlink(destModulesDir)) {
fs.removeSync(destModulesDir)
}

if (options.link || options.linkDep) {
ensureSymlinkSync(destYalcCopyDir, destModulesDir, 'junction')
} else {
emptyDirExcludeNodeModules(destModulesDir)
fs.copySync(destYalcCopyDir, destModulesDir)
}
fs.removeSync(destModulesDir)
ensureSymlinkSync(destYalcCopyDir, destModulesDir, 'junction')

if (!options.link) {
const protocol = options.linkDep ? 'link:' : 'file:'
Expand Down

0 comments on commit 4a05d83

Please sign in to comment.