summaryrefslogtreecommitdiffstats
path: root/devtools/shared/compatibility/bin/update.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /devtools/shared/compatibility/bin/update.js
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/shared/compatibility/bin/update.js')
-rw-r--r--devtools/shared/compatibility/bin/update.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/devtools/shared/compatibility/bin/update.js b/devtools/shared/compatibility/bin/update.js
new file mode 100644
index 0000000000..7208f630a5
--- /dev/null
+++ b/devtools/shared/compatibility/bin/update.js
@@ -0,0 +1,39 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
+
+// The Compatibility panel detects issues by comparing against official MDN compatibility data
+// at https://github.com/mdn/browser-compat-data). It uses a local snapshot of the dataset.
+// This dataset needs to be manually synchronized periodically
+
+// The subsets from the dataset required by the Compatibility panel are:
+// * css.properties: https://github.com/mdn/browser-compat-data/tree/master/css
+
+// The MDN compatibility data is available as a node package ("@mdn/browser-compat-data"),
+// which is used here to update `../dataset/css-properties.json`.
+
+/* global __dirname */
+
+"use strict";
+
+const compatData = require("@mdn/browser-compat-data");
+exportData(compatData.css.properties, "css-properties.json");
+
+function exportData(data, fileName) {
+ const fs = require("fs");
+ const path = require("path");
+
+ const content = `${JSON.stringify(data)}`;
+
+ fs.writeFile(
+ path.resolve(__dirname, "../dataset", fileName),
+ content,
+ err => {
+ if (err) {
+ console.error(err);
+ } else {
+ console.log(`${fileName} downloaded`);
+ }
+ }
+ );
+}