From d95891ebadbc91e28b66f3726a758df742e57293 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Mon, 4 May 2020 22:24:40 -0700 Subject: [PATCH] fix(install): only install browsers needed by this revision (#2112) --- src/install/installer.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/install/installer.ts b/src/install/installer.ts index e18db5d28c..7806c2e6fa 100644 --- a/src/install/installer.ts +++ b/src/install/installer.ts @@ -63,7 +63,6 @@ async function validateCache(packagePath: string, browsersPath: string, linksDir let downloadedBrowsers = (await fsReaddirAsync(browsersPath)).map(file => path.join(browsersPath, file)); downloadedBrowsers = downloadedBrowsers.filter(file => browserPaths.isBrowserDirectory(file)); const directories = new Set(downloadedBrowsers); - directories.delete(path.join(browsersPath, '.links')); for (const browser of allBrowsers) directories.delete(browserPaths.browserDirectory(browsersPath, browser)); for (const directory of directories) { @@ -71,8 +70,9 @@ async function validateCache(packagePath: string, browsersPath: string, linksDir await removeFolderAsync(directory).catch(e => {}); } - // 3. Install missing browsers. - for (const browser of allBrowsers) { + // 3. Install missing browsers for this package. + const myBrowsers = JSON.parse((await fsReadFileAsync(path.join(packagePath, 'browsers.json'))).toString())['browsers']; + for (const browser of myBrowsers) { const browserPath = browserPaths.browserDirectory(browsersPath, browser); if (await browserFetcher.downloadBrowserWithProgressBar(browserPath, browser)) await installBrowser(packagePath, browserPath, browser);