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
chore: use devtools-protocol package #6172
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7d5288a
chore: Use devtools-protocol package
jackfranklin f94e7c2
Ensure the right devtools-protocol package version
jackfranklin ff6e12e
fix typo in travis
jackfranklin 4f152a1
Better definition for cdp params
jackfranklin 5977d2f
Update scripts/ensure-correct-devtools-protocol-package.ts
jackfranklin 0546426
Update scripts/ensure-correct-devtools-protocol-package.ts
jackfranklin bd23b65
fix params handling
jackfranklin 925b3b1
invalid syntax fix
jackfranklin 8438dd4
generate docs
jackfranklin cfd19e6
doclint fixes
jackfranklin File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/** | ||
* Copyright 2020 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* This script ensures that the pinned version of devtools-protocol in | ||
* package.json is the right version for the current revision of Chromium that | ||
* Puppeteer ships with. | ||
* | ||
* The devtools-protocol package publisher runs every hour and checks if there | ||
* are protocol changes. If there are, it will be versioned with the revision | ||
* number of the commit that last changed the .pdl files. | ||
* | ||
* Chromium branches/releases are figured out at a later point in time, so it's | ||
* not true that each Chromium revision will have an exact matching revision | ||
* version of devtools-protocol. To ensure we're using a devtools-protocol that | ||
* is aligned with our revision, we want to find the largest package number | ||
* that's <= the revision that Puppeteer is using. | ||
* | ||
* This script uses npm's `view` function to list all versions in a range and | ||
* find the one closest to our Chromium revision. | ||
*/ | ||
|
||
import { PUPPETEER_REVISIONS } from '../src/revisions'; | ||
import { execSync } from 'child_process'; | ||
|
||
import packageJson from '../package.json'; | ||
|
||
const currentProtocolPackageInstalledVersion = | ||
packageJson.dependencies['devtools-protocol']; | ||
|
||
/** | ||
* Ensure that the devtools-protocol version is pinned. | ||
*/ | ||
if (/^[^0-9]/.test(currentProtocolPackageInstalledVersion)) { | ||
console.log( | ||
`ERROR: devtools-protocol package is not pinned to a specific version.\n` | ||
); | ||
process.exit(1); | ||
} | ||
|
||
// find the right revision for our Chromium revision | ||
|
||
const command = `npm view "devtools-protocol@<=0.0.${PUPPETEER_REVISIONS.chromium}" version | tail -1`; | ||
|
||
console.log( | ||
'Checking npm for devtools-protocol revisions:\n', | ||
`'${command}'`, | ||
'\n' | ||
); | ||
|
||
const output = execSync(command, { | ||
encoding: 'utf8', | ||
}); | ||
|
||
const bestRevisionFromNpm = output.split(' ')[1].replace(/'|\n/g, ''); | ||
|
||
if (currentProtocolPackageInstalledVersion !== bestRevisionFromNpm) { | ||
console.log(`ERROR: bad devtools-protocol revision detected: | ||
|
||
Current Puppeteer Chromium revision: ${PUPPETEER_REVISIONS.chromium} | ||
Current devtools-protocol version in package.json: ${currentProtocolPackageInstalledVersion} | ||
Expected devtools-protocol version: ${bestRevisionFromNpm}`); | ||
|
||
process.exit(1); | ||
} | ||
|
||
console.log( | ||
`Correct devtools-protocol version found (${bestRevisionFromNpm}).` | ||
); | ||
process.exit(0); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mathiasbynens particularly interested in getting some more eyes on this