Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow preview browsers in the data structure #10334

Merged
merged 1 commit into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions browsers/chrome.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"browsers": {
"chrome": {
"name": "Chrome",
"preview_name": "Canary",
"pref_url": "chrome://flags",
"releases": {
"1": {
Expand Down
1 change: 1 addition & 0 deletions browsers/firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"browsers": {
"firefox": {
"name": "Firefox",
"preview_name": "Nightly",
"pref_url": "about:config",
"releases": {
"1": {
Expand Down
1 change: 1 addition & 0 deletions browsers/safari.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"browsers": {
"safari": {
"name": "Safari",
"preview_name": "TP",
"releases": {
"1": {
"release_date": "2003-06-23",
Expand Down
5 changes: 5 additions & 0 deletions schemas/browsers-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The file `firefox.json` is structured like this:
"browsers": {
"firefox": {
"name": "Firefox",
"preview_name": "Nightly",
"pref_url": "about:config",
"releases": {
"1.5": {
Expand Down Expand Up @@ -48,6 +49,10 @@ An optional boolean indicating whether the browser supports flags. This is a hin

An optional string containing the URL of the page where feature flags can be changed (e.g. `"about:config"` for Firefox or `"chrome://flags"` for Chrome).

### `preview_name`

An optional string containing the name of the preview browser. For example, "Nightly" for Firefox, "Canary" for Chrome, and "TP" for Safari.

### Release objects

The release objects consist of the following properties:
Expand Down
4 changes: 4 additions & 0 deletions schemas/browsers.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
"type": "string",
"description": "URL of the page where feature flags can be changed (e.g. 'about:config' or 'chrome://flags')."
},
"preview_name": {
"type": "string",
"description": "Preview name, avoid long-form names (use 'Nightly' instead of 'Firefox Nightly')."
},
"releases": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/release_statement" }
Expand Down
9 changes: 9 additions & 0 deletions test/linter/test-consistency.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,15 @@ class ConsistencyChecker {
if (b_version_added.startsWith('≤')) {
return false;
}
if (a_version_added === 'preview' && b_version_added === 'preview') {
return false;
}
if (b_version_added === 'preview') {
return true;
}
if (a_version_added === 'preview') {
return false;
}
return compareVersions.compare(
a_version_added.replace('≤', ''),
b_version_added,
Expand Down
13 changes: 13 additions & 0 deletions test/linter/test-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ for (const browser of Object.keys(browsers)) {
if (VERSION_RANGE_BROWSERS[browser]) {
validBrowserVersions[browser].push(...VERSION_RANGE_BROWSERS[browser]);
}
if (browsers[browser].preview_name) {
validBrowserVersions[browser].push('preview');
}
}

/**
Expand Down Expand Up @@ -63,6 +66,16 @@ function addedBeforeRemoved(statement) {
return null;
}

if (added === 'preview' && removed === 'preview') {
return false;
}
if (added === 'preview' && removed !== 'preview') {
return false;
}
if (added !== 'preview' && removed === 'preview') {
return true;
}

return compareVersions.compare(added, removed, '<');
}

Expand Down
6 changes: 6 additions & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ export interface BrowserStatement {
*/
name: string;

/**
* The preview browser's name, for example:
* `"Nightly"`, `"Canary"`, `"TP"`, etc.
*/
preview_name: string;

/**
* The known versions of this browser.
*/
Expand Down