mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: don't clean up previous browser versions (#9568)
Since we moved to the central binaries cache it does not make sense to clean up old binaries automatically because multiple installations can use different versions. We expect the users to clean the cache from time to time until we offer a CLI for managing the browsers. Closes #9533
This commit is contained in:
parent
3d249dc3a3
commit
344bc2af62
@ -504,6 +504,13 @@ export class BrowserFetcher {
|
|||||||
#getFolderPath(revision: string): string {
|
#getFolderPath(revision: string): string {
|
||||||
return path.resolve(this.#downloadPath, `${this.#platform}-${revision}`);
|
return path.resolve(this.#downloadPath, `${this.#platform}-${revision}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
getDownloadPath(): string {
|
||||||
|
return this.#downloadPath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseFolderPath(
|
function parseFolderPath(
|
||||||
|
@ -94,13 +94,18 @@ export async function downloadBrowser(): Promise<void> {
|
|||||||
logPolitely(
|
logPolitely(
|
||||||
`${supportedProducts[product]} (${revisionInfo.revision}) downloaded to ${revisionInfo.folderPath}`
|
`${supportedProducts[product]} (${revisionInfo.revision}) downloaded to ${revisionInfo.folderPath}`
|
||||||
);
|
);
|
||||||
localRevisions = localRevisions.filter(revision => {
|
const otherRevisions = localRevisions.filter(revision => {
|
||||||
return revision !== revisionInfo.revision;
|
return revision !== revisionInfo.revision;
|
||||||
});
|
});
|
||||||
const cleanupOldVersions = localRevisions.map(revision => {
|
if (otherRevisions.length) {
|
||||||
return browserFetcher.remove(revision);
|
logPolitely(
|
||||||
});
|
`Other installed ${
|
||||||
Promise.all([...cleanupOldVersions]);
|
supportedProducts[product]
|
||||||
|
} browsers in ${browserFetcher.getDownloadPath()} include: ${otherRevisions.join(
|
||||||
|
', '
|
||||||
|
)}. Remove old revisions from ${browserFetcher.getDownloadPath()} if you don't need them.`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onError(error: Error) {
|
function onError(error: Error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user