mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 06:02:57 +03:00
fix(install): only install browsers needed by this revision (#2112)
This commit is contained in:
parent
33ebe66ad4
commit
d95891ebad
@ -63,7 +63,6 @@ async function validateCache(packagePath: string, browsersPath: string, linksDir
|
|||||||
let downloadedBrowsers = (await fsReaddirAsync(browsersPath)).map(file => path.join(browsersPath, file));
|
let downloadedBrowsers = (await fsReaddirAsync(browsersPath)).map(file => path.join(browsersPath, file));
|
||||||
downloadedBrowsers = downloadedBrowsers.filter(file => browserPaths.isBrowserDirectory(file));
|
downloadedBrowsers = downloadedBrowsers.filter(file => browserPaths.isBrowserDirectory(file));
|
||||||
const directories = new Set<string>(downloadedBrowsers);
|
const directories = new Set<string>(downloadedBrowsers);
|
||||||
directories.delete(path.join(browsersPath, '.links'));
|
|
||||||
for (const browser of allBrowsers)
|
for (const browser of allBrowsers)
|
||||||
directories.delete(browserPaths.browserDirectory(browsersPath, browser));
|
directories.delete(browserPaths.browserDirectory(browsersPath, browser));
|
||||||
for (const directory of directories) {
|
for (const directory of directories) {
|
||||||
@ -71,8 +70,9 @@ async function validateCache(packagePath: string, browsersPath: string, linksDir
|
|||||||
await removeFolderAsync(directory).catch(e => {});
|
await removeFolderAsync(directory).catch(e => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Install missing browsers.
|
// 3. Install missing browsers for this package.
|
||||||
for (const browser of allBrowsers) {
|
const myBrowsers = JSON.parse((await fsReadFileAsync(path.join(packagePath, 'browsers.json'))).toString())['browsers'];
|
||||||
|
for (const browser of myBrowsers) {
|
||||||
const browserPath = browserPaths.browserDirectory(browsersPath, browser);
|
const browserPath = browserPaths.browserDirectory(browsersPath, browser);
|
||||||
if (await browserFetcher.downloadBrowserWithProgressBar(browserPath, browser))
|
if (await browserFetcher.downloadBrowserWithProgressBar(browserPath, browser))
|
||||||
await installBrowser(packagePath, browserPath, browser);
|
await installBrowser(packagePath, browserPath, browser);
|
||||||
|
Loading…
Reference in New Issue
Block a user