Skip to content

Commit

Permalink
Show which BCD version is used
Browse files Browse the repository at this point in the history
  • Loading branch information
Elchi3 committed Jul 5, 2024
1 parent 650d409 commit 27b8f11
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ const { HtmlBasePlugin } = await import("@11ty/eleventy");
import { computeBaseline } from "compute-baseline";
import { Compat } from "compute-baseline/browser-compat-data";


// Remove this hack once https://github.com/11ty/eleventy-dependency-tree-esm/issues/2 is solved.
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
const pkg = require("./package.json");

const bcd = new Compat();
let all = [];
for (const feature of bcd.walk(["api", "css", "javascript", "html", "http", "svg", "mathml", "webassembly", "webdriver"],)) {
Expand Down Expand Up @@ -33,7 +39,7 @@ export default function (eleventyConfig) {
eleventyConfig.addGlobalData("versions", async () => {
return {
date: new Date().toLocaleDateString(),
// bcd: ???.__meta.version, TODO: Fix this
bcd: pkg.peerDependencies["@mdn/browser-compat-data"].replace('^', ''),
};
});

Expand Down

0 comments on commit 27b8f11

Please sign in to comment.