mirror of
https://github.com/bower/bower.git
synced 2026-04-24 03:00:19 -04:00
Merge branch 'master' of github.com:bower/bower
This commit is contained in:
@@ -17,20 +17,25 @@ function list(options, config) {
|
||||
|
||||
project.getTree()
|
||||
.spread(function (tree, flattened) {
|
||||
var baseDir;
|
||||
var baseDir = path.dirname(path.join(config.cwd, config.directory));
|
||||
|
||||
// Relativize?
|
||||
if (options.relative) {
|
||||
baseDir = path.dirname(path.join(config.cwd, config.directory));
|
||||
|
||||
project.walkTree(tree, function (node) {
|
||||
// Relativize paths
|
||||
// Also normalize paths on windows
|
||||
project.walkTree(tree, function (node) {
|
||||
if (options.relative) {
|
||||
node.canonicalDir = path.relative(baseDir, node.canonicalDir);
|
||||
}, true);
|
||||
}
|
||||
node.canonicalDir = normalize(node.canonicalDir);
|
||||
}, true);
|
||||
|
||||
mout.object.forOwn(flattened, function (node) {
|
||||
// Note that we need to to parse the flattened tree because it might
|
||||
// contain additional packages
|
||||
mout.object.forOwn(flattened, function (node) {
|
||||
if (options.relative) {
|
||||
node.canonicalDir = path.relative(baseDir, node.canonicalDir);
|
||||
});
|
||||
}
|
||||
}
|
||||
node.canonicalDir = normalize(node.canonicalDir);
|
||||
});
|
||||
|
||||
// Render paths?
|
||||
if (options.paths) {
|
||||
@@ -119,7 +124,7 @@ function paths(flattened) {
|
||||
|
||||
// Concatenate each main entry with the canonical dir
|
||||
main = main.map(function (part) {
|
||||
return path.join(pkg.canonicalDir, part).trim();
|
||||
return normalize(path.join(pkg.canonicalDir, part).trim());
|
||||
}).join(',');
|
||||
|
||||
ret[name] = main;
|
||||
@@ -128,6 +133,10 @@ function paths(flattened) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
function normalize(src) {
|
||||
return src.replace(/\\/g, '/');
|
||||
}
|
||||
|
||||
// -------------------
|
||||
|
||||
list.line = function (argv) {
|
||||
|
||||
Reference in New Issue
Block a user