edr icon indicating copy to clipboard operation
edr copied to clipboard

Add CLI for building npm packages

Open agostbiro opened this issue 1 year ago • 1 comments

The release workflow was implemented in https://github.com/NomicFoundation/hardhat/pull/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 avatar Oct 03 '23 18:10 agostbiro