Skip to main content

NpmConfig

Struct NpmConfig 

Source
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: NpmMode

Binary-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: bool

In 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.

§author: Option<String>

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: NpmAuthMode

Credential-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 Clone for NpmConfig

Source§

fn clone(&self) -> NpmConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NpmConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NpmConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for NpmConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for NpmConfig

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for NpmConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more