diff --git a/README.md b/README.md index cd8c42a7bdbcc..4bd6f31c89d39 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ npm i puppeteer-core `puppeteer-core` is intended to be a lightweight version of puppeteer for launching an existing browser installation or for connecting to a remote one. -See [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/v1.7.0/docs/api.md#puppeteer-vs-puppeteer-core). +See [puppeteer vs puppeteer-core](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteer-vs-puppeteer-core). ### Usage diff --git a/utils/doclint/preprocessor/index.js b/utils/doclint/preprocessor/index.js index 01e377b3d47a9..3ce6a3ce76631 100644 --- a/utils/doclint/preprocessor/index.js +++ b/utils/doclint/preprocessor/index.js @@ -18,7 +18,7 @@ const Message = require('../Message'); module.exports.ensureReleasedAPILinks = function(sources, version) { // Release version is everything that doesn't include "-". - const apiLinkRegex = /https:\/\/github.com\/GoogleChrome\/puppeteer\/blob\/[^/]*\/docs\/api.md/ig; + const apiLinkRegex = /https:\/\/github.com\/GoogleChrome\/puppeteer\/blob\/v[^/]*\/docs\/api.md/ig; const lastReleasedAPI = `https://github.com/GoogleChrome/puppeteer/blob/v${version.split('-')[0]}/docs/api.md`; const messages = []; diff --git a/utils/doclint/preprocessor/test.js b/utils/doclint/preprocessor/test.js index c1ff505201d62..48ff13b5c3f88 100644 --- a/utils/doclint/preprocessor/test.js +++ b/utils/doclint/preprocessor/test.js @@ -28,7 +28,7 @@ const {expect} = new Matchers(); describe('ensureReleasedAPILinks', function() { it('should work with non-release version', function() { const source = new Source('doc.md', ` - [API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-page) + [API](https://github.com/GoogleChrome/puppeteer/blob/v1.1.0/docs/api.md#class-page) `); const messages = ensureReleasedAPILinks([source], '1.3.0-post'); expect(messages.length).toBe(1); @@ -40,7 +40,7 @@ describe('ensureReleasedAPILinks', function() { }); it('should work with release version', function() { const source = new Source('doc.md', ` - [API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-page) + [API](https://github.com/GoogleChrome/puppeteer/blob/v1.1.0/docs/api.md#class-page) `); const messages = ensureReleasedAPILinks([source], '1.3.0'); expect(messages.length).toBe(1); @@ -50,6 +50,16 @@ describe('ensureReleasedAPILinks', function() { [API](https://github.com/GoogleChrome/puppeteer/blob/v1.3.0/docs/api.md#class-page) `); }); + it('should keep master links intact', function() { + const source = new Source('doc.md', ` + [API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-page) + `); + const messages = ensureReleasedAPILinks([source], '1.3.0'); + expect(messages.length).toBe(0); + expect(source.text()).toBe(` + [API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-page) + `); + }); }); describe('runCommands', function() {