Skip to content

Commit

Permalink
Install child folder deps through helper script (#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish authored Jul 8, 2016
1 parent fcf82d2 commit e28ee77
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
43 changes: 43 additions & 0 deletions _install_deps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* @license
* Copyright 2016 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

const exec = require('child_process').exec;

const cwd = require('path').resolve();
const corePath = `${cwd}/lighthouse-core`;
const extPath = `${cwd}/lighthouse-extension`;

const npm = 'npm --prefix';
const cmd = `${npm} ${corePath} install ${corePath} && ${npm} ${extPath} install ${extPath}`;

// Tell the user what command we're about to execute
console.log(cmd);
console.log('...');

exec(cmd,
function(error, stdout, stderr) {
process.stderr.write(stderr);
process.stdout.write(stdout);
if (stdout.length === 0) {
console.log('The full install may not have completed.');
console.log('To manually install child dependencies:');
console.log(` ${cmd}`);
}
});

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
},
"scripts": {
"//": "// passing through tasks to core",
"postinstall": "npm run core-install && npm run extension-install",
"core-install": "npm --prefix ./lighthouse-core install ./lighthouse-core",
"extension-install": "npm --prefix ./lighthouse-extension install ./lighthouse-extension",
"postinstall": "node _install_deps.js",
"lint": "eslint .",
"smoke": "lighthouse-cli/scripts/run-smoke-tests.sh",
"coverage": "istanbul cover -x \"**/third_party/**\" _mocha -- $(find */test -name '*.js') --timeout 60000",
Expand Down

0 comments on commit e28ee77

Please sign in to comment.