Skip to content

Include commit hash and version to browser extension#2236

Merged
brendankenny merged 10 commits intoGoogleChrome:masterfrom
wardpeet:feat/banner-hash
Aug 14, 2017
Merged

Include commit hash and version to browser extension#2236
brendankenny merged 10 commits intoGoogleChrome:masterfrom
wardpeet:feat/banner-hash

Conversation

@wardpeet
Copy link
Collaborator

@wardpeet wardpeet commented May 12, 2017

fixes #2190

@wardpeet wardpeet force-pushed the feat/banner-hash branch from b614568 to a2a83d5 Compare May 12, 2017 18:29
@wardpeet
Copy link
Collaborator Author

image

@wardpeet wardpeet force-pushed the feat/banner-hash branch from 4df94cf to 3357c18 Compare May 29, 2017 19:11
@wardpeet
Copy link
Collaborator Author

Rebased and ready to go!
image

Copy link
Contributor

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

Review! This is kind of ridiculously long in coming, but we need this :)

Mostly comments on how we could maybe simplify this. Let me know what you think.

return chrome.runtime.getManifest().version;
}

function getLighthouseRevision() {
Copy link
Contributor

Choose a reason for hiding this comment

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

bikeshed: can we call this getLighthouseCommitHash or something like that (and update references to REVISION below)? I wasn't sure what "revision" was referring to until I got to where it was defined :)

**Lighthouse Revision** below could be **Lighthouse Commit**, for instance.

Just an idea, though. Open to other ways people refer to the exact commit

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't mind what it's called

bundle.transform('browserify-versionify', {
placeholder: '__REVISION__',
version: REVISION,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

could we drop the insertGlobalVars/browserify-versionify parts and just do a .pipe(gulpReplace('__REVISION__', REVISION))?

Copy link
Contributor

Choose a reason for hiding this comment

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

.pipe(gulpReplace('__REVISION__', REVISION))

we could make the string to replace even more unique if necessary

file.contents = new Buffer(minified);
return file;
}))
.pipe(banner(BANNER))
Copy link
Contributor

Choose a reason for hiding this comment

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

Since it's a build step (and so just devDependencies), I personally don't particularly mind using yet another gulp library instead of writing our own function. It seems like gulp-header would let you inject this comment pretty easily at the top.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, I can take a dependency, just didn't want to introduce another one but yeah dev dependency doesn't really matter

package.json Outdated
"devDependencies": {
"@types/node": "^6.0.45",
"babel-core": "^6.16.0",
"browserify-versionify": "^1.0.6",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we want this (or whatever new deps we add) in lighthouse-extension/package.json so that it's scoped to only install for those who are working on/with the extension

@wardpeet
Copy link
Collaborator Author

@brendankenny @paulirish just notifying you guys. Pretty sure it's ok now.

Copy link
Contributor

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

two small last changes to this but I think it's good otherwise

yarn.lock Outdated
version "0.1.1"
resolved "https://registry.yarnpkg.com/find-index/-/find-index-0.1.1.tgz#675d358b2ca3892d795a1ab47232f8b6e2e0dde4"

find-root@^0.1.1:
Copy link
Contributor

Choose a reason for hiding this comment

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

is this still necessary? Seems like changes to this file should have been dropped since no changes to root package.json

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I cleaned the yarn.lock with executing yarn, should be good to go

const distDir = 'dist';

const VERSION = pkg.version;
const COMMITHASH = require('child_process')
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe COMMIT_HASH?

@brendankenny
Copy link
Contributor

reverted part of a comment removed by a merge

Copy link
Contributor

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

LGTM

@brendankenny brendankenny merged commit 7fe3574 into GoogleChrome:master Aug 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose git hash to extension build - followup

2 participants