Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support PLAYWRIGHT_GLOBAL_INSTALL=1 env variable #1470

Merged
merged 2 commits into from
Mar 23, 2020

Conversation

aslushnikov
Copy link
Collaborator

You can install playwright with

PLAYWRIGHT_GLOBAL_INSTALL=1 npm i playwright

to make it use a single shared location for all browser
downloads.

Fixes #1102

You can install playwright with

```
PLAYWRIGHT_GLOBAL_INSTALL=1 npm i playwright
```

to make it use a single shared location for all browser
downloads.

Fixes microsoft#1102
async function downloadBrowserWithProgressBar(downloadPath, browser, version = '') {
async function downloadBrowserWithProgressBar(downloadPath, browser, respectGlobalInstall = false) {
const PLAYWRIGHT_GLOBAL_INSTALL = respectGlobalInstall ? getFromENV('PLAYWRIGHT_GLOBAL_INSTALL') : false;
if (!!PLAYWRIGHT_GLOBAL_INSTALL && PLAYWRIGHT_GLOBAL_INSTALL.toLowerCase().trim() !== 'false')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe respect 0 similar to false?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

const browserFetcher = require('./lib/server/browserFetcher.js');
const packageJSON = require('./package.json');
const envPaths = require('env-paths');
const appPaths = envPaths('playwright');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd inline to the callsite.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@aslushnikov aslushnikov merged commit a74e23a into microsoft:master Mar 23, 2020
@aslushnikov aslushnikov deleted the global-install branch March 23, 2020 19:49
aslushnikov added a commit to aslushnikov/playwright that referenced this pull request Mar 24, 2020
…rosoft#1470)"

In an offline discussion, we ended up not liking the way it is.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] support global installation of browsers
3 participants