mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: use puppeteer node for installation script (#9489)
Fixed: https://github.com/puppeteer/puppeteer/issues/9470
This commit is contained in:
parent
29b948197d
commit
9bf90d9f4b
@ -8,8 +8,10 @@ sidebar_label: createBrowserFetcher
|
||||
|
||||
```typescript
|
||||
createBrowserFetcher: (
|
||||
options: Partial<
|
||||
options?:
|
||||
| Partial<
|
||||
import('puppeteer-core/internal/puppeteer-core.js').BrowserFetcherOptions
|
||||
>
|
||||
| undefined
|
||||
) => import('puppeteer-core/internal/puppeteer-core.js').BrowserFetcher;
|
||||
```
|
||||
|
@ -8,15 +8,17 @@ sidebar_label: PuppeteerNode.createBrowserFetcher
|
||||
|
||||
```typescript
|
||||
class PuppeteerNode {
|
||||
createBrowserFetcher(options: Partial<BrowserFetcherOptions>): BrowserFetcher;
|
||||
createBrowserFetcher(
|
||||
options?: Partial<BrowserFetcherOptions>
|
||||
): BrowserFetcher;
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
||||
| options | Partial<[BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md)> | Set of configurable options to specify the settings of the BrowserFetcher. |
|
||||
| --------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
||||
| options | Partial<[BrowserFetcherOptions](./puppeteer.browserfetcheroptions.md)> | <i>(Optional)</i> Set of configurable options to specify the settings of the BrowserFetcher. |
|
||||
|
||||
**Returns:**
|
||||
|
||||
|
@ -289,7 +289,7 @@ export class PuppeteerNode extends Puppeteer {
|
||||
* @returns A new BrowserFetcher instance.
|
||||
*/
|
||||
createBrowserFetcher(
|
||||
options: Partial<BrowserFetcherOptions>
|
||||
options: Partial<BrowserFetcherOptions> = {}
|
||||
): BrowserFetcher {
|
||||
const downloadPath = this.defaultDownloadPath;
|
||||
if (downloadPath) {
|
||||
@ -304,6 +304,9 @@ export class PuppeteerNode extends Puppeteer {
|
||||
if (this.configuration.downloadHost) {
|
||||
options.host = this.configuration.downloadHost;
|
||||
}
|
||||
if (this.configuration.defaultProduct) {
|
||||
options.product = this.configuration.defaultProduct;
|
||||
}
|
||||
return new BrowserFetcher(options as BrowserFetcherOptions);
|
||||
}
|
||||
}
|
||||
|
@ -16,10 +16,9 @@
|
||||
|
||||
import https, {RequestOptions} from 'https';
|
||||
import createHttpsProxyAgent, {HttpsProxyAgentOptions} from 'https-proxy-agent';
|
||||
import {join} from 'path';
|
||||
import ProgressBar from 'progress';
|
||||
import {getProxyForUrl} from 'proxy-from-env';
|
||||
import {BrowserFetcher} from 'puppeteer-core';
|
||||
import {PuppeteerNode} from 'puppeteer-core/internal/node/PuppeteerNode.js';
|
||||
import {PUPPETEER_REVISIONS} from 'puppeteer-core/internal/revisions.js';
|
||||
import URL from 'url';
|
||||
import {getConfiguration} from '../getConfiguration.js';
|
||||
@ -42,14 +41,10 @@ export async function downloadBrowser(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
const puppeteer = new PuppeteerNode({configuration, isPuppeteerCore: false});
|
||||
|
||||
const product = configuration.defaultProduct!;
|
||||
const browserFetcher = new BrowserFetcher({
|
||||
product,
|
||||
host: configuration.downloadHost,
|
||||
path:
|
||||
configuration.downloadPath ??
|
||||
join(configuration.cacheDirectory!, product),
|
||||
});
|
||||
const browserFetcher = puppeteer.createBrowserFetcher();
|
||||
|
||||
let revision = configuration.browserRevision;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user