diff --git a/features/draft/vendor/README.md b/features/draft/vendor/README.md new file mode 100644 index 00000000000..c9a4eb0e70f --- /dev/null +++ b/features/draft/vendor/README.md @@ -0,0 +1,18 @@ +# Draft vendor features + +This directory is for features proposed by a browser vendor, to support the +early use of web-features before there is a published web-features ID, and a +way to transition from draft to published feature IDs. + +A draft vendor feature goes through these stages: + +- A bot creates a `.yml` file in this directory, with enough information for a + maintainer of web-features to follow up and act on. An `explainer` or `spec` + URL and a vendor-specific URL like `chromestatus` is recommended. +- A web-features maintainer creates a real feature entry and replaces the draft + feature with a pointer to that feature. +- References to the draft feature in vendor tools or source code are updated to + point to the final features. + +Write access for bots can be granted by web-features maintainers, and should +only be used to create files in this directory. diff --git a/index.ts b/index.ts index cd9a441237b..135e8e4cc1a 100644 --- a/index.ts +++ b/index.ts @@ -45,10 +45,17 @@ function* yamlEntries(root: string): Generator<[string, any]> { // The feature identifier/key is the filename without extension. const { name: key } = path.parse(fp); const pathParts = fp.split(path.sep); + const isDraft = pathParts.includes('draft'); + const isSpec = isDraft && pathParts.includes('spec'); + const isVendor = isDraft && pathParts.includes('vendor'); + + if (isVendor) { + continue; + } // Assert ID uniqueness for (const [pool, map] of Object.entries(uniqueIdMaps)) { - if (!pathParts.includes("spec") && pathParts.includes(pool)) { + if (!isSpec && pathParts.includes(pool)) { const otherFile: string | undefined = map.get(key); if (otherFile) { throw new Error(`ID collision between ${fp} and ${otherFile}`); @@ -68,7 +75,7 @@ function* yamlEntries(root: string): Generator<[string, any]> { Object.assign(data, dist); } - if (pathParts.includes('draft')) { + if (isDraft) { data[draft] = true; } diff --git a/scripts/dist.ts b/scripts/dist.ts index 1832f6a4b89..a5365f1dbd9 100644 --- a/scripts/dist.ts +++ b/scripts/dist.ts @@ -410,6 +410,9 @@ const tagsToFeatures: Map = (() => { * mistakes, such as `.yaml` files. */ function isDistOrDistable(path: string): boolean { + if (path.startsWith("features/draft/vendor/")) { + return false; + } if (path.endsWith(".yaml.dist") || path.endsWith(".yaml")) { throw new Error( `YAML files must use .yml extension; ${path} has invalid extension`,