Skip to content

Commit

Permalink
chore: remove "module" from @puppeteer/browsers (#10986)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrandolf-2 authored Sep 22, 2023
1 parent 4ca3645 commit 86c28ed
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/issue-analyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
- name: Install dependencies Firefox
run: node ./node_modules/puppeteer/install.js
run: node ./node_modules/puppeteer/install.mjs
env:
PUPPETEER_PRODUCT: firefox
- name: Verify issue
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions packages/browsers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@
"clean": "../../tools/clean.js",
"test": "wireit"
},
"type": "commonjs",
"bin": "lib/cjs/main-cli.js",
"main": "./lib/cjs/main.js",
"module": "./lib/esm/main.js",
"type": "commonjs",
"exports": {
".": {
"import": "./lib/esm/main.js",
"require": "./lib/cjs/main.js"
}
"import": "./lib/esm/main.js",
"require": "./lib/cjs/main.js"
},
"wireit": {
"build": {
Expand Down
28 changes: 14 additions & 14 deletions packages/puppeteer/install.js → packages/puppeteer/install.mjs
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env node

/**
* Copyright 2017 Google Inc. All rights reserved.
*
Expand All @@ -24,20 +26,18 @@
* necessary.
*/

const fs = require('fs');
const path = require('path');

// Need to ensure TS is compiled before loading the installer
if (!fs.existsSync(path.join(__dirname, 'lib'))) {
console.warn(
'Skipping browser installation because the Puppeteer build is not available. Run `npm install` again after you have re-built Puppeteer.'
);
process.exit(0);
}

try {
const {downloadBrowser} = require('puppeteer/internal/node/install.js');
const {downloadBrowser} = await (async () => {
try {
return await import('puppeteer/internal/node/install.js');
} catch {
console.warn(
'Skipping browser installation because the Puppeteer build is not available. Run `npm install` again after you have re-built Puppeteer.'
);
process.exit(0);
}
})();
downloadBrowser();
} catch (err) {
console.warn('Browser download failed', err);
} catch (error) {
console.warn('Browser download failed', error);
}
4 changes: 2 additions & 2 deletions packages/puppeteer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"build:docs": "wireit",
"build": "wireit",
"clean": "../../tools/clean.js",
"postinstall": "node install.js",
"postinstall": "node install.mjs",
"prepack": "wireit"
},
"wireit": {
Expand Down Expand Up @@ -111,7 +111,7 @@
"files": [
"lib",
"src",
"install.js",
"install.mjs",
"!*.test.js",
"!*.test.d.ts",
"!*.test.js.map",
Expand Down

0 comments on commit 86c28ed

Please sign in to comment.