Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

devops: drop playwright-electron dependency on playwright-core (#2634)

Andrey Lushnikov2511cb4c56c3
diff --git a/packages/README.md b/packages/README.md
index 6333b66c6b..bc7f24eced 100644
--- a/packages/README.md
+++ b/packages/README.md
@@ -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`
+
diff --git a/packages/build_package.js b/packages/build_package.js
index 6f5022e716..0eef7cd1af 100755
--- a/packages/build_package.js
+++ b/packages/build_package.js
@@ -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
diff --git a/packages/playwright-electron/browsers.json b/packages/playwright-electron/browsers.json
deleted file mode 100644
index 4e02babf0c..0000000000
--- a/packages/playwright-electron/browsers.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "browsers": []
-}
diff --git a/packages/playwright-electron/install.js b/packages/playwright-electron/install.js
new file mode 100644
index 0000000000..6a70e659c8
--- /dev/null
+++ b/packages/playwright-electron/install.js
@@ -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. */
diff --git a/packages/playwright-electron/package.json b/packages/playwright-electron/package.json
deleted file mode 100644
index b85db6f441..0000000000
--- a/packages/playwright-electron/package.json
+++ /dev/null
@@ -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"
- }
-}