Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2017-05-10 23:27:41 +0300
committerRebecca Turner <me@re-becca.org>2017-05-26 04:55:13 +0300
commite02601c4dafd109faf6ddfc4343c9b059e8b2aa0 (patch)
treee7c36cbc14ca67233ab94dc1ede94ea90eba8529 /lib
parentd3dc69b6a2620c58e2bf41a3ccc0b024677484ce (diff)
finalize: Allow symlinking over paths much like we allow finalizing over paths
Diffstat (limited to 'lib')
-rw-r--r--lib/install/action/finalize.js13
1 files changed, 1 insertions, 12 deletions
diff --git a/lib/install/action/finalize.js b/lib/install/action/finalize.js
index a68f7b31f..439edc9ef 100644
--- a/lib/install/action/finalize.js
+++ b/lib/install/action/finalize.js
@@ -28,18 +28,7 @@ module.exports = function (staging, pkg, log) {
return makeParentPath(pkg.path)
.then(() => symlink(pkg.realpath, pkg.path, 'junction'))
.catch((ex) => {
- return readlink(pkg.path).then((dest) => {
- return realpath(path.resolve(path.basename(pkg.path), dest))
- }).then((realdest) => {
- if (realdest === path.normalize(pkg.realpath)) {
- log.warn('finalize', 'Leaving existing symlink in place', pkg.path)
- return
- } else {
- throw ex
- }
- }).catch(() => {
- throw ex
- })
+ return rimraf(pkg.path).then(() => symlink(pkg.realpath, pkg.path, 'junction'))
})
} else {
return makeParentPath(pkg.realpath)