mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: deprecate configuration via package.json (#12176)
This commit is contained in:
parent
308bc8d05a
commit
c96c7623bc
@ -36,9 +36,6 @@ Puppeteer will look up the file tree for any of the following formats:
|
|||||||
- `puppeteer.config.js`, and
|
- `puppeteer.config.js`, and
|
||||||
- `puppeteer.config.cjs`
|
- `puppeteer.config.cjs`
|
||||||
|
|
||||||
Puppeteer will also read a `puppeteer` key from your application's
|
|
||||||
`package.json`.
|
|
||||||
|
|
||||||
See the [`Configuration`](../api/puppeteer.configuration) interface for possible
|
See the [`Configuration`](../api/puppeteer.configuration) interface for possible
|
||||||
options.
|
options.
|
||||||
|
|
||||||
@ -49,6 +46,13 @@ After adding a configuration file, you may need to remove and reinstall
|
|||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
:::caution
|
||||||
|
|
||||||
|
Previous versions of Puppeteer allowed configuration via the `config` key in
|
||||||
|
`package.json`. This behavior is now deprecated and will be removed in the future.
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
#### Changing the default cache directory
|
#### Changing the default cache directory
|
||||||
|
@ -127,6 +127,17 @@ export const getConfiguration = (): Configuration => {
|
|||||||
downloadHost;
|
downloadHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
Object.keys(process.env).some(key => {
|
||||||
|
return key.startsWith('npm_package_config_puppeteer_');
|
||||||
|
}) &&
|
||||||
|
configuration.logLevel === 'warn'
|
||||||
|
) {
|
||||||
|
console.warn(
|
||||||
|
`Configuring Puppeteer via npm/package.json is deprecated. Use https://pptr.dev/guides/configuration instead.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
configuration.cacheDirectory =
|
configuration.cacheDirectory =
|
||||||
process.env['PUPPETEER_CACHE_DIR'] ??
|
process.env['PUPPETEER_CACHE_DIR'] ??
|
||||||
process.env['npm_config_puppeteer_cache_dir'] ??
|
process.env['npm_config_puppeteer_cache_dir'] ??
|
||||||
|
Loading…
Reference in New Issue
Block a user