Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: fix viewer deploy #6449

Merged
merged 1 commit into from
Nov 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions build/build-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const writeFileAsync = promisify(fs.writeFile);

const browserify = require('browserify');
const cpy = require('cpy');
const ghPages = promisify(require('gh-pages').publish);
const ghPages = require('gh-pages');
const glob = promisify(require('glob'));
const lighthousePackage = require('../package.json');
const makeDir = require('make-dir');
Expand Down Expand Up @@ -147,6 +147,23 @@ async function compileJs() {
await safeWriteFileAsync(`${distDir}/src/viewer.js`, uglified.code);
}

/**
* Publish viewer to gh-pages branch.
* @return {Promise<void>}
*/
async function deploy() {
return new Promise((resolve, reject) => {
ghPages.publish(distDir, {
add: true, // keep existing files
dest: 'viewer',
message: `Update viewer to lighthouse@${lighthousePackage.version}`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

}, err => {
if (err) return reject(err);
resolve();
});
});
}

/**
* Build viewer, optionally deploying to gh-pages if `--deploy` flag was set.
*/
Expand All @@ -162,10 +179,7 @@ async function run() {

const argv = process.argv.slice(2);
if (argv.includes('--deploy')) {
await ghPages(`${distDir}/**/*`, {
add: true, // keep existing files
dest: 'viewer',
}, () => {});
await deploy();
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"devtools-protocol": "0.0.588129",
"eslint": "^4.19.1",
"eslint-config-google": "^0.9.1",
"gh-pages": "0.12.0",
"gh-pages": "^2.0.1",
"glob": "^7.1.3",
"gulp": "^3.9.1",
"gulp-replace": "^0.5.4",
Expand Down
Loading