pub struct NpmConfig {Show 32 fields
pub id: Option<String>,
pub ids: Option<Vec<String>>,
pub mode: NpmMode,
pub scope: Option<String>,
pub metapackage: Option<String>,
pub bin: Option<String>,
pub libc_aware: bool,
pub name: Option<String>,
pub description: Option<String>,
pub homepage: Option<String>,
pub keywords: Option<Vec<String>>,
pub license: Option<String>,
pub author: Option<String>,
pub engines: Option<BTreeMap<String, String>>,
pub files: Option<Vec<String>>,
pub provenance: Option<bool>,
pub repository: Option<String>,
pub bugs: Option<String>,
pub access: Option<String>,
pub tag: Option<String>,
pub format: Option<String>,
pub url_template: Option<String>,
pub extra_files: Option<Vec<String>>,
pub templated_extra_files: Option<Vec<NpmTemplatedExtraFile>>,
pub extra: Option<HashMap<String, Value>>,
pub registry: Option<String>,
pub token: Option<String>,
pub auth: NpmAuthMode,
pub skip: Option<StringOrBool>,
pub required: Option<bool>,
pub if_condition: Option<String>,
pub retain_on_rollback: Option<bool>,
}Expand description
NPM package registry publisher configuration.
In the default optional-deps mode anodizer emits one thin npm package
per built platform (with os/cpu/libc selectors derived from the
target triple) plus a metapackage whose optionalDependencies lists
every platform package; npm’s native resolution installs only the one
matching the host. In postinstall mode a single package carries a
postinstall script that downloads the matching release archive at
npm install time. Each npms[] entry produces one publish.
Fields§
§id: Option<String>Unique identifier for selecting this entry from the CLI (--id=...).
ids: Option<Vec<String>>Build IDs filter: only include artifacts whose archive id is in this list.
mode: NpmModeBinary-distribution strategy. optional-deps (default) emits npm’s
native per-platform packages; postinstall emits a download shim.
scope: Option<String>npm scope for the per-platform packages emitted in optional-deps
mode (e.g. @biomejs). The per-platform packages are named
<scope>/<bin>-<os>-<cpu>[-<libc>]. Required for optional-deps
mode; ignored in postinstall mode.
metapackage: Option<String>Metapackage name for optional-deps mode (e.g. biome). This is the
package users npm install; it lists every per-platform package under
optionalDependencies and ships the bin shim. Falls back to name
(or the crate name) when unset.
bin: Option<String>Command name installed by the metapackage’s bin map (optional-deps
mode). Falls back to the metapackage basename when unset.
libc_aware: boolIn optional-deps mode, emit separate per-platform packages for linux
musl vs glibc (distinguished by the npm libc selector). When
false, a single linux package per cpu is emitted with no libc
selector. Default true — musl and glibc binaries are not
interchangeable, so collapsing them risks installing the wrong one.
name: Option<String>NPM package name (the metapackage / postinstall package). May be scoped
(@org/foo) or unscoped (foo). Falls back to the crate name when unset.
description: Option<String>Templated package description. Falls back to the project-level
metadata.description when unset.
homepage: Option<String>Templated homepage URL. Falls back to metadata.homepage when unset.
keywords: Option<Vec<String>>NPM keywords list.
license: Option<String>Templated SPDX license identifier (e.g. MIT, Apache-2.0).
Falls back to metadata.license when unset.
Templated author field for package.json. Falls back to the
project’s metadata.maintainers[0], and then to the crate’s
Cargo.toml [package].authors[0], when unset.
engines: Option<BTreeMap<String, String>>npm engines constraint map written verbatim into package.json
(e.g. { node: ">=18" }). When unset, anodizer emits a sensible
default of { node: ">=18" } — the floor every leading native-CLI
wrapper (esbuild, biome, swc) declares. Set to an empty map to
suppress the field entirely.
files: Option<Vec<String>>Explicit npm files allowlist written into package.json. When
unset, anodizer derives it from what each package actually ships
(the per-platform binary, the metapackage shim.js, or the
postinstall launcher/script) plus any extra_files basenames. Set
to an empty list to suppress the field (npm then falls back to its
implicit inclusion rules).
provenance: Option<bool>npm publishConfig.provenance flag. When unset, anodizer emits
true — the npm supply-chain norm that biome and swc both set,
pairing with anodizer’s signing story. Set to false to disable.
repository: Option<String>Templated repository URL. Emitted as repository.url in
package.json with type: git.
bugs: Option<String>Templated bug tracker URL. Emitted as bugs.url in package.json.
access: Option<String>NPM access level for scoped packages. Accepts "public" /
"restricted". Scoped packages on npmjs.org default to
restricted unless this is set to public.
tag: Option<String>NPM dist-tag for the publish (default latest). Templated.
format: Option<String>Archive format the postinstall script downloads
(tgz, tar.gz, tar, zip, binary). Default tgz. Only consulted
in postinstall mode.
url_template: Option<String>Override the download URL emitted into the postinstall script
(templated). When unset, anodizer derives the URL from the
release context. Only consulted in postinstall mode.
extra_files: Option<Vec<String>>Additional files to include in the published package alongside the
generated metadata. Default ["README*", "LICENSE*"] (applied at the
Default pass).
templated_extra_files: Option<Vec<NpmTemplatedExtraFile>>Template-rendered file mappings (src may be a glob; rendered
contents written to dst).
extra: Option<HashMap<String, Value>>Free-form root-level package.json fields. Shallow-merged into
the generated package.json (config keys win over generated ones).
Useful for mcpName, funding, or other npm metadata fields
anodizer does not surface as first-class options.
registry: Option<String>Override the registry endpoint (default https://registry.npmjs.org).
token: Option<String>Auth token for the registry. Falls back to the NPM_TOKEN env var
when unset. Stored in .npmrc as //<registry>/:_authToken=...
at publish time and never passed via argv.
auth: NpmAuthModeCredential-selection strategy: auto (default) decides per package by
probing the registry for the package’s existence; token always uses
the token; oidc always uses Trusted Publishing with no token fallback.
See NpmAuthMode. Absent in existing configs resolves to auto.
skip: Option<StringOrBool>Skip this publisher. Accepts bool or template string.
Accepts the legacy disable: spelling via serde alias for back-compat.
required: Option<bool>Override whether this publisher failing should fail the overall release.
Default: true — NPM is a Manager-group publisher (one-way
72-hour unpublish window), so a failed publish aborts by default
to avoid surprising the operator with a half-released version.
Set to false to log failures but continue.
if_condition: Option<String>Template-conditional gate: when the rendered result is falsy
("false" / "0" / "no" / empty), the NPM publisher entry is
skipped. Render failure hard-errors.
retain_on_rollback: Option<bool>When true, a triggered rollback leaves this publisher’s work in
place rather than attempting to undo it. Default false.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for NpmConfig
impl<'de> Deserialize<'de> for NpmConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for NpmConfig
impl JsonSchema for NpmConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PublisherGateOverrides for NpmConfig
impl PublisherGateOverrides for NpmConfig
Source§fn required_override(&self) -> Option<bool>
fn required_override(&self) -> Option<bool>
required: override. None keeps the publisher’s
built-in default; Some(true) anywhere escalates the release gate.Source§fn retain_on_rollback_override(&self) -> Option<bool>
fn retain_on_rollback_override(&self) -> Option<bool>
retain_on_rollback: override. Some(true) anywhere
opts the publisher’s successful work out of rollback.