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

Add CLI for building npm packages #198

Open
Tracked by #303
agostbiro opened this issue Oct 3, 2023 · 1 comment
Open
Tracked by #303

Add CLI for building npm packages #198

agostbiro opened this issue Oct 3, 2023 · 1 comment
Assignees

Comments

@agostbiro
Copy link
Member

The release workflow was implemented in NomicFoundation/hardhat#4415 based on the NAPI CLI generated project scaffolding. The result has a lot of code duplication and thus is prone to error. Another downside of the workflow being encoded in the GitHub CI instead of a Rust CLI app is that it cannot be reproduced locally. We should move the release workflow to a Rust CLI app similar to Slang.

When releasing EDR as an npm package, we need to:

  1. change the version from major.minor.patch-dev to major.minor.patch
  2. cross-compile binaries for all supported target triples (see)
  3. auto-generate a JS wrapper that select the correct binary
  4. publish packages to npm
  5. bump the version to the next semver version and append the dev suffix

Slang has already implemented a CLI tool to achieve (most) of these, which we can likely reuse. The PR implementing this CLI can be found here. The files of interest are in crates/infra/cli.

We want a similar CLI tool for EDR. EDR-specific commands can live as duplicate code within our repository, but it would be good to create or use a general-purpose crate wherever possible.

Definiton of Done

  • Create a CLI that supports commands 1 through 5 (listed above)
  • Share as much of the common code between EDR and Slang (and potentially external crates)
@agostbiro
Copy link
Member Author

agostbiro commented Oct 23, 2023

It's important to allow releasing locally to improve our agility and in case of failures in Github Actions.

Releasing from local CLI has these downsides besides the obvious upsides:

  • We can’t test the built artifacts on their target platforms if we take the Slang approach
    • This is important imo
  • We need the NPM token on our machines to publish the package
  • We lose the provenance certificate on NPM that links the CI run to the released package for auditable builds
    • This is a nice to have at this stage imo, will be more important once 3rd parties adopt EDR

@Wodann Wodann changed the title Move release workflow to Rust Add CLI for building npm packages Oct 25, 2023
@Wodann Wodann mentioned this issue Feb 26, 2024
29 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

3 participants