Skip to content
Permalink
Browse files

[fix] Remove version packages and tarballs if they already exist in `…

…npm-update`. Fixes #5.
  • Loading branch information...
indexzero committed May 24, 2013
1 parent 3b66bb4 commit d49b01aa9b8da058e1b2818c739a2188d9e92a02
Showing with 12 additions and 2 deletions.
  1. +12 −2 base/npm-manager/files/npm-uninstall
@@ -4,6 +4,8 @@ PACKAGE=$1
# Get the version of the existing install
#
VERSION=`pkgver $HOME/$PACKAGE/package.json`
TARGET_PKG="$HOME/versions/$VERSION/$PACKAGE"
TARGET_TGZ="$HOME/versions/$VERSION/$PACKAGE.tgz"

#
# Move the existing package into place under $HOME/versions
@@ -13,9 +15,17 @@ if [ ! -d $HOME/versions/$VERSION ]; then
fi

if [ -d $HOME/$PACKAGE ]; then
mv $HOME/$PACKAGE $HOME/versions/$VERSION/$PACKAGE
if [ -d $TARGET_PKG ]; then
rm -rf $TARGET_PKG
fi

mv $HOME/$PACKAGE $TARGET_PKG
fi

if [ -f $HOME/$PACKAGE-$VERSION.tgz ]; then
mv $HOME/$PACKAGE-$VERSION.tgz $HOME/versions/$VERSION/$PACKAGE.tgz
if [ -d $TARGET_TGZ ]; then
rm -rf $TARGET_TGZ
fi

mv $HOME/$PACKAGE-$VERSION.tgz $TARGET_TGZ
fi

0 comments on commit d49b01a

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.