Add install/build scripts for each package.json (#1439)

* Prepublish commands to do the initial building
* Update CLI warning for ts compile
* Remove prepublish. Add helpful build scripts
* Keep prepublish for tsc compile
* make node4 happy
This commit is contained in:
Eric Bidelman 2017-01-12 02:28:53 -08:00 коммит произвёл Paul Irish
Родитель df9e8f1869
Коммит b810242d25
7 изменённых файлов: 26 добавлений и 33 удалений

Просмотреть файл

@ -15,26 +15,21 @@ cache:
- lighthouse-viewer/node_modules
install:
- npm install
- npm run install-all
before_script:
- if [[ $(node -v) =~ ^v4.* ]]; then export __node_harmony=--harmony; fi
- npm i -g typescript@2.0
- npm --prefix ./lighthouse-extension install ./lighthouse-extension
- npm --prefix ./lighthouse-viewer install ./lighthouse-viewer
- export DISPLAY=:99.0
- export LIGHTHOUSE_CHROMIUM_PATH="$(pwd)/chrome-linux/chrome"
- sh -e /etc/init.d/xvfb start
- ./lighthouse-core/scripts/download-chrome.sh
- cd lighthouse-cli && tsc && cd ..
- npm run build-cli
- npm run build-extension
- npm run build-viewer
script:
- if [[ $(node -v) =~ ^v4.* ]]; then export __node_harmony=--harmony; fi
- npm run lint
- npm run unit
- npm run smoke
- npm run smokehouse
- cd lighthouse-extension
- gulp build -- $__node_harmony
- cd ..
- cd lighthouse-viewer
- gulp
- cd ..
after_success:
- npm run coveralls

Просмотреть файл

@ -20,25 +20,23 @@ accept your pull requests.
1. Ensure that your code adheres to the existing style in the sample to which you are contributing.
1. Submit a pull request.
## Release guide
```sh
# * Build the latest *
# * Install the latest. This also builds the cli, extension, and viewer *
yarn
cd lighthouse-cli; yarn; yarn run build; cd ..
cd lighthouse-viewer; yarn; gulp; cd ..
cd lighthouse-extension; yarn; gulp build; cd ..
yarn install-all
yarn build-all
# * Bump it *
echo "Bump the versions in extension/app/manifest.json and package.json"
# * Test err'thing *
# * Test err'thing *
echo "Test the CLI."
yarn run smoke
echo "Test the extension"
echo "Test a fresh local install (see below)"
echo "Test a fresh local install"
# (starting from lighthouse root...)
# cd ..; mkdir tmp; cd tmp
# npm install ../lighthouse
@ -49,9 +47,7 @@ echo "Test a fresh local install (see below)"
echo "Test the lighthouse-viewer build"
# Manual test for now:
# cd lighthouse-viewer
# gulp build
# start a server in dist/ and open the page in a tab. You should see the viewer.
# Start a server in lighthouse-viewer/dist/ and open the page in a tab. You should see the viewer.
# Drop in a results.json or paste an existing gist url (e.g. https://gist.github.com/ebidel/b9fd478b5f40bf5fab174439dc18f83a).
# Check for errors!
@ -71,8 +67,4 @@ echo "Generate the release notes, and update the release page"
# * Tell the world!!! *
echo "Inform various peoples"
# * Testing a fresh local install *
```

Просмотреть файл

@ -6,7 +6,7 @@ const path = require('path');
module.exports = function(filename) {
if (!fs.existsSync(path.join(__dirname, filename))) {
console.log('Oops! Looks like the CLI needs to be compiled. Please run:');
console.log(' cd lighthouse-cli && npm install && npm run build');
console.log(' npm run install-cli');
console.log('More at: https://github.com/GoogleChrome/lighthouse#develop');
process.exit(1);
}

Просмотреть файл

@ -1,6 +1,7 @@
{
"main": "index.js",
"scripts": {
"prepublish": "npm run build",
"build": "tsc",
"dev": "tsc -w"
},

Просмотреть файл

@ -6,7 +6,7 @@
},
"scripts": {
"watch": "gulp watch",
"build": "gulp build"
"build": "gulp build -- $__node_harmony"
},
"devDependencies": {
"brfs": "^1.4.3",

Просмотреть файл

@ -11,6 +11,14 @@
"node": ">=5"
},
"scripts": {
"install-all": "npm run install-cli && npm run install-extension && npm run install-viewer",
"install-cli": "npm install -C ./lighthouse-cli",
"install-extension": "npm install -C ./lighthouse-extension",
"install-viewer": "npm install -C ./lighthouse-viewer",
"build-all": "npm run build-cli && npm run build-extension && npm run build-viewer",
"build-cli": "npm run build -C ./lighthouse-cli",
"build-extension": "npm run build -C ./lighthouse-extension",
"build-viewer": "npm run build -C ./lighthouse-viewer",
"lint": "[ \"$CI\" = true ] && eslint --quiet -f codeframe . || eslint .",
"smoke": "lighthouse-cli/test/smokehouse/offline-local/run-tests.sh && lighthouse-cli/test/smokehouse/dobetterweb/run-tests.sh",
"coverage": "node $__node_harmony $(npm bin)/istanbul cover -x \"**/third_party/**\" _mocha -- $(find */test -name '*-test.js') --timeout 10000 --reporter progress",

Просмотреть файл

@ -39,7 +39,7 @@ lighthouse --help
## Lighthouse Viewer
If you run Lighthouse with the `--output=json` flag, it will generate a json dump of the run. You can view this report online by visiting http://googlechrome.github.io/lighthouse/viewer/ and dragging the file onto the app. Reports can also be shared by clicking the share icon in the top right corner and signing in to Github.
If you run Lighthouse with the `--output=json` flag, it will generate a json dump of the run. You can view this report online by visiting http://googlechrome.github.io/lighthouse/viewer/ and dragging the file onto the app. Reports can also be shared by clicking the share icon in the top right corner and signing in to Github.
Note: shared reports are stashed as a secret Gist in Github, under your account.
@ -51,13 +51,10 @@ git clone https://github.com/GoogleChrome/lighthouse
cd lighthouse
npm install
npm install-all
# The CLI is authored in TypeScript and requires compilation:
cd lighthouse-cli
npm install
npm run build
# To run the TS compiler in watch mode:
# The CLI is authored in TypeScript and requires compilation.
# If you need to make changes to the CLI, run the TS compiler in watch mode:
# cd lighthouse-cli && npm run dev
```