-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·32 lines (26 loc) · 1.13 KB
/
index.js
File metadata and controls
executable file
·32 lines (26 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env node
// reason: this is the main entry to the module walker. if something
// goes wrong it has to decide what exit code to return. hence, it
// has to be able to use process.exit()
/* eslint no-process-exit: 0 */
const cli = require('commander'),
main = require('./lib/main'),
{loadConfigFromCLI} = require('./lib/configuration'),
{collect,findBaseDir} = require('./lib/collectInput'),
{parseImports} = require('./lib/parseImports'),
{printDot} = require('./lib/printDot');
cli.arguments('<files>', 'Files or folders containing files of the project to analyze')
.option('-o, --output [file]', 'save output in file')
.option('--find-cycles', 'detect and highlight cyclic dependencies')
.option('--ignore-packages', 'ignore dependencies into packages from e.g. node modules')
.parse(process.argv);
function handleError(error) {
console.error(`An error occurred: ${error}`);
cli.outputHelp((helpText) => {
console.log(helpText);
process.exit(1);
});
}
main(cli, {loadConfigFromCLI, collect, findBaseDir, parseImports, printDot})
.then(() => {})
.catch(handleError);