Skip to content

Commit

Permalink
fix up uninstall
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Dec 29, 2014
1 parent b4a1f5f commit 8e39b25
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/config/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ var PackageName = require('./package-name');
var alphabetize = require('../common').alphabetize;
var ui = require('../ui');

var nodelibs;

/*
* Loader Configuration Class
*
Expand Down Expand Up @@ -125,7 +127,6 @@ Config.prototype.read = function() {
// separate map into baseMap and depMap
self.baseMap = {};
self.depMap = {};
var nodelibs;
for (var d in cfg.map) {
if (typeof cfg.map[d] == 'string')
self.baseMap[d] = new PackageName(cfg.map[d]);
Expand All @@ -134,14 +135,20 @@ Config.prototype.read = function() {
self.depMap[d] = {};
for (var m in depMap)
self.depMap[d][m] = new PackageName(depMap[m]);
// add back nodelibs
if (d.substr(0, 4) == 'npm:') {
nodelibs = nodelibs || new PackageName(endpoint.load('npm').nodelibs);
self.depMap[d].nodelibs = nodelibs;
}
}
}

// ensure that everything in baseMap has a depMap, even if empty
// also add back nodelibs into depMaps here
if (!nodelibs)
nodelibs = new PackageName(endpoint.load('npm').nodelibs);
for (var d in self.baseMap) {
var name = self.baseMap[d].exactName;
var depMap = self.depMap[name] = self.depMap[name] || {};
if (name.substr(0, 4) == 'npm:')
self.depMap[name].nodelibs = nodelibs;
}

self.versions = self.versions || {};
for (var v in cfg.versions) {
if (typeof cfg.versions[v] == 'string')
Expand Down

0 comments on commit 8e39b25

Please sign in to comment.