playwright/packages
Max Schmitt d27f97edb1
devops: include protocol and api.md in NPM package (#3195)
The reason for this change is that in Playwright Python we would need the related `protocol.yml` and `api.md` for the installed NPM package. For that we could either add the Git hash to the released package e.g. as a file (and go over the GitHub repo to get the file content) but Pavel proposed that it might be better to include the two files in the NPM package.

Tested locally by adding to the `utils/publish_all_packages.sh` script `--dry` to the NPM publish commands.

cc @aslushnikov @pavelfeldman 

Related issues: https://github.com/microsoft/playwright-python/pull/101 and https://github.com/microsoft/playwright-python/pull/96
2020-07-28 13:30:36 -07:00
..
common api: export all browsers from every package (#3128) 2020-07-24 16:36:00 -07:00
installation-tests api: export all browsers from every package (#3128) 2020-07-24 16:36:00 -07:00
playwright-chromium api: export all browsers from every package (#3128) 2020-07-24 16:36:00 -07:00
playwright-core api: export all browsers from every package (#3128) 2020-07-24 16:36:00 -07:00
playwright-electron chore: support esm imports (#3125) 2020-07-23 15:14:36 -07:00
playwright-firefox api: export all browsers from every package (#3128) 2020-07-24 16:36:00 -07:00
playwright-webkit api: export all browsers from every package (#3128) 2020-07-24 16:36:00 -07:00
.gitignore api: export all browsers from every package (#3128) 2020-07-24 16:36:00 -07:00
build_package.js devops: include protocol and api.md in NPM package (#3195) 2020-07-28 13:30:36 -07:00
README.md devops: drop playwright-electron dependency on playwright-core (#2634) 2020-06-18 17:11:10 -07:00

Managing and Publishing Playwright Packages

Overview

  • Playwright ships multiple packages to NPM. All packages that are published to NPM are listed as folders under //packages/.
  • Playwright's root 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.
  • Playwright browser versions for all packages are the same and are managed with the browsers.json.

Note

As of May 20, 2020, the only exception is the playwright-electron package that doesn't follow the pack and is published manually. This is due to it's pre-1.0 status.

Building NPM package

To build a package that will be shipped to NPM, use //packages/build_package.js script. The script populates package folder with contents, and then uses npm pack to archive the folder.

As of May 20, 2020, //packages/build_package.js does the following:

  • copies certain files and folders from playwright-internal to the subpackage (e.g. //lib, //types, //LICENSE etc)
  • generates package.json and puts it in the subpackage
  • generates browsers.json and puts it in the subpackage
  • uses npm pack to pack the subpackage folder
  • removes all the files that were added during the process

To build playwright package and save result as ./playwright.tgz file:

$ ./packages/build_package.js playwright ./playwright.tgz

To debug what files are put into the folder, use --no-cleanup flag and inspect the package folder:

$ ./packages/build_package.js playwright ./playwright.tgz --no-cleanup
$ ls ./packages/playwright # inspect the folder

Testing packages

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 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 file.
  • playwright-electron is published manually.

To publish a new version of playwright-electron:

  1. Bump playwright-electron version inside //packages/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