Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: standalone binary distributions for wgc #794

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

samjcombs
Copy link

Motivation and Context

In enterprise settings, installing a cli via npm globally isnt always possible. Potential blockers include:

  • complete lack of familiarity with npm ecosystem (android, ios app teams, service teams, etc)
  • conflicts with existing node ecosystem (perhaps teams are forced to use node14 or otherwise have conflicting dependencies)

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

  • Update stub URLS in install scripts with real release locations
  • Develop github workflow to build binaries in CI/CD pipeline
  • Tests or benchmark included
  • Documentation is changed or added on https://app.gitbook.com/
  • PR title must follow conventional-commit-standard

@samjcombs
Copy link
Author

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.

Copy link

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant