question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Automate regular updates to browserslist

See original GitHub issue

Feature Description

Browserslist is industry-standard to set target browsers for web projects.

The database of browsers it references needs to be upgraded on a regular basis in order to get the most benefit.

From https://github.com/browserslist/browserslist#browsers-data-updating

npx browserslist@latest --update-db updates caniuse-lite version in your npm, yarn or pnpm lock file. This update will bring data about new browsers to polyfills tools like Autoprefixer or Babel and reduce already unnecessary polyfills.

You need to do it regularly for three reasons:

  1. To use the latest browser’s versions and statistics in queries like last 2 versions or >1%. For example, if you created your project 2 years ago and did not update your dependencies, last 1 version will return 2 year old browsers.
  2. Actual browsers data will lead to using less polyfills. It will reduce size of JS and CSS files and improve website performance.
  3. caniuse-lite deduplication: to synchronize version in different tools.

One option might be to leverage a GitHub action to run on a schedule and open a PR automatically, e.g. https://github.com/marketplace/actions/browserslist-update-action


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • There should be a GitHub Action set up to run that automatically updates browserlist—say every week, preferably on a weekend when commits are not likely to be made by the team.

Implementation Brief

Test Coverage

  • No new tests needed.

QA Brief

  • No QA needed, aside from verifying the PR is created. This should be checked Monday morning or later by an engineer (Monday October 31). This workflow can also be manually run here.
  • On every workflow run, verify that if there is an existing branch with the name update/browserslist-db, it is deleted and any PR associated with it is closed (if open).

Changelog entry

  • N/A

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:23 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
felixarntzcommented, Nov 7, 2022

@techanvil @nfmohit @tofumatt @aaemnnosttv Providing an update here: Per Google policy we will not be able to use code “authored” by the github-actions user. We will have to create a Google-owned bot account (e.g. something like site-kit-bot) and configure that one with the GitHub repository. There are internal instructions available for how to do that.

@aaemnnosttv will open a follow up issue to track that work. Most of it will have to happen internally, but the final bit will require changes in the plugin codebase (GitHub action). I will close this issue now as by itself it works as expected (except of course for the above, which however was not part of this issue’s definition).

For now, this means the caveat is that we shouldn’t merge/accept those automated PRs for the time being. If we prefer to not get the “noise” of those PRs for now, we could also deactivate the action for now until we have addressed the above.

2reactions
techanvilcommented, Nov 3, 2022

Hey @nfmohit, taking looking at this in lieu of @tofumatt - seems to me your proposed PR solves the problem well enough without needing to make the branch name unique.

If we do run into a situation where the static branch name is a problem we have a good idea of how to address is. But I think we can hold off for now and see how we get on.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Speed up with Browserslist - DEV Community ‍ ‍
How to make your website faster using Browserslist. ... For example, if you can update this data on every deploy, then your website...
Read more >
Browserslist
Shared browser compatibility config for popular JavaScript tools like Autoprefixer, Babel, ESLint, PostCSS, and Webpack. Supported by Evil Martians and Cube ...
Read more >
browserslist-config-normal - npm package - Snyk
The npm package browserslist-config-normal was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package ...
Read more >
#53685 (Update the `caniuse` database when running `grunt ...
The recommended way to do this is running npx browserslist@latest --update-db . Commits (0). Pull ...
Read more >
[#MDL-76491] ESlint rules are not catching undefined use of ...
... "eslint:amd" (eslint) task Browserslist: caniuse-lite is outdated. Please run: npx browserslist@latest --update-db Why you should do it regularly: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found