Skip to content

Commit

Permalink
v1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
mbalabash committed Mar 27, 2023
1 parent 0afcf7d commit 4e3e1f6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 23 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This project adheres to [Semantic Versioning](http://semver.org/).

## 1.0.5

- Dropped support for [createBrowserFetcher](https://pptr.dev/api/puppeteer.puppeteernode.createbrowserfetcher#remarks)

## 1.0.4

- Added support for node-14
Expand Down
30 changes: 16 additions & 14 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { join } from 'path'
import puppeteer from 'puppeteer-core'
import { PUPPETEER_REVISIONS } from 'puppeteer-core/lib/cjs/puppeteer/revisions.js'
import { findChrome } from 'find-chrome-bin'
const { join } = require('path')
const puppeteer = require('puppeteer-core')
const { PUPPETEER_REVISIONS } = require('puppeteer-core/lib/cjs/puppeteer/revisions.js')
const { findChrome } = require('../index')

let chromeInfo = await findChrome({
min: 92,
max: 95,
download: {
puppeteer,
path: join('.', 'chrome'),
revision: PUPPETEER_REVISIONS.chromium
}
})
;(async () => {
let chromeInfo = await findChrome({
min: 92,
max: 128,
download: {
puppeteer,
path: join('../test', 'chrome'),
revision: PUPPETEER_REVISIONS.chromium
}
})

console.log(chromeInfo)
console.log(chromeInfo)
})()

// package.json
// {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "find-chrome-bin",
"version": "1.0.4",
"version": "1.0.5",
"description": "Finds local Chromium binary to use it with puppeteer-core",
"keywords": [
"chrome",
Expand Down
9 changes: 1 addition & 8 deletions src/chrome/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,14 @@ function chromeVersion(executablePath) {
).trim()
}

function createBrowserFetcher(puppeteer, path, host) {
if (puppeteer.BrowserFetcher) {
return new puppeteer.BrowserFetcher({ path, host })
}
return puppeteer.createBrowserFetcher({ path, host })
}

async function downloadChromium(puppeteer, path, revision) {
try {
let downloadHost =
process.env.PUPPETEER_DOWNLOAD_HOST ||
process.env.npm_config_puppeteer_download_host ||
process.env.npm_package_config_puppeteer_download_host

let browserFetcher = createBrowserFetcher(puppeteer, path, downloadHost)
let browserFetcher = new puppeteer.BrowserFetcher({ path, host: downloadHost })

let revisionInfo = browserFetcher.revisionInfo(revision)

Expand Down

0 comments on commit 4e3e1f6

Please sign in to comment.