Skip to content

Commit

Permalink
chore: move pw-core utilsBundleImpl into own directory (#23706)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Jun 15, 2023
1 parent bad09ac commit 8ed956e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/playwright-core/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
!lib/**/*.html
!lib/**/*.png
!lib/**/*.ttf
!lib/xdg-open
!lib/utilsBundleImpl/xdg-open
# Exclude injected files. A preprocessed version of these is included via lib/generated.
# See src/server/injected/README.md.
lib/**/injected/
Expand Down
11 changes: 8 additions & 3 deletions packages/playwright-core/bundles/utils/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,20 @@ const path = require('path');
const esbuild = require('esbuild');
const fs = require('fs');

const outdir = path.join(__dirname, '../../lib/utilsBundleImpl');

if (!fs.existsSync(outdir))
fs.mkdirSync(outdir);

{
// 'open' package requires 'xdg-open' script to be present, which does not get bundled by esbuild.
fs.copyFileSync(path.join(__dirname, 'node_modules/open/xdg-open'), path.join(__dirname, '../../lib/xdg-open'));
// 'open' package requires 'xdg-open' binary to be present, which does not get bundled by esbuild.
fs.copyFileSync(path.join(__dirname, 'node_modules/open/xdg-open'), path.join(outdir, 'xdg-open'));
}

esbuild.build({
entryPoints: [path.join(__dirname, 'src/utilsBundleImpl.ts')],
bundle: true,
outdir: path.join(__dirname, '../../lib'),
outfile: path.join(outdir, 'index.js'),
format: 'cjs',
platform: 'node',
target: 'ES2019',
Expand Down

0 comments on commit 8ed956e

Please sign in to comment.