mirror of
https://github.com/pesde-pkg/pesde.git
synced 2025-05-04 10:33:47 +01:00
* feat: add dev flag * fix: do not download dev/prod dependencies at all * fix: only remove direct non-dev dependencies * refactor: formatting * fix: check sub dependencies * fix: remove arc Co-authored-by: dai <contact@daimond113.com> * chore: grammar fixes Co-authored-by: dai <contact@daimond113.com> * chore: remove eagerly implemented traits Co-authored-by: dai <contact@daimond113.com> * refactor: use method over partialeq * chore: use owned type for `DependencyType` Co-authored-by: dai <contact@daimond113.com> * refactor: simplify and improve logic * chore: formatting * fix: install mode works with force mode * chore: remove cow * chore: fits method takes owned self * chore: fix needless borrow * refactor: improve code structure * refactor: avoid manually recreating graph --------- Co-authored-by: dai <contact@daimond113.com>
48 lines
1.2 KiB
Rust
48 lines
1.2 KiB
Rust
use crate::cli::{
|
|
install::{install, InstallOptions},
|
|
run_on_workspace_members,
|
|
};
|
|
use clap::Args;
|
|
use pesde::{download_and_link::InstallDependenciesMode, Project};
|
|
use std::num::NonZeroUsize;
|
|
|
|
#[derive(Debug, Args, Copy, Clone)]
|
|
pub struct UpdateCommand {
|
|
/// Update the dependencies but don't install them
|
|
#[arg(long)]
|
|
no_install: bool,
|
|
|
|
/// The maximum number of concurrent network requests
|
|
#[arg(long, default_value = "16")]
|
|
network_concurrency: NonZeroUsize,
|
|
|
|
/// Whether to re-install all dependencies even if they are already installed
|
|
#[arg(long)]
|
|
force: bool,
|
|
}
|
|
|
|
impl UpdateCommand {
|
|
pub async fn run(self, project: Project, reqwest: reqwest::Client) -> anyhow::Result<()> {
|
|
let options = InstallOptions {
|
|
locked: false,
|
|
install_dependencies_mode: InstallDependenciesMode::All,
|
|
write: !self.no_install,
|
|
network_concurrency: self.network_concurrency,
|
|
use_lockfile: false,
|
|
force: self.force,
|
|
};
|
|
|
|
install(&options, &project, reqwest.clone(), true).await?;
|
|
|
|
run_on_workspace_members(&project, |project| {
|
|
let reqwest = reqwest.clone();
|
|
async move {
|
|
install(&options, &project, reqwest, false).await?;
|
|
Ok(())
|
|
}
|
|
})
|
|
.await?;
|
|
|
|
Ok(())
|
|
}
|
|
}
|