From ed09eb606568e187d51fc7052edd018039308a11 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Thu, 15 Jun 2023 00:26:27 +0200 Subject: [PATCH] cherry-pick(#23710): chore: bundle open's xdg-open script (#23714) Cherry-pick: https://github.com/microsoft/playwright/commit/60de8308a8c90fa63f457cfc1752f0e4933e6cf6 PR: #23710 Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- packages/playwright-core/.npmignore | 1 + packages/playwright-core/bundles/utils/build.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/packages/playwright-core/.npmignore b/packages/playwright-core/.npmignore index 132b57f597..c13cb08254 100644 --- a/packages/playwright-core/.npmignore +++ b/packages/playwright-core/.npmignore @@ -9,6 +9,7 @@ !lib/**/*.html !lib/**/*.png !lib/**/*.ttf +!lib/xdg-open # Exclude injected files. A preprocessed version of these is included via lib/generated. # See src/server/injected/README.md. lib/**/injected/ diff --git a/packages/playwright-core/bundles/utils/build.js b/packages/playwright-core/bundles/utils/build.js index 4c947f73fa..ac8f8c6c00 100644 --- a/packages/playwright-core/bundles/utils/build.js +++ b/packages/playwright-core/bundles/utils/build.js @@ -17,6 +17,12 @@ // @ts-check const path = require('path'); const esbuild = require('esbuild'); +const fs = require('fs'); + +{ + // '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')); +} esbuild.build({ entryPoints: [path.join(__dirname, 'src/utilsBundleImpl.ts')],