This provides a tarball containing an npm package (npm-package.tar.gz) which when installed into an npm project: detects the current platform, fetches the best possible archive from your artifact URL, and copies the binary into your node_modules. This can be used to install the binaries like any other npm package, or to run them with
This kind of installer is ideal for making a native Rust tool available to JS devs.
An "installer hint" will be provided that shows how to install via
npm like so:
npm install @axodotdev/[email protected]
cargo-dist does not publish the package for you, you need to do that manually once the tarball is built. Conveniently, npm supports publishing from a url-to-a-tarball directly, and since 0.0.7 we make our tarballs look like "proper" npm package tarballs, so you can just do this:
npm publish URL_TO_TARBALL
You can find the URL to the tarball at the bottom of the Github Release, inside the collapsible "assets" dropdown (*-npm-package.tar.gz). The format of the url is:
If you're cutting a stable release (not-prerelease), you can use the "latest" URL format:
In the future we may introduce more streamlined CI-based publishing workflows.
We will otherwise do our best to faithfully translate any standard Cargo.toml values you set to an equivalent in the npm package.json format (name, version, authors, description, homepage, repository, keywords, categories...).
The package will also include an npm-shrinkwrap.json file for the npm packages the installer uses, this is the same as package-lock.json but "really for reals I want this to be respected even if it's installed into another project". Note that cargo install similarly disrespects Cargo.lock unless you pass --locked.
- Requires a well-defined artifact URL
- Cannot detect situations where musl-based builds are appropriate (static or dynamic)
- Relies on nodejs's builtin gzip support to unpack the files, which only works with .tar.gz
- Cannot run any kind of custom install logic