OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 "use strict"; |
| 6 |
| 7 const fs = require('fs'); |
| 8 const path = require('path'); |
| 9 |
| 10 const utils = require('../utils'); |
| 11 |
| 12 const FRONTEND_PATH = path.resolve(__dirname, '..', '..', 'front_end'); |
| 13 const OUT = path.resolve(__dirname, 'out', 'dependencies.dot'); |
| 14 |
| 15 function main() { |
| 16 const modules = new Set(); |
| 17 const moduleToDependencyList = ['digraph dependencies {']; |
| 18 fs.readdirSync(FRONTEND_PATH).forEach(function(file) { |
| 19 const moduleJSONPath = path.join(FRONTEND_PATH, file, 'module.json'); |
| 20 if (fs.statSync(path.join(FRONTEND_PATH, file)).isDirectory() && |
| 21 utils.isFile(moduleJSONPath)) { |
| 22 const module = file; |
| 23 modules.add(module); |
| 24 const moduleJSON = require(moduleJSONPath); |
| 25 if (moduleJSON.dependencies) { |
| 26 for (let d of moduleJSON.dependencies) { |
| 27 moduleToDependencyList.push(` ${module} -> ${d}`); |
| 28 } |
| 29 } |
| 30 } |
| 31 }); |
| 32 moduleToDependencyList.push('}'); |
| 33 const content = moduleToDependencyList.join('\n'); |
| 34 fs.writeFileSync(OUT, content); |
| 35 } |
| 36 |
| 37 if (require.main === module) |
| 38 main(); |
OLD | NEW |