Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny committed Oct 24, 2018
1 parent 5279092 commit ac13d17
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
13 changes: 10 additions & 3 deletions build/bundle-builder.js → build/build-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,19 @@ async function build(entryPath, distPath) {
minifyScript(distPath);
}

// @ts-ignore Test if called from the CLI or as a module.
if (require.main === module) {
/**
* @param {Array<string>} argv
*/
async function cli(argv) {
// Take paths relative to cwd and build.
const [entryPath, distPath] = process.argv.slice(2)
const [entryPath, distPath] = argv.slice(2)
.map(filePath => path.resolve(process.cwd(), filePath));
build(entryPath, distPath);
}

// @ts-ignore Test if called from the CLI or as a module.
if (require.main === module) {
cli(process.argv);
} else {
module.exports = {
/** The commit hash for the current HEAD. */
Expand Down
8 changes: 5 additions & 3 deletions build/build-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ const fs = require('fs');
const archiver = require('archiver');
const cpy = require('cpy');
const makeDir = require('make-dir');
const bundleBuilder = require('./bundle-builder.js');
const bundleBuilder = require('./build-bundle.js');

const sourceDir = __dirname + '/../clients/extension';
const sourceName = 'extension-entry.js';
const distDir = __dirname + '/../dist/extension';
const distName = 'lighthouse-ext-bundle.js';

const sourceDir = __dirname + '/../clients/extension';
const distDir = __dirname + '/../dist/extension';

const manifestVersion = require(`${sourceDir}/manifest.json`).version;

/**
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"build-all:task": "yarn build-extension & yarn build-devtools & yarn build-lr & yarn build-viewer & wait",
"build-all:task:windows": "yarn build-extension && yarn build-devtools && yarn build-lr && yarn build-viewer",
"build-extension": "node ./build/build-extension.js",
"build-devtools": "node ./build/bundle-builder.js clients/devtools-entry.js dist/lighthouse-dt-bundle.js",
"build-lr": "node ./build/bundle-builder.js clients/lightrider-entry.js dist/lighthouse-lr-bundle.js",
"build-devtools": "node ./build/build-bundle.js clients/devtools-entry.js dist/lighthouse-dt-bundle.js",
"build-lr": "node ./build/build-bundle.js clients/lightrider-entry.js dist/lighthouse-lr-bundle.js",
"build-viewer": "cd ./lighthouse-viewer && yarn build",
"clean": "rimraf dist proto/scripts/*.json proto/scripts/*_pb2.* proto/scripts/*_pb.* proto/scripts/__pycache__ proto/scripts/*.pyc *.report.html *.report.dom.html *.report.json *.devtoolslog.json *.trace.json || true",
"lint": "[ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .",
Expand Down

0 comments on commit ac13d17

Please sign in to comment.