-
Notifications
You must be signed in to change notification settings - Fork 112
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
Create a JSON object (or objects) that maps browser versions to Baseline years #578
Comments
In code that @ddbeck and I have written, we always use BCD's browser release data, and I've found that it's already in a form that requires no or very little mangling before use. Do you have a piece of code you need to write, and did you try using |
Some thoughts on this: There is no direct mapping of UAs to Baseline versions. Instead what you’d have to do is look at a Baseline version and say what is the lowest common denominator: Let’s say Baseline 2023 has features that require at least Safari 17.2, Firefox 121 and Chrome 120. The goal is to produce a table like this:
Code that wants to display a table like this would then have to check for each request whether it's between two releases of a browser. A minimal mapping might then be: Tony's example structures above would probably make the computation more straight forward though. Caveat: this is only for tracked browsers, so you can’t use the percentage of those visits relative to all visits for Baseline reach percentage of the overall population. |
Over in #597, we're working on a library for working with the Baseline calculations. In there, I consume BCD's browsers data (in an admittedly complex way) to produce two sets of releases: Baseline "low" releases and Baseline "high" releases. Today, that looks something like this (simplified for display here): Low:
High:
I don't think it would be too difficult to allow selecting a date for the set of releases (e.g., |
Coming back to this, as I was discussing it with @just-jeb and @alonkochba . They said it would be really helpful if they could easily get an ingestible summary of BL versions year by year to use in their internally built analytics stack. Jeb and Alon, is there a format that would make most sense for you? The RUM Archive Baseline page I showed you is open source, and they have some code for parsing a list of browsers/release dates and turning out the table that you see in the page, but I don't know if that's useful or not for your purposes. |
Here's some sample code that might be useful: import bcd from '@mdn/browser-compat-data' with { type: 'json' };
// https://github.com/web-platform-dx/web-features/blob/main/docs/baseline.md#core-browser-set
const browsers = [
"chrome",
"chrome_android",
"edge",
"firefox",
"firefox_android",
"safari",
"safari_ios",
];
// Map from year (as a string) to a filtered version of the bcd.browsers data.
const releasesByYear = {};
for (let year = 2016; /* no break condition */; year++) {
let releaseCount = 0;
const releases = Object.fromEntries(browsers.map((browser) => {
const filtered = Object.fromEntries(
Object.entries(bcd.browsers[browser].releases).filter(
([version, data]) => {
if (!data.release_date.startsWith(`${year}-`)) {
return false;
}
if (!['current', 'esr', 'retired'].includes(data.status)) {
return false;
}
releaseCount++;
return true;
}
).map(
([version, data]) => [version, data.release_date]
)
);
return [browser, filtered];
}));
if (releaseCount == 0) {
break;
}
releasesByYear[String(year)] = releases;
}
console.log(JSON.stringify({ year: releasesByYear}, null, ' ')); The output is in https://gist.github.com/foolip/212740b5d53de0cdd86bbba6859127aa. My recommendation would be to take a dependency on |
#1047 might also help here. If we publish something simplified, code like the above would be slightly more straightforward. |
It would be very helpful for tools and analytics to providers to have an easily parsed mapping of each release version of a given browser to a Baseline year. We could do very deep nesting by year with release dates:
Or the other way round, break down by browser, then version, then Baseline year/release:
Do we need to differentiate between mobile and desktop? I guess we'd need to regenerate this at a minimum monthly to take new releases into account. I guess it should be too difficult to build this programatically from the MDN Compat data repo's browser files.
The text was updated successfully, but these errors were encountered: