compat icon indicating copy to clipboard operation
compat copied to clipboard

Broken CanIUse repo link since switch from "master" to "main"

Open Beatboxace opened this issue 4 years ago • 2 comments

Context

Compat uses the CanIUse repository to validate feature compatibility by grabbing the latest git commit.

Issue

This is hardcoded at line 181 from createTable.js: getLatestCommitSHA('fyrd', 'caniuse', 'heads/master') In recent changes, the "master" branches got renamed to "main" to follow BLM movement, a seen here. Thus, it can no longer resolve and running compat now fails with an error:

stderr: (node:40588) UnhandledPromiseRejectionWarning: Error: Failed to load latest commit
at ClientRequest.<anonymous> ([MyPath]\node_modules\compat-cli\src\tableUpdater\createTable.js:158:16)

Impact:

No issues are found from compat, as the list fetching is never properly resolved. This makes the library's result unreliable (/unusable).

Fix

The easiest fix would be to hardcode the new main branch 'heads/main'. Maybe a better approach might be to have it fixed as the default but allow a config parameter url/branch name to be passed in case the repo or structure change in the future?

Beatboxace avatar Apr 14 '21 20:04 Beatboxace

Created a PR if it can help to hotfix it quicker. Not sure about the version changes requirements. Should be bumped to 0.1.5, but latest release on github is tagged to 0.1.2.

Beatboxace avatar Apr 14 '21 22:04 Beatboxace

@Beatboxace I think you might need to fix it here as well:

const htmlDataURL = 'https://raw.githubusercontent.com/Fyrd/caniuse/master/data.json'

dmolesUC avatar Apr 28 '21 21:04 dmolesUC