Skip to content

Commit 89007c8

Browse files
authored
devops: make README.md to always reflect tip-of-tree (#1911)
As of today, we have tooling in place that makes sure that our main README.md **roughly** represents the state of the last release: - browser versions and browser badges are those that we released last - links to our API point to the last-released API version This tooling, however, relies on the fact that every release is a sequence of two consecutive commits: - one commit that sets `package.json` version to a released version - the following that "bumps" version to `-post`. This release process is very unfortunate, because: - it made releasing from branch impossible - it required "freezing" commits to the master branch This patch removes all the tooling and transitions `README.md` to always represent tip-of-tree state. We will fully rely on `https://playwright.dev` to show versioned docs.
1 parent 2313ceb commit 89007c8

File tree

5 files changed

+22
-124
lines changed

5 files changed

+22
-124
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# 🎭 Playwright
2-
[![npm version](https://img.shields.io/npm/v/playwright.svg?style=flat)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge-if-release -->[![Chromium version](https://img.shields.io/badge/chromium-83.0.4101.0-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge-if-release -->[![Firefox version](https://img.shields.io/badge/firefox-75.0b8-blue.svg?logo=mozilla-firefox)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> [![WebKit version](https://img.shields.io/badge/webkit-13.0.4-blue.svg?logo=safari)](https://webkit.org/) [![Join Slack](https://img.shields.io/badge/join-slack-infomational)](https://join.slack.com/t/playwright/shared_invite/enQtOTEyMTUxMzgxMjIwLThjMDUxZmIyNTRiMTJjNjIyMzdmZDA3MTQxZWUwZTFjZjQwNGYxZGM5MzRmNzZlMWI5ZWUyOTkzMjE5Njg1NDg)
2+
[![npm version](https://img.shields.io/npm/v/playwright.svg?style=flat)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-84.0.4117.0-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-76.0b5-blue.svg?logo=mozilla-firefox)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> [![WebKit version](https://img.shields.io/badge/webkit-13.0.4-blue.svg?logo=safari)](https://webkit.org/) [![Join Slack](https://img.shields.io/badge/join-slack-infomational)](https://join.slack.com/t/playwright/shared_invite/enQtOTEyMTUxMzgxMjIwLThjMDUxZmIyNTRiMTJjNjIyMzdmZDA3MTQxZWUwZTFjZjQwNGYxZGM5MzRmNzZlMWI5ZWUyOTkzMjE5Njg1NDg)
33

4-
###### [API](https://github.com/microsoft/playwright/blob/v0.13.0/docs/api.md) | [Changelog](https://github.com/microsoft/playwright/releases) | [FAQ](#faq) | [Contributing](#contributing)
4+
###### [API](https://github.com/microsoft/playwright/blob/master/docs/api.md) | [Changelog](https://github.com/microsoft/playwright/releases) | [FAQ](#faq) | [Contributing](#contributing)
55

66

77
Playwright is a Node library to automate the [Chromium](https://www.chromium.org/Home), [WebKit](https://webkit.org/) and [Firefox](https://www.mozilla.org/en-US/firefox/new/) browsers with a single API. It enables **cross-browser** web automation that is **ever-green**, **capable**, **reliable** and **fast**.
88

99
| | ver | Linux | macOS | Win |
1010
| ---: | :---: | :---: | :---: | :---: |
11-
| Chromium| <!-- GEN:chromium-version-if-release-->83.0.4101.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
11+
| Chromium| <!-- GEN:chromium-version GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1212
| WebKit | 13.0.4 | :white_check_mark: | :white_check_mark: | :white_check_mark: |
13-
| Firefox | <!-- GEN:firefox-version-if-release -->75.0b8<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
13+
| Firefox | <!-- GEN:firefox-version -->76.0b5<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1414
- Headless is supported for all the browsers on all platforms.
1515

1616

docs/api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
# Playwright API <!-- GEN:version -->Tip-Of-Tree<!-- GEN:stop-->
3-
<!-- GEN:empty-if-release --><!-- GEN:stop -->
43

54
##### Table of Contents
65

utils/doclint/cli.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ async function run() {
5454
chromiumVersion: browserVersions.chromium,
5555
firefoxVersion: browserVersions.firefox,
5656
})));
57-
messages.push(...await preprocessor.ensureReleasedAPILinks([readme], VERSION));
5857
messages.push(...preprocessor.ensureInternalLinksAreValid([api]));
5958

6059
const browser = await playwright.chromium.launch();

utils/doclint/preprocessor/index.js

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,6 @@
1616

1717
const Message = require('../Message');
1818

19-
function ensureReleasedAPILinks(sources, libversion) {
20-
// Release version is everything that doesn't include "-".
21-
const apiLinkRegex = /https:\/\/github.com\/microsoft\/playwright\/blob\/v[^/]*\/docs\/api.md/ig;
22-
const lastReleasedAPI = `https://github.com/microsoft/playwright/blob/v${libversion.split('-')[0]}/docs/api.md`;
23-
24-
const messages = [];
25-
for (const source of sources) {
26-
const text = source.text();
27-
const newText = text.replace(apiLinkRegex, lastReleasedAPI);
28-
if (source.setText(newText))
29-
messages.push(Message.warning(`GEN: updated ${source.projectPath()}`));
30-
}
31-
return messages;
32-
};
33-
3419
function runCommands(sources, {libversion, chromiumVersion, firefoxVersion}) {
3520
// Release version is everything that doesn't include "-".
3621
const isReleaseVersion = !libversion.includes('-');
@@ -66,16 +51,14 @@ function runCommands(sources, {libversion, chromiumVersion, firefoxVersion}) {
6651
let newText = null;
6752
if (command.name === 'version')
6853
newText = isReleaseVersion ? 'v' + libversion : 'Tip-Of-Tree';
69-
else if (command.name === 'empty-if-release')
70-
newText = isReleaseVersion ? '' : command.originalText;
71-
else if (command.name === 'chromium-version-if-release')
72-
newText = isReleaseVersion ? chromiumVersion : command.originalText;
73-
else if (command.name === 'firefox-version-if-release')
74-
newText = isReleaseVersion ? firefoxVersion : command.originalText;
75-
else if (command.name === 'chromium-version-badge-if-release')
76-
newText = isReleaseVersion ? `[![Chromium version](https://img.shields.io/badge/chromium-${chromiumVersion}-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)` : command.originalText;
77-
else if (command.name === 'firefox-version-badge-if-release')
78-
newText = isReleaseVersion ? `[![Firefox version](https://img.shields.io/badge/firefox-${firefoxVersion}-blue.svg?logo=mozilla-firefox)](https://www.mozilla.org/en-US/firefox/new/)` : command.originalText;
54+
else if (command.name === 'chromium-version')
55+
newText = chromiumVersion;
56+
else if (command.name === 'firefox-version')
57+
newText = firefoxVersion;
58+
else if (command.name === 'chromium-version-badge')
59+
newText = `[![Chromium version](https://img.shields.io/badge/chromium-${chromiumVersion}-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)`;
60+
else if (command.name === 'firefox-version-badge')
61+
newText = `[![Firefox version](https://img.shields.io/badge/firefox-${firefoxVersion}-blue.svg?logo=mozilla-firefox)](https://www.mozilla.org/en-US/firefox/new/)`;
7962
else if (command.name === 'toc')
8063
newText = generateTableOfContents(command.source.text(), command.to, false /* topLevelOnly */);
8164
else if (command.name === 'toc-top-level')
@@ -194,4 +177,4 @@ function generateTableOfContentsForSuperclass(text, name) {
194177
return text;
195178
}
196179

197-
module.exports = {ensureInternalLinksAreValid, runCommands, ensureReleasedAPILinks};
180+
module.exports = {ensureInternalLinksAreValid, runCommands};

utils/doclint/preprocessor/test.js

Lines changed: 9 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
const {runCommands, ensureReleasedAPILinks} = require('.');
17+
const {runCommands, ensureTipOfTreeAPILinks} = require('.');
1818
const Source = require('../Source');
1919
const TestRunner = require('../../testrunner/');
2020
const runner = new TestRunner();
@@ -24,43 +24,6 @@ const {it, fit, xit} = runner.api();
2424
const {beforeAll, beforeEach, afterAll, afterEach} = runner.api();
2525
const {expect} = runner.api();
2626

27-
describe('ensureReleasedAPILinks', function() {
28-
it('should work with non-release version', function() {
29-
const source = new Source('doc.md', `
30-
[API](https://github.com/microsoft/playwright/blob/v1.1.0/docs/api.md#class-page)
31-
`);
32-
const messages = ensureReleasedAPILinks([source], '1.3.0-post');
33-
expect(messages.length).toBe(1);
34-
expect(messages[0].type).toBe('warning');
35-
expect(messages[0].text).toContain('doc.md');
36-
expect(source.text()).toBe(`
37-
[API](https://github.com/microsoft/playwright/blob/v1.3.0/docs/api.md#class-page)
38-
`);
39-
});
40-
it('should work with release version', function() {
41-
const source = new Source('doc.md', `
42-
[API](https://github.com/microsoft/playwright/blob/v1.1.0/docs/api.md#class-page)
43-
`);
44-
const messages = ensureReleasedAPILinks([source], '1.3.0');
45-
expect(messages.length).toBe(1);
46-
expect(messages[0].type).toBe('warning');
47-
expect(messages[0].text).toContain('doc.md');
48-
expect(source.text()).toBe(`
49-
[API](https://github.com/microsoft/playwright/blob/v1.3.0/docs/api.md#class-page)
50-
`);
51-
});
52-
it('should keep master links intact', function() {
53-
const source = new Source('doc.md', `
54-
[API](https://github.com/microsoft/playwright/blob/master/docs/api.md#class-page)
55-
`);
56-
const messages = ensureReleasedAPILinks([source], '1.3.0');
57-
expect(messages.length).toBe(0);
58-
expect(source.text()).toBe(`
59-
[API](https://github.com/microsoft/playwright/blob/master/docs/api.md#class-page)
60-
`);
61-
});
62-
});
63-
6427
describe('runCommands', function() {
6528
const OPTIONS_REL = {
6629
libversion: '1.3.0',
@@ -95,7 +58,7 @@ describe('runCommands', function() {
9558
Playwright <!-- gen:version -->v1.3.0<!-- gen:stop -->
9659
`);
9760
});
98-
it('should work for *-post versions', function() {
61+
it('should work for pre-release versions', function() {
9962
const source = new Source('doc.md', `
10063
Playwright <!-- gen:version -->XXX<!-- gen:stop -->
10164
`);
@@ -122,30 +85,6 @@ describe('runCommands', function() {
12285
expect(messages[0].text).toContain(`Failed to find 'gen:stop'`);
12386
});
12487
});
125-
describe('gen:empty-if-release', function() {
126-
it('should clear text when release version', function() {
127-
const source = new Source('doc.md', `
128-
<!-- gen:empty-if-release -->XXX<!-- gen:stop -->
129-
`);
130-
const messages = runCommands([source], OPTIONS_REL);
131-
expect(messages.length).toBe(1);
132-
expect(messages[0].type).toBe('warning');
133-
expect(messages[0].text).toContain('doc.md');
134-
expect(source.text()).toBe(`
135-
<!-- gen:empty-if-release --><!-- gen:stop -->
136-
`);
137-
});
138-
it('should keep text when non-release version', function() {
139-
const source = new Source('doc.md', `
140-
<!-- gen:empty-if-release -->XXX<!-- gen:stop -->
141-
`);
142-
const messages = runCommands([source], OPTIONS_DEV);
143-
expect(messages.length).toBe(0);
144-
expect(source.text()).toBe(`
145-
<!-- gen:empty-if-release -->XXX<!-- gen:stop -->
146-
`);
147-
});
148-
});
14988
describe('gen:toc', function() {
15089
it('should work', () => {
15190
const source = new Source('doc.md', `<!-- gen:toc -->XXX<!-- gen:stop -->
@@ -231,7 +170,6 @@ describe('runCommands', function() {
231170
it('should work with multiple commands', function() {
232171
const source = new Source('doc.md', `
233172
<!-- gen:version -->xxx<!-- gen:stop -->
234-
<!-- gen:empty-if-release -->yyy<!-- gen:stop -->
235173
<!-- gen:version -->zzz<!-- gen:stop -->
236174
`);
237175
const messages = runCommands([source], OPTIONS_REL);
@@ -240,55 +178,34 @@ describe('runCommands', function() {
240178
expect(messages[0].text).toContain('doc.md');
241179
expect(source.text()).toBe(`
242180
<!-- gen:version -->v1.3.0<!-- gen:stop -->
243-
<!-- gen:empty-if-release --><!-- gen:stop -->
244181
<!-- gen:version -->v1.3.0<!-- gen:stop -->
245182
`);
246183
});
247-
describe('gen:chromium-version-if-release', function() {
248-
it('should work for release', function() {
184+
describe('gen:chromium-version', function() {
185+
it('should work', function() {
249186
const source = new Source('doc.md', `
250-
Playwright <!-- gen:chromium-version-if-release -->XXX<!-- gen:stop -->
187+
Playwright <!-- gen:chromium-version -->XXX<!-- gen:stop -->
251188
`);
252189
const messages = runCommands([source], OPTIONS_REL);
253190
expect(messages.length).toBe(1);
254191
expect(messages[0].type).toBe('warning');
255192
expect(messages[0].text).toContain('doc.md');
256193
expect(source.text()).toBe(`
257-
Playwright <!-- gen:chromium-version-if-release -->80.0.4004.0<!-- gen:stop -->
258-
`);
259-
});
260-
it('should be noop for dev', function() {
261-
const source = new Source('doc.md', `
262-
Playwright <!-- gen:chromium-version-if-release -->XXX<!-- gen:stop -->
263-
`);
264-
const messages = runCommands([source], OPTIONS_DEV);
265-
expect(messages.length).toBe(0);
266-
expect(source.text()).toBe(`
267-
Playwright <!-- gen:chromium-version-if-release -->XXX<!-- gen:stop -->
194+
Playwright <!-- gen:chromium-version -->80.0.4004.0<!-- gen:stop -->
268195
`);
269196
});
270197
});
271198
describe('gen:firefox-version', function() {
272-
it('should work for release', function() {
199+
it('should work', function() {
273200
const source = new Source('doc.md', `
274-
Playwright <!-- gen:firefox-version-if-release -->XXX<!-- gen:stop -->
201+
Playwright <!-- gen:firefox-version -->XXX<!-- gen:stop -->
275202
`);
276203
const messages = runCommands([source], OPTIONS_REL);
277204
expect(messages.length).toBe(1);
278205
expect(messages[0].type).toBe('warning');
279206
expect(messages[0].text).toContain('doc.md');
280207
expect(source.text()).toBe(`
281-
Playwright <!-- gen:firefox-version-if-release -->73.0b3<!-- gen:stop -->
282-
`);
283-
});
284-
it('should be noop for dev', function() {
285-
const source = new Source('doc.md', `
286-
Playwright <!-- gen:firefox-version-if-release -->XXX<!-- gen:stop -->
287-
`);
288-
const messages = runCommands([source], OPTIONS_DEV);
289-
expect(messages.length).toBe(0);
290-
expect(source.text()).toBe(`
291-
Playwright <!-- gen:firefox-version-if-release -->XXX<!-- gen:stop -->
208+
Playwright <!-- gen:firefox-version -->73.0b3<!-- gen:stop -->
292209
`);
293210
});
294211
});

0 commit comments

Comments
 (0)