Skip to content

Commit

Permalink
misc: add cli module diagram (#6129)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Sep 28, 2018
1 parent 5745790 commit 08db099
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions lighthouse-cli/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@
const fs = require('fs');
const path = require('path');

/*
* The relationship between these CLI modules:
*
* index.js : only calls bin.js's begin()
* cli-flags.js : leverages yargs to read argv, outputs LH.CliFlags
* bin.js : CLI args processing. cwd, list/print commands
* run.js : chrome-launcher bits, calling lighthouse-core, output to Printer
*
* index ----> bin ----> run ----> printer
* ⭏ ⭎ ⭏ ⭎
* cli-flags lh-core/index
*/

const commands = require('./commands/commands.js');
const printer = require('./printer.js');
const getFlags = require('./cli-flags.js').getFlags;
Expand Down Expand Up @@ -95,7 +108,7 @@ if (cliFlags.extraHeaders) {
/**
* @return {Promise<LH.RunnerResult|void>}
*/
async function run() {
async function begin() {
if (cliFlags.printConfig) {
const config = generateConfig(configJson, cliFlags);
process.stdout.write(config.getPrintString());
Expand Down Expand Up @@ -127,5 +140,5 @@ async function run() {
}

module.exports = {
run,
begin,
};
2 changes: 1 addition & 1 deletion lighthouse-cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
*/
'use strict';

require('./bin.js').run();
require('./bin.js').begin();

0 comments on commit 08db099

Please sign in to comment.