From 00ba6edc669407bbc8515d920f157621329b37e4 Mon Sep 17 00:00:00 2001 From: Parker Brown <17183625+parkerbxyz@users.noreply.github.com> Date: Fri, 22 Aug 2025 13:22:02 -0700 Subject: [PATCH] Switch build output to CommonJS (.cjs) format Updated build script to output .cjs files instead of .js, and updated action.yml to reference the new .cjs files. Also clarified proxy environment variable handling in bootstrap.js for consistency. --- action.yml | 4 ++-- bootstrap.js | 8 ++++---- package.json | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 380280d..2b5d045 100644 --- a/action.yml +++ b/action.yml @@ -133,5 +133,5 @@ outputs: description: "GitHub App slug" runs: using: "node24" - main: "dist/bootstrap.js" - post: "dist/post.js" + main: "dist/bootstrap.cjs" + post: "dist/post.cjs" diff --git a/bootstrap.js b/bootstrap.js index 0619965..123b816 100644 --- a/bootstrap.js +++ b/bootstrap.js @@ -1,7 +1,7 @@ -// Enable env-based proxy support before loading the main bundle (unless caller explicitly set NODE_USE_ENV_PROXY) +// Enable env-based proxy support unless caller explicitly set NODE_USE_ENV_PROXY if (process.env.NODE_USE_ENV_PROXY == null) { - process.env.NODE_USE_ENV_PROXY = "1"; + process.env.NODE_USE_ENV_PROXY = 1; } -// Defer to original main entry (dynamic import ensures above code runs first) -await import("./main.js"); +// Import main after environment prepared. Using dynamic import so this executes first even when bundled. +import("./main.js"); diff --git a/package.json b/package.json index 76a73cb..2123f18 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "node": ">=24.4.0" }, "scripts": { - "build": "esbuild bootstrap.js main.js post.js --bundle --outdir=dist --format=esm --platform=node --packages=bundle", + "build": "esbuild bootstrap.js main.js post.js --bundle --outdir=dist --out-extension:.js=.cjs --platform=node --packages=bundle", "test": "c8 --100 ava tests/index.js", "coverage": "c8 report --reporter html", "postcoverage": "open-cli coverage/index.html"