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(changelog-generator): Generate changelogs #3632

Merged
merged 13 commits into from
Nov 11, 2017

Conversation

wardpeet
Copy link
Collaborator

@wardpeet wardpeet commented Oct 21, 2017

Generates a changelog when running yarn changelog:generate

<a name="2.5.1"></a>
# 2.5.1 (2017-10-21)
[Full Changelog](https://github.com/googlechrome/lighthouse/compare/v2.5.0...v2.5.1)

  ### New audit

    * descriptive anchor text audit (#3490) ([f911e84](https://github.com/googlechrome/lighthouse/commit/f911e84))

  ### Core

    * add category weight to perf config (#3529) ([6af2eb1](https://github.com/googlechrome/lighthouse/commit/6af2eb1))
    * add silent seo audits to default config (#3582) ([67ebde2](https://github.com/googlechrome/lighthouse/commit/67ebde2))
    * Re-weight a11y scores based on severity and frequency (#3515) ([48296c8](https://github.com/googlechrome/lighthouse/commit/48296c8))
    * Remove iframe as Critical Request (#3583) ([cd14d38](https://github.com/googlechrome/lighthouse/commit/cd14d38))
    * add acyclic check (#3592) ([74ae043](https://github.com/googlechrome/lighthouse/commit/74ae043))
    * fix missing `Runtime.experiments` object (#3514) ([b98e8a3](https://github.com/googlechrome/lighthouse/commit/b98e8a3)), closes [#3514](https://github.com/googlechrome/lighthouse/issues/3514)
    * use execution context isolation when necessary (#3500) ([04b685f](https://github.com/googlechrome/lighthouse/commit/04b685f))
    * remove use of deprecated Emulation.setVisibleSize (#3536) ([ecbbc38](https://github.com/googlechrome/lighthouse/commit/ecbbc38))
    * include runtime exceptions (#3494) ([487bee6](https://github.com/googlechrome/lighthouse/commit/487bee6))
    * pass audit when no images are missized (#3552) ([62e4b74](https://github.com/googlechrome/lighthouse/commit/62e4b74))
    * refactor simulation logic (#3489) ([fc88101](https://github.com/googlechrome/lighthouse/commit/fc88101))
    * add transferSize sanity check (#3606) ([e3888c6](https://github.com/googlechrome/lighthouse/commit/e3888c6))
    * fix typo in image-aspect-ratio audit (#3513) ([87c3acf](https://github.com/googlechrome/lighthouse/commit/87c3acf)), closes [#3513](https://github.com/googlechrome/lighthouse/issues/3513)
    * add cz-customizable to establish a commit message convention (#3499) ([7711705](https://github.com/googlechrome/lighthouse/commit/7711705))

  ### Docs

    * add results object explainer (#3495) ([6f9d593](https://github.com/googlechrome/lighthouse/commit/6f9d593))
    * Updating "good first bug" (#3535) ([fc658f3](https://github.com/googlechrome/lighthouse/commit/fc658f3))
    * Updating bug labels (#3525) ([c0603d3](https://github.com/googlechrome/lighthouse/commit/c0603d3))
    * pr title guidelines (#3590) ([e0bdcc2](https://github.com/googlechrome/lighthouse/commit/e0bdcc2))
    * add Treo to the list of integrations (#3484) ([f21fc0a](https://github.com/googlechrome/lighthouse/commit/f21fc0a))
    * because comcast throttles the websocket ([bedb9a1](https://github.com/googlechrome/lighthouse/commit/bedb9a1))

  ### Feat

    * Adding Redirect audit (PSI Compat) (#3308) ([b074ac7](https://github.com/googlechrome/lighthouse/commit/b074ac7))

  ### Misc

    * removed unused audit meta.category (#3554) ([da35caa](https://github.com/googlechrome/lighthouse/commit/da35caa))
    * Generate changelogs ([23b9740](https://github.com/googlechrome/lighthouse/commit/23b9740))
    * add CODEOWNERS file (#3591) ([b6a676a](https://github.com/googlechrome/lighthouse/commit/b6a676a))
    * new-audit => new_audit (#3534) ([1fca06e](https://github.com/googlechrome/lighthouse/commit/1fca06e))
    * Enable type checking for JavaScript (#3589) ([cc28720](https://github.com/googlechrome/lighthouse/commit/cc28720))
    * fix formatting for changelog ([75b039f](https://github.com/googlechrome/lighthouse/commit/75b039f))
    * Create bug-labels.md ([58930e1](https://github.com/googlechrome/lighthouse/commit/58930e1))
    * web-inspector: fall back to page's Runtime and queryParam() (#3497) ([f7a3a27](https://github.com/googlechrome/lighthouse/commit/f7a3a27))
    * Bump launcher to 0.8.1 (#3479) ([05030ad](https://github.com/googlechrome/lighthouse/commit/05030ad))

  ### Report

    * improve actionability of helpText (#3544) ([450d2d3](https://github.com/googlechrome/lighthouse/commit/450d2d3))

  ### Test

    * Passive event listener violation doesn't report on passive:false now (#3498) ([c56c97b](https://github.com/googlechrome/lighthouse/commit/c56c97b))

  ### Tests

    * update eslint (and goog config) to latest (#3396) ([a86c4b4](https://github.com/googlechrome/lighthouse/commit/a86c4b4))
    * use --quiet flag rather than --silent (#3491) ([320eb1f](https://github.com/googlechrome/lighthouse/commit/320eb1f))

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

nice @wardpeet thanks for picking this up!


{{~!-- commit hash --}} {{#if @root.linkReferences}}([{{hash}}]({{#if @root.host}}{{@root.host}}/{{/if}}{{#if @root.owner}}{{@root.owner}}/{{/if}}{{@root.repository}}/{{@root.commit}}/{{hash}})){{else}}{{hash~}}{{/if}}

{{~!-- commit references --}}{{#if references}}, closes{{~#each references}} {{#if @root.linkReferences}}[{{#if this.owner}}{{this.owner}}/{{/if}}{{this.repository}}#{{this.issue}}]({{#if @root.host}}{{@root.host}}/{{/if}}{{#if this.repository}}{{#if this.owner}}{{this.owner}}/{{/if}}{{this.repository}}{{else}}{{#if @root.owner}}{{@root.owner}}/{{/if}}{{@root.repository}}{{/if}}/{{@root.issue}}/{{this.issue}}){{else}}{{#if this.owner}}{{this.owner}}/{{/if}}{{this.repository}}#{{this.issue}}{{/if}}{{/each}}{{/if}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is, uh, quite the line 😄

any chance we can break it up and use the fancy whitespace removers ~?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes we can, just copy and paste 😊

commit.hash = commit.hash.substring(0, 7);
}

if (commit.type) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we also de-dupe test and tests while we're in here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fine by me, I just copy pasted it 😊

@wardpeet
Copy link
Collaborator Author

one question do we want to show

closes #3514

@patrickhulce
Copy link
Collaborator

Hm I personally don't think it's necessary to reference the closed issues when the PR is referenced, but I'm open to others thoughts?

@paulirish @brendankenny ?

@paulirish
Copy link
Member

paulirish commented Oct 28, 2017 via email

Copy link
Member

@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.

looking good! A few other things:

  • Pull the PR # out of the string in headerPattern as well? (though still print it as it is now)
  • Maybe don't include the commit hash if the PR# exists? Not sure how others feel, but I never care about the actual commit over the PR that generated it
  • different directory? I don't have a great alternate suggestion, but maybe this could live under docs/? Or have a top level build/ directory or something

@@ -0,0 +1,55 @@
'use strict';
Copy link
Member

Choose a reason for hiding this comment

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

needs license header

commitsSort: ['type', 'scope', 'message'],
};

const template = readFileSync(resolve(__dirname, 'templates/template.hbs')).toString();
Copy link
Member

Choose a reason for hiding this comment

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

maybe move these declarations to top of file so writerOpts.mainTemplate, etc can just be defined in the object literal?

@@ -0,0 +1,46 @@
* {{#if message ~}}
Copy link
Member

Choose a reason for hiding this comment

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

license header for these templates, too (need to convert to handlebars comments, I guess)

package.json Outdated
@@ -46,14 +46,16 @@
"smokehouse": "node lighthouse-cli/test/smokehouse/smokehouse.js",
"deploy-viewer": "cd lighthouse-viewer && gulp deploy",
"bundlesize": "bundlesize",
"plots-smoke": "bash plots/test/smoke.sh"
"plots-smoke": "bash plots/test/smoke.sh",
"changelog:generate": "conventional-changelog -n ./conventional-changelog-lighthouse/index.js -i CHANGELOG.md -s"
Copy link
Member

Choose a reason for hiding this comment

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

not sure how others feel, but I'd prefer just yarn changelog

@brendankenny
Copy link
Member

also, I think I ran into that semver/tagging issue you were talking about. When I run this locally (after bumping to 2.6.0 for testing purposes) it does v2.4.0...v2.6.0 instead of v2.5.1...v2.6.0.

Did you figure out a fix for that? The conventional-changelog docs are spread out over several repos, so it's not clear to me how to fix that (just a reference to "gitRawCommitsOpts.from defaults to the latest semver tag", but 2.4.0 isn't the latest semver tag...)

@wardpeet
Copy link
Collaborator Author

wardpeet commented Nov 3, 2017

@brendankenny could it be that you didn't create a tag from master as when I redid the tagging through master all went ok

I created the correct tag on github so it should work now if you do a git fetch

@wardpeet
Copy link
Collaborator Author

wardpeet commented Nov 3, 2017

@brendankenny now it shows PRs and no issue references

 <a name="2.5.1"></a>
# 2.5.1 (2017-11-03)
[Full Changelog](https://github.com/googlechrome/lighthouse/compare/v2.5.0...v2.5.1)

### New audit

* descriptive anchor text audit ([#3490](https://github.com/googlechrome/lighthouse/pull/3490))

### Core

* skip aspect ratio audit for svg ([#3722](https://github.com/googlechrome/lighthouse/pull/3722))
* add category weight to perf config ([#3529](https://github.com/googlechrome/lighthouse/pull/3529))
* add silent seo audits to default config ([#3582](https://github.com/googlechrome/lighthouse/pull/3582))
* Re-weight a11y scores based on severity and frequency ([#3515](https://github.com/googlechrome/lighthouse/pull/3515))
* Remove iframe as Critical Request ([#3583](https://github.com/googlechrome/lighthouse/pull/3583))
* add acyclic check ([#3592](https://github.com/googlechrome/lighthouse/pull/3592))
* fix missing `Runtime.experiments` object ([#3514](https://github.com/googlechrome/lighthouse/pull/3514))
* use execution context isolation when necessary ([#3500](https://github.com/googlechrome/lighthouse/pull/3500))
* add cz-customizable to establish a commit message convention ([#3499](https://github.com/googlechrome/lighthouse/pull/3499))
* Fix minor grammatical error ([#3638](https://github.com/googlechrome/lighthouse/pull/3638))
* remove use of deprecated Emulation.setVisibleSize ([#3536](https://github.com/googlechrome/lighthouse/pull/3536))
* record top-level warnings in LHR and display in report ([#3692](https://github.com/googlechrome/lighthouse/pull/3692))
* include runtime exceptions ([#3494](https://github.com/googlechrome/lighthouse/pull/3494))
* pass audit when no images are missized ([#3552](https://github.com/googlechrome/lighthouse/pull/3552))
* add error reporting ([#2420](https://github.com/googlechrome/lighthouse/pull/2420))
* refactor simulation logic ([#3489](https://github.com/googlechrome/lighthouse/pull/3489))
* add transferSize sanity check ([#3606](https://github.com/googlechrome/lighthouse/pull/3606))
* fix typo in image-aspect-ratio audit ([#3513](https://github.com/googlechrome/lighthouse/pull/3513))

### Docs

* add results object explainer ([#3495](https://github.com/googlechrome/lighthouse/pull/3495))
* Updating "good first bug" ([#3535](https://github.com/googlechrome/lighthouse/pull/3535))
* Updating bug labels ([#3525](https://github.com/googlechrome/lighthouse/pull/3525))
* pr title guidelines ([#3590](https://github.com/googlechrome/lighthouse/pull/3590))
* correct capitalization of GitHub ([#3669](https://github.com/googlechrome/lighthouse/pull/3669))
* add MagicLight WebBLE integration ([#3613](https://github.com/googlechrome/lighthouse/pull/3613))
* add Treo to the list of integrations ([#3484](https://github.com/googlechrome/lighthouse/pull/3484))
* because comcast throttles the websocket([bedb9a1](https://github.com/googlechrome/lighthouse/commit/bedb9a1))

### Feat

* Adding Redirect audit (PSI Compat) ([#3308](https://github.com/googlechrome/lighthouse/pull/3308))

### Misc

* add commitlint config (for commitlintbot)([21e25aa](https://github.com/googlechrome/lighthouse/commit/21e25aa))
* Remove # from pr([01efa91](https://github.com/googlechrome/lighthouse/commit/01efa91))
* Fix template([0d77fa9](https://github.com/googlechrome/lighthouse/commit/0d77fa9))
* Combine test and tests to one category([7b0ac70](https://github.com/googlechrome/lighthouse/commit/7b0ac70))
* Fix eslint([afe3364](https://github.com/googlechrome/lighthouse/commit/afe3364))
* Update changelog script([11634e2](https://github.com/googlechrome/lighthouse/commit/11634e2))
* fix formatting for changelog([6b78e85](https://github.com/googlechrome/lighthouse/commit/6b78e85))
* web-inspector: fall back to page's Runtime and queryParam() ([#3497](https://github.com/googlechrome/lighthouse/pull/3497))
* Add pr links & remove issue references([8e26dfd](https://github.com/googlechrome/lighthouse/commit/8e26dfd))
* Create bug-labels.md([58930e1](https://github.com/googlechrome/lighthouse/commit/58930e1))
* Bump launcher to 0.8.1 ([#3479](https://github.com/googlechrome/lighthouse/pull/3479))
* removed unused audit meta.category ([#3554](https://github.com/googlechrome/lighthouse/pull/3554))
* Generate changelogs([623c4cc](https://github.com/googlechrome/lighthouse/commit/623c4cc))
* add CODEOWNERS file ([#3591](https://github.com/googlechrome/lighthouse/pull/3591))
* new-audit => new_audit ([#3534](https://github.com/googlechrome/lighthouse/pull/3534))
* Enable type checking for JavaScript ([#3589](https://github.com/googlechrome/lighthouse/pull/3589))
* provide svg logo as png([8b3d7f0](https://github.com/googlechrome/lighthouse/commit/8b3d7f0))

### Report

* reformat results, incl all requests and wasted time, ([#3492](https://github.com/googlechrome/lighthouse/pull/3492))
* improve actionability of helpText ([#3544](https://github.com/googlechrome/lighthouse/pull/3544))

### Tests

* update eslint (and goog config) to latest ([#3396](https://github.com/googlechrome/lighthouse/pull/3396))
* use --quiet flag rather than --silent ([#3491](https://github.com/googlechrome/lighthouse/pull/3491))
* disable multiple shadow root deprecation test ([#3695](https://github.com/googlechrome/lighthouse/pull/3695))
* Passive event listener violation doesn't report on passive:false now ([#3498](https://github.com/googlechrome/lighthouse/pull/3498))
* add test for setImmediate polyfill ([#3670](https://github.com/googlechrome/lighthouse/pull/3670))

@brendankenny
Copy link
Member

could it be that you didn't create a tag from master as when I redid the tagging through master all went ok. I created the correct tag on github so it should work now if you do a git fetch

hmm, still does v2.4.0...v2.6.0 for me even though git tag definitely shows a v2.5.0 for me. I could be holding it wrong, though

groupBy: 'type',
commitGroupsSort: (a, b) => {
// put new audit on the top
if (b.title === 'New audit') {
Copy link
Member

Choose a reason for hiding this comment

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

this isn't working for me. I think you also need to handle the other case, too (if (a.title === 'New audit') return -1)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

my mistake! it works now!

commit.type = 'Misc';
}

let pullRequestMatch = commit.header.match(/\(#(\d+)\)/);
Copy link
Member

Choose a reason for hiding this comment

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

what's the difference between this case and the message one below? Is header the initial line of the commit message?

Copy link
Member

Choose a reason for hiding this comment

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

Also, should we be checking that the PR # is at the end of the string? (the default positioning from the squash and merge button). A #XXXX elsewhere could be e.g. a reference to an issue

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

header is indeed the first line and message is the rest. When I only ran it on message I didn't get all the PR references if I check both I do.

For the regex, i checked the last 50 commits and we never refer an issue in the commit header but better save than sorry so edited the regex!


return a.title.localeCompare(b.title);
},
commitsSort: ['type', 'scope', 'message'],
Copy link
Member

Choose a reason for hiding this comment

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

In the past we've only sorted by type and scope (if it exists) and then by commit order, but not sure if that's possible with this

* 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.
*/
--}}
* {{#if message ~}}
Copy link
Member

Choose a reason for hiding this comment

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

include scope?

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

💯 lgtm % nits

{{~@root.repository}}/{{@root.commit}}/{{hash}}))
{{~/if~}}
{{~else~}}
{{~hash~}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we need to preserve a single space here, the formatting looks off compared to ones with a PR link

image

groupBy: 'type',
commitGroupsSort: (a, b) => {
// put new audit on the top
if (a.title === 'New audit') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we similarly force Misc to the bottom? feels a bit weird in the middle

@brendankenny
Copy link
Member

brendankenny commented Nov 10, 2017

  • fixed @patrickhulce's two formatting nits
  • moved under a top level build/ directory (where other things e.g. our browserifying gulpfile could someday live)
  • moved to just yarn changelog

I talked to @paulirish about build/ before he left and he was good with it, but others feel free to weigh in.

@wardpeet feel free to revert commit or add changes on top of it :)

@brendankenny
Copy link
Member

the tagging thing is still messed up for me, but if it's working for you we can figure it out once it's on master

Copy link
Member

@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, over to @wardpeet to approve

@wardpeet
Copy link
Collaborator Author

@brendankenny thanks for the fixes.
Could you try to reclone lighthouse in another directory and see if it works? As I still think it's our local git that hasn't updating it's tags.

@wardpeet wardpeet merged commit 5b96072 into master Nov 11, 2017
@brendankenny brendankenny deleted the feature/generate-changelog branch November 18, 2017 00:35
christhompson pushed a commit to christhompson/lighthouse that referenced this pull request Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants