Struct node_maintainer::NodeMaintainerOptions
source · pub struct NodeMaintainerOptions { /* private fields */ }Implementations§
source§impl NodeMaintainerOptions
impl NodeMaintainerOptions
sourcepub fn cache(self, cache: impl AsRef<Path>) -> Self
pub fn cache(self, cache: impl AsRef<Path>) -> Self
Configure the cache location that NodeMaintainer will use.
sourcepub fn concurrency(self, concurrency: usize) -> Self
pub fn concurrency(self, concurrency: usize) -> Self
Controls number of concurrent operations during various restore steps (resolution fetches, extractions, etc). Tuning this might help reduce memory usage.
sourcepub fn script_concurrency(self, concurrency: usize) -> Self
pub fn script_concurrency(self, concurrency: usize) -> Self
Controls number of concurrent script executions while running
run_script. This option is separate from concurrency because
executing concurrent scripts is a much heavier operation.
sourcepub fn kdl_lock(
self,
kdl_lock: impl IntoKdl
) -> Result<Self, NodeMaintainerError>
pub fn kdl_lock( self, kdl_lock: impl IntoKdl ) -> Result<Self, NodeMaintainerError>
Configure the KDL lockfile that NodeMaintainer will use.
If this option is not specified, NodeMaintainer will try to read the
lockfile from <root>/package-lock.kdl.
sourcepub fn npm_lock(
self,
npm_lock: impl AsRef<str>
) -> Result<Self, NodeMaintainerError>
pub fn npm_lock( self, npm_lock: impl AsRef<str> ) -> Result<Self, NodeMaintainerError>
Configure the NPM lockfile that NodeMaintainer will use.
If this option is not specified, NodeMaintainer will try to read the
lockfile from <root>/package-lock.json.
sourcepub fn registry(self, registry: Url) -> Self
pub fn registry(self, registry: Url) -> Self
Registry used for unscoped packages.
Defaults to https://registry.npmjs.org.
sourcepub fn scope_registry(self, scope: impl AsRef<str>, registry: Url) -> Self
pub fn scope_registry(self, scope: impl AsRef<str>, registry: Url) -> Self
Registry to use for a given @scope. That is, what registry to use
when looking up a package like @foo/pkg. This option can be provided
multiple times.
sourcepub fn default_tag(self, tag: impl AsRef<str>) -> Self
pub fn default_tag(self, tag: impl AsRef<str>) -> Self
Default dist-tag to use when resolving package versions.
sourcepub fn prefer_copy(self, prefer_copy: bool) -> Self
pub fn prefer_copy(self, prefer_copy: bool) -> Self
When extracting packages, prefer to copy files files instead of linking them.
This option has no effect if hard linking fails (for example, if the cache is on a different drive), or if the project is on a filesystem that supports Copy-on-Write (zfs, btrfs, APFS (macOS), etc).
sourcepub fn validate(self, validate: bool) -> Self
pub fn validate(self, validate: bool) -> Self
When this is true, node-maintainer will validate integrity hashes for
all files extracted from the cache, as well as verify that any files
in the existing node_modules are unmodified. If verification fails,
the packages will be reinstalled.
pub fn on_resolution_added<F>(self, f: F) -> Selfwhere F: Fn() + Send + Sync + 'static,
pub fn on_resolve_progress<F>(self, f: F) -> Selfwhere F: Fn(&Package) + Send + Sync + 'static,
pub fn on_prune_progress<F>(self, f: F) -> Selfwhere F: Fn(&Path) + Send + Sync + 'static,
pub fn on_extract_progress<F>(self, f: F) -> Selfwhere F: Fn(&Package) + Send + Sync + 'static,
pub fn on_script_start<F>(self, f: F) -> Selfwhere F: Fn(&Package, &str) + Send + Sync + 'static,
pub fn on_script_line<F>(self, f: F) -> Selfwhere F: Fn(&str) + Send + Sync + 'static,
sourcepub async fn resolve_manifest(
self,
root: CorgiManifest
) -> Result<NodeMaintainer, NodeMaintainerError>
pub async fn resolve_manifest( self, root: CorgiManifest ) -> Result<NodeMaintainer, NodeMaintainerError>
Resolves a NodeMaintainer using an existing CorgiManifest.
sourcepub async fn resolve_spec(
self,
root_spec: impl AsRef<str>
) -> Result<NodeMaintainer, NodeMaintainerError>
pub async fn resolve_spec( self, root_spec: impl AsRef<str> ) -> Result<NodeMaintainer, NodeMaintainerError>
Resolves a NodeMaintainer using a particular package spec (for
example, foo@1.2.3 or ./root) as its “root” package.
Trait Implementations§
source§impl Clone for NodeMaintainerOptions
impl Clone for NodeMaintainerOptions
source§fn clone(&self) -> NodeMaintainerOptions
fn clone(&self) -> NodeMaintainerOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more