devops: drop playwright-electron dependency on playwright-core (#2634)
Drive-by: bump playwright-electron version to 0.4.0; i'll publish it after this PR lands.
This commit is contained in:
parent
636e274412
commit
2511cb4c56
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
- Playwright ships multiple packages to NPM. All packges that are published to NPM are listed as folders under [`//packages/`](../packages).
|
- Playwright ships multiple packages to NPM. All packages that are published to NPM are listed as folders under [`//packages/`](../packages).
|
||||||
- Playwright's [root package.json](../package.json) is **never published to NPM**. It is only used for devmode, e.g. when running `npm install` with no arguments or installing from github.
|
- Playwright's [root package.json](../package.json) is **never published to NPM**. It is only used for devmode, e.g. when running `npm install` with no arguments or installing from github.
|
||||||
- Playwright dependencies for all packages are the same and are managed with the [`root package.json`](../package.json).
|
- Playwright dependencies for all packages are the same and are managed with the [`root package.json`](../package.json).
|
||||||
- Playwright browser versions for all packages are the same and are managed with the [`browsers.json`](../browsers.json).
|
- Playwright browser versions for all packages are the same and are managed with the [`browsers.json`](../browsers.json).
|
||||||
|
|
@ -45,3 +45,17 @@ To test packages, use [`//packages/installation-tests/installation-tests.sh`](./
|
||||||
## Publishing packages
|
## Publishing packages
|
||||||
|
|
||||||
All package publishing happens **exclusively** over CI/CD using the [`//utils/publish_all_packages.sh`](../utils/publish_all_packages.sh) script.
|
All package publishing happens **exclusively** over CI/CD using the [`//utils/publish_all_packages.sh`](../utils/publish_all_packages.sh) script.
|
||||||
|
|
||||||
|
|
||||||
|
# Special handling for `playwright-electron`
|
||||||
|
|
||||||
|
- `playwright-electron` version is pre-1.0.0 and thus managed separately. It's specified inside the [`//packages/build_package.js`]('./build_package.js') file.
|
||||||
|
- `playwright-electron` is published manually.
|
||||||
|
|
||||||
|
To publish a new version of `playwright-electron`:
|
||||||
|
|
||||||
|
1. Bump `playwright-electron` version inside [`//packages/build_package.js`]('./build_package.js')
|
||||||
|
2. Submit PR with the updated version
|
||||||
|
3. Build package with `./build_package.js playwright-electron ./playwright-electron.tgz`
|
||||||
|
4. Publish package with `npm publish playwright-electron.tgz`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,34 +27,40 @@ const cpAsync = util.promisify(ncp);
|
||||||
const SCRIPT_NAME = path.basename(__filename);
|
const SCRIPT_NAME = path.basename(__filename);
|
||||||
const ROOT_PATH = path.join(__dirname, '..');
|
const ROOT_PATH = path.join(__dirname, '..');
|
||||||
|
|
||||||
const PACKAGE_FILES = ['lib', 'types', 'NOTICE', 'LICENSE', '.npmignore'];
|
const PLAYWRIGHT_CORE_FILES = ['lib', 'types', 'NOTICE', 'LICENSE', '.npmignore'];
|
||||||
|
|
||||||
const PACKAGES = {
|
const PACKAGES = {
|
||||||
'playwright': {
|
'playwright': {
|
||||||
description: 'A high-level API to automate web browsers',
|
description: 'A high-level API to automate web browsers',
|
||||||
whitelistedBrowsers: ['chromium', 'firefox', 'webkit'],
|
browsers: ['chromium', 'firefox', 'webkit'],
|
||||||
// We copy README.md additionally for Playwright so that it looks nice on NPM.
|
// We copy README.md additionally for Playwright so that it looks nice on NPM.
|
||||||
files: [...PACKAGE_FILES, 'README.md'],
|
files: [...PLAYWRIGHT_CORE_FILES, 'README.md'],
|
||||||
},
|
},
|
||||||
'playwright-core': {
|
'playwright-core': {
|
||||||
description: 'A high-level API to automate web browsers',
|
description: 'A high-level API to automate web browsers',
|
||||||
whitelistedBrowsers: [],
|
browsers: [],
|
||||||
files: PACKAGE_FILES,
|
files: PLAYWRIGHT_CORE_FILES,
|
||||||
},
|
},
|
||||||
'playwright-webkit': {
|
'playwright-webkit': {
|
||||||
description: 'A high-level API to automate WebKit',
|
description: 'A high-level API to automate WebKit',
|
||||||
whitelistedBrowsers: ['webkit'],
|
browsers: ['webkit'],
|
||||||
files: PACKAGE_FILES,
|
files: PLAYWRIGHT_CORE_FILES,
|
||||||
},
|
},
|
||||||
'playwright-firefox': {
|
'playwright-firefox': {
|
||||||
description: 'A high-level API to automate Firefox',
|
description: 'A high-level API to automate Firefox',
|
||||||
whitelistedBrowsers: ['firefox'],
|
browsers: ['firefox'],
|
||||||
files: PACKAGE_FILES,
|
files: PLAYWRIGHT_CORE_FILES,
|
||||||
},
|
},
|
||||||
'playwright-chromium': {
|
'playwright-chromium': {
|
||||||
description: 'A high-level API to automate Chromium',
|
description: 'A high-level API to automate Chromium',
|
||||||
whitelistedBrowsers: ['chromium'],
|
browsers: ['chromium'],
|
||||||
files: PACKAGE_FILES,
|
files: PLAYWRIGHT_CORE_FILES,
|
||||||
|
},
|
||||||
|
'playwright-electron': {
|
||||||
|
version: '0.4.0', // Manually manage playwright-electron version.
|
||||||
|
description: 'A high-level API to automate Electron',
|
||||||
|
browsers: [],
|
||||||
|
files: PLAYWRIGHT_CORE_FILES,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -108,26 +114,26 @@ if (!package) {
|
||||||
await copyToPackage(file);
|
await copyToPackage(file);
|
||||||
|
|
||||||
// 4. Generate package.json
|
// 4. Generate package.json
|
||||||
const packageJSON = require(path.join(ROOT_PATH, 'package.json'));
|
const pwInternalJSON = require(path.join(ROOT_PATH, 'package.json'));
|
||||||
await writeToPackage('package.json', JSON.stringify({
|
await writeToPackage('package.json', JSON.stringify({
|
||||||
name: packageName,
|
name: packageName,
|
||||||
version: packageJSON.version,
|
version: package.version || pwInternalJSON.version,
|
||||||
description: package.description,
|
description: package.description,
|
||||||
repository: packageJSON.repository,
|
repository: pwInternalJSON.repository,
|
||||||
engines: packageJSON.engines,
|
engines: pwInternalJSON.engines,
|
||||||
homepage: packageJSON.homepage,
|
homepage: pwInternalJSON.homepage,
|
||||||
main: 'index.js',
|
main: 'index.js',
|
||||||
scripts: {
|
scripts: {
|
||||||
install: 'node install.js',
|
install: 'node install.js',
|
||||||
},
|
},
|
||||||
author: packageJSON.author,
|
author: pwInternalJSON.author,
|
||||||
license: packageJSON.license,
|
license: pwInternalJSON.license,
|
||||||
dependencies: packageJSON.dependencies
|
dependencies: pwInternalJSON.dependencies
|
||||||
}, null, 2));
|
}, null, 2));
|
||||||
|
|
||||||
// 5. Generate browsers.json
|
// 5. Generate browsers.json
|
||||||
const browsersJSON = require(path.join(ROOT_PATH, 'browsers.json'));
|
const browsersJSON = require(path.join(ROOT_PATH, 'browsers.json'));
|
||||||
browsersJSON.browsers = browsersJSON.browsers.filter(browser => package.whitelistedBrowsers.includes(browser.name));
|
browsersJSON.browsers = browsersJSON.browsers.filter(browser => package.browsers.includes(browser.name));
|
||||||
await writeToPackage('browsers.json', JSON.stringify(browsersJSON, null, 2));
|
await writeToPackage('browsers.json', JSON.stringify(browsersJSON, null, 2));
|
||||||
|
|
||||||
// 6. Run npm pack
|
// 6. Run npm pack
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"browsers": []
|
|
||||||
}
|
|
||||||
17
packages/playwright-electron/install.js
Normal file
17
packages/playwright-electron/install.js
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) Microsoft Corporation.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* NOTE: playwright-electron does not install browsers by design. */
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
{
|
|
||||||
"name": "playwright-electron",
|
|
||||||
"version": "0.3.0",
|
|
||||||
"description": "A high-level API to automate Electron",
|
|
||||||
"repository": "github:Microsoft/playwright",
|
|
||||||
"homepage": "https://playwright.dev",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {},
|
|
||||||
"author": {
|
|
||||||
"name": "Microsoft Corporation"
|
|
||||||
},
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"dependencies": {
|
|
||||||
"playwright-core": "next"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue