Open samjcombs opened 2 weeks ago
One of my outstanding questions with the native Node SEA approach was cross platform executable support.
Also, last time I checked it was still a preview feature, but since Node-22 is available as current
as of 2 weeks ago and it looks like it supports cross platform executable generation, using native SEA approach would be the ideal path.
The above pkg
method could be used as a stopgap until wgc
is tested/upgraded to support node-22.
This PR was marked stale due to lack of activity. It will be closed in 14 days.
Motivation and Context
In enterprise settings, installing a cli via npm globally isnt always possible. Potential blockers include:
Generally it is industry standard to offer cli tools in standalone binaries.
Details
Implementation is using vercel/pkg to produce the binaries.
While there are a few options for modern node binary distribution (deno, bun, node-22),
pkg
allows for easy export of cross-platform node16 binaries without fundamentally altering the runtime.NOTICE:
pkg
is deprecated as of early 2024 as the maintainer couldnt keep up with the ecosystem. Case in point,pkg
offers no support for es6 modules.Luckily, there is a workaround.
The workaround involves using rollup to bundle the output into a single
.cjs
file.Rollup doesn't seem to support top-level await so I made IIFEs out of of the two top-level awaits in the in the package.
TODO