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:
Andrey Lushnikov 2020-06-18 17:11:10 -07:00 committed by GitHub
parent 636e274412
commit 2511cb4c56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 58 additions and 40 deletions

View File

@ -2,7 +2,7 @@
## 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 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).
@ -45,3 +45,17 @@ To test packages, use [`//packages/installation-tests/installation-tests.sh`](./
## Publishing packages
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`

View File

@ -27,34 +27,40 @@ const cpAsync = util.promisify(ncp);
const SCRIPT_NAME = path.basename(__filename);
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 = {
'playwright': {
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.
files: [...PACKAGE_FILES, 'README.md'],
files: [...PLAYWRIGHT_CORE_FILES, 'README.md'],
},
'playwright-core': {
description: 'A high-level API to automate web browsers',
whitelistedBrowsers: [],
files: PACKAGE_FILES,
browsers: [],
files: PLAYWRIGHT_CORE_FILES,
},
'playwright-webkit': {
description: 'A high-level API to automate WebKit',
whitelistedBrowsers: ['webkit'],
files: PACKAGE_FILES,
browsers: ['webkit'],
files: PLAYWRIGHT_CORE_FILES,
},
'playwright-firefox': {
description: 'A high-level API to automate Firefox',
whitelistedBrowsers: ['firefox'],
files: PACKAGE_FILES,
browsers: ['firefox'],
files: PLAYWRIGHT_CORE_FILES,
},
'playwright-chromium': {
description: 'A high-level API to automate Chromium',
whitelistedBrowsers: ['chromium'],
files: PACKAGE_FILES,
browsers: ['chromium'],
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);
// 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({
name: packageName,
version: packageJSON.version,
version: package.version || pwInternalJSON.version,
description: package.description,
repository: packageJSON.repository,
engines: packageJSON.engines,
homepage: packageJSON.homepage,
repository: pwInternalJSON.repository,
engines: pwInternalJSON.engines,
homepage: pwInternalJSON.homepage,
main: 'index.js',
scripts: {
install: 'node install.js',
},
author: packageJSON.author,
license: packageJSON.license,
dependencies: packageJSON.dependencies
author: pwInternalJSON.author,
license: pwInternalJSON.license,
dependencies: pwInternalJSON.dependencies
}, null, 2));
// 5. Generate 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));
// 6. Run npm pack

View File

@ -1,3 +0,0 @@
{
"browsers": []
}

View 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. */

View File

@ -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"
}
}