From 05c63a79070752c7524985f8c3949569fdf1dba4 Mon Sep 17 00:00:00 2001 From: Dominic Griesel Date: Mon, 11 Nov 2024 15:04:47 +0100 Subject: [PATCH 1/3] test: check if bundling for the browser is supported yet --- .github/workflows/test-and-release.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index 29e60ad77c86..008ded63fb8f 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -138,6 +138,14 @@ jobs: node -e 'assert.equal(require("zwave-js").libVersion, require("zwave-js/package.json").version)' node -e 'assert.equal(require("zwave-js").libName, require("zwave-js/package.json").name)' + # Test if bundling for the browser is supported yet + - name: Are we browser yet? + continue-on-error: true + run: | + npm i -D esbuild + echo "import 'zwave-js'" > test.mjs + esbuild test.mjs --bundle --format=esm --outdir=build --sourcemap --target=es2022 --platform=browser --analyze=verbose --external:node:crypto + # =================== lint: From 899bb4ec24d7886b6baf7e20777930536f8394f9 Mon Sep 17 00:00:00 2001 From: Dominic Griesel Date: Mon, 11 Nov 2024 15:10:13 +0100 Subject: [PATCH 2/3] fix: directory --- .github/workflows/test-and-release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index 008ded63fb8f..5b67980b7c24 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -83,8 +83,10 @@ jobs: # I'd love to use yalc or something for this, but it doesn't use yarn pack to pack the tarballs # so we need to fake the install - name: Import main entry points for each package + id: monopack run: | TMP_DIR=$(mktemp -d) + echo TMP_DIR=$TMP_DIR >> $GITHUB_OUTPUT echo "Re-creating a production environment..." yarn monopack --target "$TMP_DIR/.tarballs" --no-version @@ -141,7 +143,10 @@ jobs: # Test if bundling for the browser is supported yet - name: Are we browser yet? continue-on-error: true + env: + TMP_DIR: ${{ steps.monopack.outputs.TMP_DIR }} run: | + cd $TMP_DIR npm i -D esbuild echo "import 'zwave-js'" > test.mjs esbuild test.mjs --bundle --format=esm --outdir=build --sourcemap --target=es2022 --platform=browser --analyze=verbose --external:node:crypto From 5a0e2b99f45dd638ecbc34dd1fd256bde9705819 Mon Sep 17 00:00:00 2001 From: Dominic Griesel Date: Mon, 11 Nov 2024 15:20:52 +0100 Subject: [PATCH 3/3] fix: whoops --- .github/workflows/test-and-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index 5b67980b7c24..78baa671f90e 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -149,7 +149,7 @@ jobs: cd $TMP_DIR npm i -D esbuild echo "import 'zwave-js'" > test.mjs - esbuild test.mjs --bundle --format=esm --outdir=build --sourcemap --target=es2022 --platform=browser --analyze=verbose --external:node:crypto + npx esbuild test.mjs --bundle --format=esm --outdir=build --sourcemap --target=es2022 --platform=browser --analyze=verbose --external:node:crypto # ===================