Skip to content

Commit

Permalink
feat(remove): update node_modules/.bin
Browse files Browse the repository at this point in the history
Improve the "remove" command by cleaning up after ourselves in the "node_modules/.bin" directory.
  • Loading branch information
aleclarson committed Jan 11, 2019
1 parent bd9671c commit aa3a5b0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ export const removePackages = async (
// Remove symlink from node_modules
fs.removeSync(join(workingDir, 'node_modules', name))

// Remove symlinks from node_modules/.bin
if (pkg.bin) {
const names =
typeof pkg.bin === 'string' ? [pkg.name] : Object.keys(pkg.bin)
names.forEach(name => {
fs.removeSync(join(workingDir, 'node_modules', '.bin', name))
})
}

// Update the package.json
if (lockedPackage && lockedPackage.replaced) {
depsWithPackage[name] = lockedPackage.replaced
Expand Down

0 comments on commit aa3a5b0

Please sign in to comment.