Files
Paul Lewis 911c1b8a93 Updates node_modules
DISABLE_THIRD_PARTY_CHECK=Package needs updating with node_modules
Change-Id: I889f1b86c586e37307a3e13ad762aa56d1ece150
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1946468
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2019-12-02 14:54:54 +00:00

46 lines
1.2 KiB
JavaScript
Executable File

#!/usr/bin/env node
(function(){
try {
var dive = require('dive');
} catch (ex) {
console.error('this example requires "dive", please run "npm install dive"');
process.exit(1);
}
var treeify = require('../treeify'),
path = require('path'),
fs = require('fs'),
rootDir = process.argv.length < 3 ? '.' : process.argv[2],
tree = {};
if ( ! fs.existsSync(rootDir)) {
console.error('path "' + rootDir + '" does not exist - unable to proceed!');
process.exit(1);
}
console.log(rootDir !== '.' ? path.relative(process.cwd(), rootDir) : '.');
function scanComplete() {
process.stdout.write('\r \r');
console.log(treeify.asTree(tree, true));
}
dive(rootDir, { all: true, directories: true }, function(err, thisPath) {
var relativePath = path.relative(rootDir, thisPath),
node = tree;
if (relativePath.indexOf('..') !== 0) {
relativePath.split(path.sep).forEach(function(part) {
typeof node[part] !== 'object' && (node[part] = {});
node = node[part];
});
}
}, scanComplete);
process.stdout.write('wait... ');
})();