From d99e44e996e9222e175f05d2b0dab1c40fe89a5c Mon Sep 17 00:00:00 2001 From: Salastil Date: Sun, 23 Nov 2025 01:53:57 -0500 Subject: [PATCH] Bundle Puppeteer Dependency --- README.md | 15 ++++ internal/assets/node_modules.tar.gz | Bin 0 -> 155 bytes internal/dependencies.go | 104 ++++++++++++++++++++++++++++ internal/extractor.go | 12 +++- scripts/build_node_modules.sh | 22 ++++++ 5 files changed, 151 insertions(+), 2 deletions(-) create mode 100644 internal/assets/node_modules.tar.gz create mode 100644 internal/dependencies.go create mode 100755 scripts/build_node_modules.sh diff --git a/README.md b/README.md index 76974b5..61de9cc 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,17 @@ # streamed-tui TUI Application for launching streamed.pk feeds + +## Bundled Puppeteer dependencies + +The extractor relies on `puppeteer-extra`, `puppeteer-extra-plugin-stealth`, and `puppeteer`. These Node.js packages are +bundled into the final binary via `internal/assets/node_modules.tar.gz`. To refresh the archive (for example after updating +dependency versions), run: + +``` +scripts/build_node_modules.sh +``` + +The script installs the dependencies into a temporary directory and regenerates the tarball so the Go binary can extract +them at runtime without requiring `npm install` on the target system. When the binary starts it will automatically unpack the +archive into the user's cache directory (or `$TMPDIR` fallback) and point Puppeteer at that cached `node_modules` tree, so the +program can run as a single self-contained executable even when no dependencies exist alongside it. diff --git a/internal/assets/node_modules.tar.gz b/internal/assets/node_modules.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..2f627c3153995b9d2ca66bda2ec4415d0097cf88 GIT binary patch literal 155 zcmb2|=3oE==C>Cexegf!v_6zkRllHe_QqomLq_q96SwT$zfoH>q@^tI&;GO09tmu5 z^PO$tie?1Ke9MwumgV|vO/dev/null 2>&1; then + echo "npm is required to bundle node_modules" >&2 + exit 1 +fi + +TMP_DIR="$(mktemp -d)" +trap 'rm -rf "$TMP_DIR"' EXIT + +pushd "$TMP_DIR" >/dev/null +npm install puppeteer-extra puppeteer-extra-plugin-stealth puppeteer +mkdir -p "$ASSETS_DIR" +tar -czf "$ARCHIVE" node_modules +popd >/dev/null + +echo "Bundled node_modules into $ARCHIVE"