npmgen-core 0.1.2

Library that generates the npm publish tree shipping a prebuilt Rust binary.
Documentation

npmgen-core

The library behind npmgen.

It generates the npm publish tree that ships a prebuilt Rust binary. The tree is a meta package plus one package per platform, wired through optionalDependencies and npm os/cpu filters. The npmgen command-line tool is a thin wrapper over this crate.

Usage

Add it as a dependency:

cargo add npmgen-core

Drive a generation through the builder:

use npmgen_core::Generator;

Generator::builder()
    .manifest_path("Cargo.toml")
    .out("dist/npm")
    .no_build(true)
    .build()
    .run()?;

Package identity is read from the target crate with cargo metadata. Targets, payload, and foreign manifests come from [package.metadata.npmgen], documented in the main README.

Key types

  • Generator builds and runs a generation; GeneratorBuilder configures it.
  • Project is the resolved target crate; Config is its npmgen metadata.
  • Target is one resolved platform; TargetResolver derives the set.
  • BuildDriver is the build seam, with CargoDriver as the default.

License

MIT. See LICENSE.