From 23e67120b8748b8865c2c4b24ef98c1b8c899cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20J=C3=A4genstedt?= Date: Wed, 10 Jul 2024 00:07:35 +0200 Subject: [PATCH] Require a dist file for every feature This will mean that running just `npm run dist` will be enough even if the dist file doesn't exist yet. --- features/draft/scroll-marker.yml.dist | 6 ++++++ features/draft/selectlist.yml.dist | 6 ++++++ features/draft/speech-recognition.yml.dist | 6 ++++++ features/draft/text-box-trim.yml.dist | 6 ++++++ features/http2.yml.dist | 4 ++++ features/http3.yml.dist | 4 ++++ features/intersection-observer-v2.yml.dist | 4 ++++ features/jpegxl.yml.dist | 4 ++++ features/mathml.yml.dist | 4 ++++ features/notifications.yml.dist | 4 ++++ features/scroll-to-text-fragment.yml.dist | 4 ++++ features/webdriver-bidi.yml.dist | 4 ++++ features/webp.yml.dist | 4 ++++ scripts/dist.ts | 12 +++++++----- 14 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 features/draft/scroll-marker.yml.dist create mode 100644 features/draft/selectlist.yml.dist create mode 100644 features/draft/speech-recognition.yml.dist create mode 100644 features/draft/text-box-trim.yml.dist create mode 100644 features/http2.yml.dist create mode 100644 features/http3.yml.dist create mode 100644 features/intersection-observer-v2.yml.dist create mode 100644 features/jpegxl.yml.dist create mode 100644 features/mathml.yml.dist create mode 100644 features/notifications.yml.dist create mode 100644 features/scroll-to-text-fragment.yml.dist create mode 100644 features/webdriver-bidi.yml.dist create mode 100644 features/webp.yml.dist diff --git a/features/draft/scroll-marker.yml.dist b/features/draft/scroll-marker.yml.dist new file mode 100644 index 00000000000..ee94ea986bc --- /dev/null +++ b/features/draft/scroll-marker.yml.dist @@ -0,0 +1,6 @@ +# Generated from: scroll-marker.yml +# Do not edit this file by hand. Edit the source file instead! + +status: + baseline: false + support: {} diff --git a/features/draft/selectlist.yml.dist b/features/draft/selectlist.yml.dist new file mode 100644 index 00000000000..cd3aadedb84 --- /dev/null +++ b/features/draft/selectlist.yml.dist @@ -0,0 +1,6 @@ +# Generated from: selectlist.yml +# Do not edit this file by hand. Edit the source file instead! + +status: + baseline: false + support: {} diff --git a/features/draft/speech-recognition.yml.dist b/features/draft/speech-recognition.yml.dist new file mode 100644 index 00000000000..de2a52c72fd --- /dev/null +++ b/features/draft/speech-recognition.yml.dist @@ -0,0 +1,6 @@ +# Generated from: speech-recognition.yml +# Do not edit this file by hand. Edit the source file instead! + +status: + baseline: false + support: {} diff --git a/features/draft/text-box-trim.yml.dist b/features/draft/text-box-trim.yml.dist new file mode 100644 index 00000000000..48fbdd95df5 --- /dev/null +++ b/features/draft/text-box-trim.yml.dist @@ -0,0 +1,6 @@ +# Generated from: text-box-trim.yml +# Do not edit this file by hand. Edit the source file instead! + +status: + baseline: false + support: {} diff --git a/features/http2.yml.dist b/features/http2.yml.dist new file mode 100644 index 00000000000..b0565e7dfcd --- /dev/null +++ b/features/http2.yml.dist @@ -0,0 +1,4 @@ +# Generated from: http2.yml +# Do not edit this file by hand. Edit the source file instead! + +{} diff --git a/features/http3.yml.dist b/features/http3.yml.dist new file mode 100644 index 00000000000..ad91690a20f --- /dev/null +++ b/features/http3.yml.dist @@ -0,0 +1,4 @@ +# Generated from: http3.yml +# Do not edit this file by hand. Edit the source file instead! + +{} diff --git a/features/intersection-observer-v2.yml.dist b/features/intersection-observer-v2.yml.dist new file mode 100644 index 00000000000..77c9905646c --- /dev/null +++ b/features/intersection-observer-v2.yml.dist @@ -0,0 +1,4 @@ +# Generated from: intersection-observer-v2.yml +# Do not edit this file by hand. Edit the source file instead! + +{} diff --git a/features/jpegxl.yml.dist b/features/jpegxl.yml.dist new file mode 100644 index 00000000000..08e12aa78cf --- /dev/null +++ b/features/jpegxl.yml.dist @@ -0,0 +1,4 @@ +# Generated from: jpegxl.yml +# Do not edit this file by hand. Edit the source file instead! + +{} diff --git a/features/mathml.yml.dist b/features/mathml.yml.dist new file mode 100644 index 00000000000..c6164c34219 --- /dev/null +++ b/features/mathml.yml.dist @@ -0,0 +1,4 @@ +# Generated from: mathml.yml +# Do not edit this file by hand. Edit the source file instead! + +{} diff --git a/features/notifications.yml.dist b/features/notifications.yml.dist new file mode 100644 index 00000000000..2d681c71f53 --- /dev/null +++ b/features/notifications.yml.dist @@ -0,0 +1,4 @@ +# Generated from: notifications.yml +# Do not edit this file by hand. Edit the source file instead! + +{} diff --git a/features/scroll-to-text-fragment.yml.dist b/features/scroll-to-text-fragment.yml.dist new file mode 100644 index 00000000000..4822e7f2bac --- /dev/null +++ b/features/scroll-to-text-fragment.yml.dist @@ -0,0 +1,4 @@ +# Generated from: scroll-to-text-fragment.yml +# Do not edit this file by hand. Edit the source file instead! + +{} diff --git a/features/webdriver-bidi.yml.dist b/features/webdriver-bidi.yml.dist new file mode 100644 index 00000000000..d8851e1da01 --- /dev/null +++ b/features/webdriver-bidi.yml.dist @@ -0,0 +1,4 @@ +# Generated from: webdriver-bidi.yml +# Do not edit this file by hand. Edit the source file instead! + +{} diff --git a/features/webp.yml.dist b/features/webp.yml.dist new file mode 100644 index 00000000000..d6fbba0ef5b --- /dev/null +++ b/features/webp.yml.dist @@ -0,0 +1,4 @@ +# Generated from: webp.yml +# Do not edit this file by hand. Edit the source file instead! + +{} diff --git a/scripts/dist.ts b/scripts/dist.ts index 00ff9924371..1dacfeb447f 100644 --- a/scripts/dist.ts +++ b/scripts/dist.ts @@ -63,8 +63,12 @@ function updateDistFile(sourcePath: string, distPath: string): void { */ function checkDistFile(sourcePath: string, distPath: string): boolean { const expected = toDist(sourcePath).toString({ lineWidth: 0 }); - const actual = fs.readFileSync(distPath, { encoding: "utf-8" }); - return actual === expected; + try { + const actual = fs.readFileSync(distPath, { encoding: "utf-8" }); + return actual === expected; + } catch { + return false; + } } type SupportStatus = ReturnType; @@ -268,11 +272,9 @@ const tagsToFeatures: Map = (() => { function main() { const filePaths = argv.paths.flatMap((fileOrDirectory) => { if (fs.statSync(fileOrDirectory).isDirectory()) { - // Expand directory to any existing .dist file within. - // TODO: Change this to .yml when all features have dist files. return new fdir() .withBasePath() - .filter((fp) => fp.endsWith(".dist")) + .filter((fp) => fp.endsWith(".yml")) .crawl(fileOrDirectory) .sync(); }