Skip to content

Commit

Permalink
install into tmpdir
Browse files Browse the repository at this point in the history
  • Loading branch information
trxcllnt committed May 20, 2024
1 parent f208616 commit 2ee23bd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/main.pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,19 @@ jobs:
set -x;
targetdir="./targets${t:+/${t}}${m:+/${m}}";
pkg_name="$(jq -r '.name' "${targetdir}/package.json")";
npm install --loglevel verbose --global --unsafe-perm "${targetdir}";
cd /;
# Install the package into a temp dir
_tmp="$(mktemp -d)";
mkdir -p "${_tmp}/node_modules";
cp -ar "${targetdir}" "${_tmp}/node_modules/";
cd "${_tmp}/${pkg_name}";
npm i;
cd "${_tmp}/";
# Attempt to import as CommonJS
node -e "require('${pkg_name}')" || true;
# Attempt to import as ESModule
node --input-type=module -e "import '${pkg_name}'" || true;
cd /;
rm -rf "${_tmp}";
test-tree-shaking-pull-request:
needs:
Expand Down

0 comments on commit 2ee23bd

Please sign in to comment.