Skip to content

feat(schemas): add index to published browser release objects#30008

Open
caugner wants to merge 6 commits into
mainfrom
21124-browser-release-index
Open

feat(schemas): add index to published browser release objects#30008
caugner wants to merge 6 commits into
mainfrom
21124-browser-release-index

Conversation

@caugner

@caugner caugner commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Add a required 0-based index integer to every release object in the published data.json, generated at build time. Consumers can reconstruct an ordered array of releases without depending on JavaScript object key enumeration order or pulling in a SemVer-style comparator.

Also prefixes the internal browser/release schema definitions with internal_ to match the convention already used in compat-data.schema.json, making the internal/public type distinction explicit.

Test results and supporting details

  • New unit test in scripts/build/index.test.js for addReleaseIndex covers compareVersions ordering (not lexicographic) with mixed integer/decimal versions (1, 2, 2.5, 10 → indices 0, 1, 2, 3).
  • npm run build succeeds; the resulting data.json validates against the updated public.schema.json (which now requires index).
  • Verified across all 17 browsers that indices form contiguous 0..N-1 ranges (e.g. bcd.browsers.chrome.releases["1"].index === 0, bcd.browsers.chrome.releases["151"].index === 149).
  • npm test passes; tsc --noEmit is clean.

Commits are split for review:

  1. refactor(schemas): prefix internal browser definitions with internal_ — pure rename, no behavior change.
  2. feat(schemas)!: add index to published release statements — schema property + build transform + test + docs.
  3. refactor(build): iterate browsers via Object.values — small cleanup in the new transform.
  4. docs(build): clarify addReleaseIndex param description — JSDoc nit.

Related issues

Fixes #21124.

caugner added 4 commits July 8, 2026 14:45
Rename `browsers`, `browser_statement`, and `release_statement` in
`schemas/browsers.schema.json` to `internal_browsers`,
`internal_browser_statement`, and `internal_release_statement`,
generating `InternalBrowsers`, `InternalBrowserStatement`, and
`InternalReleaseStatement`. This matches the convention already used in
`compat-data.schema.json` (e.g. `internal_compat_statement`) and makes
the internal/public type distinction explicit at every usage site,
preparing for properties that will differ between the two schemas.
Each release object in the published `data.json` now carries an
`index` integer property assigned at build time, ordered ascending by
version (using `compareVersions`). Consumers can reconstruct an
ordered array of releases without depending on JavaScript object key
enumeration order or pulling in a SemVer-style comparator.

`index` is required in `public.schema.json` and is added by a new
`addReleaseIndex` build transform. The internal schema is unchanged;
source files in `browsers/*.json` do not carry `index`.
…ndex`

Drop the unused `browser` loop variable and the `BrowserName[]` cast on
`Object.keys(data.browsers)`.
Say what the function does to the data (add an `index` property) rather
than generically noting it mutates.
@github-actions github-actions Bot added schema Isses or pull requests regarding the JSON schema files used in this project. infra Infrastructure issues (npm, GitHub Actions, releases) of this project docs Issues or pull requests regarding the documentation of this project. linter Issues or pull requests regarding the tests / linter of the JSON files. scripts Issues or pull requests regarding the scripts in scripts/. size:l [PR only] 101-1000 LoC changed labels Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs).

@caugner caugner changed the title Add explicit index to published release objects feat(schemas): add index to published browser release objects Jul 8, 2026
@caugner
caugner marked this pull request as ready for review July 8, 2026 13:21
@caugner
caugner requested review from a team as code owners July 8, 2026 13:21
@caugner
caugner requested review from LeoMcA and ddbeck July 8, 2026 13:21

@LeoMcA LeoMcA left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lovely, lgtm!

@caugner caugner added the semver-minor-bump A change that adds a new, non-potentially-breaking feature for consumers label Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions github-actions Bot added the merge conflicts 🚧 This PR needs to merge latest "main" branch to resolve a merge conflict or other issue. label Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Issues or pull requests regarding the documentation of this project. infra Infrastructure issues (npm, GitHub Actions, releases) of this project linter Issues or pull requests regarding the tests / linter of the JSON files. merge conflicts 🚧 This PR needs to merge latest "main" branch to resolve a merge conflict or other issue. schema Isses or pull requests regarding the JSON schema files used in this project. scripts Issues or pull requests regarding the scripts in scripts/. semver-minor-bump A change that adds a new, non-potentially-breaking feature for consumers size:l [PR only] 101-1000 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explicitly order browser releases

3 participants