apify-cli icon indicating copy to clipboard operation
apify-cli copied to clipboard

Experiment with Bun bundling for distributing the CLI as a single-file executable

Open vladfrangu opened this issue 1 year ago • 1 comments

After the meeting with @netmilk about the CLI, we should try using Bun to build a single-file executable of the CLI that can then be distributed ("eliminating" the requirement of having node installed/tagged along to run the CLI)

Initial testing shows that we might need oclif's help, as they rely heavily on finding the package.json, so that might need tweaking (or a replacement of CLI frameworks).

vladfrangu avatar Jul 01 '24 09:07 vladfrangu

Let us know if you run into any issues with Bun

Jarred-Sumner avatar Jul 01 '24 20:07 Jarred-Sumner

@Jarred-Sumner sorry to revive the dead, we are closer and closer to having bun-bundles for our CLI. It seems that building it with --sourcemap doesn't quite work on Linux, but I cnr on my mac.. https://github.com/apify/apify-cli/actions/runs/15228772365/job/42834142625?pr=810

Any tips on how to debug this?

vladfrangu avatar May 24 '25 16:05 vladfrangu

Another issue: bundles built on windows x64 don't run for whatever reason on arm64, but building the same bundles on arm64 just works (and it still outputs x64 binaries). The non-baseline edition just exists, no output or nothing, the baseline one throws a weird internal error from yargs(?). And we cannot build from arm64 because setup-bun action doesn't work at all for whatever reason 😢 (and neither does the script)

vladfrangu avatar May 25 '25 10:05 vladfrangu

We're bun-dling with bun! This is done :D

vladfrangu avatar Aug 18 '25 09:08 vladfrangu