From acac3b3e32b0188e4a79779a3f6c72b9d1980121 Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Wed, 26 Jan 2022 12:22:20 +0100 Subject: [PATCH] chore: generate version range for deprecated versions (#7927) --- CONTRIBUTING.md | 2 +- utils/doclint/cli.js | 2 +- utils/doclint/preprocessor/index.js | 2 +- utils/get_deprecated_version_range.js | 27 +++++++++++++++++++++++++++ versions.js | 14 +++++++++++++- 5 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 utils/get_deprecated_version_range.js diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 344b75fb24b3b..9ad009701b367 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -282,7 +282,7 @@ The following steps are needed to update the Chromium version. Not all revisions have builds for all platforms, so we need to find one that does. To do so, run `utils/check_availability.js -rd` to find the latest suitable `dev` Chromium revision (see `utils/check_availability.js -help` for more options). 1. Update `src/revisions.ts` with the found revision number. -1. Update `versions.js` with the new Chromium-to-Puppeteer version mapping. +1. Update `versions.js` with the new Chromium-to-Puppeteer version mapping and update `lastMaintainedChromiumVersion` with the latest stable Chrome version. 1. Run `npm run ensure-correct-devtools-protocol-revision`. If it fails, update `package.json` with the expected `devtools-protocol` version. 1. Run `npm run tsc` and `npm install`. diff --git a/utils/doclint/cli.js b/utils/doclint/cli.js index e2de3a818ff3a..9d0df795d619c 100755 --- a/utils/doclint/cli.js +++ b/utils/doclint/cli.js @@ -38,7 +38,7 @@ async function run() { let changedFiles = false; if (IS_RELEASE) { - const versions = await Source.readFile( + const { versionsPerRelease: versions } = await Source.readFile( path.join(PROJECT_DIR, 'versions.js') ); versions.setText( diff --git a/utils/doclint/preprocessor/index.js b/utils/doclint/preprocessor/index.js index 68967d86f0ceb..d026873d25e14 100644 --- a/utils/doclint/preprocessor/index.js +++ b/utils/doclint/preprocessor/index.js @@ -151,7 +151,7 @@ function generateTableOfContents(mdText) { } const generateVersionsPerRelease = () => { - const versionsPerRelease = require('../../../versions.js'); + const { versionsPerRelease } = require('../../../versions.js'); const buffer = ['- Releases per Chromium version:']; for (const [chromiumVersion, puppeteerVersion] of versionsPerRelease) { if (puppeteerVersion === 'NEXT') continue; diff --git a/utils/get_deprecated_version_range.js b/utils/get_deprecated_version_range.js new file mode 100644 index 0000000000000..a0603c3d5e8c2 --- /dev/null +++ b/utils/get_deprecated_version_range.js @@ -0,0 +1,27 @@ +/** + * Copyright 2022 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 + * + * https://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. + */ + +const { + versionsPerRelease, + lastMaintainedChromiumVersion, +} = require('../versions.js'); +const version = versionsPerRelease.get(lastMaintainedChromiumVersion); +if (version.toLowerCase() === 'next') { + console.error('Unexpected NEXT Puppeteer version in versions.js'); + process.exit(1); +} +console.log('< ' + version); +process.exit(0); diff --git a/versions.js b/versions.js index d5bc563314e45..cbfb6942d2f80 100644 --- a/versions.js +++ b/versions.js @@ -42,4 +42,16 @@ const versionsPerRelease = new Map([ ['73.0.3679.0', 'v1.12.2'], ]); -module.exports = versionsPerRelease; +// The same major version as the current Chrome Stable per https://chromestatus.com/roadmap. +const lastMaintainedChromiumVersion = '97.0.4692.0'; + +if (!versionsPerRelease.has(lastMaintainedChromiumVersion)) { + throw new Error( + 'lastMaintainedChromiumVersion is missing from versionsPerRelease' + ); +} + +module.exports = { + versionsPerRelease, + lastMaintainedChromiumVersion, +};