mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-06 12:10:02 +00:00
Replace dep crates_io_api
with in-house solution (#846)
It also uses `max_stable_version` in the json downloaded from https://crates.io/api/v1/crates/$name if possible, which is equivalent to the version shown on https://crates.io/crates/$name . - Add new feat `json` to `binstalk-downloader` - Impl new async fn `Response::json` - use `Response::json` in `GhApiClient` impl - Mark all err types in binstalk-downloader as `non_exhaustive` - Ret `remote::Error` in `remote::Certificate::{from_pem, from_der}` instead of `ReqwestError`. - Refactor `BinstallError`: Merge variant `Unzip`, `Reqwest` & `Http` into one variant `Download`. - Manually download and parse json from httos://crates.io/api/v1 - Remove unused deps `crates_io_api` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
c00d648dac
commit
8eee318ccd
17 changed files with 120 additions and 244 deletions
|
@ -8,7 +8,6 @@ use std::{
|
|||
|
||||
use cargo_toml::Manifest;
|
||||
use compact_str::{CompactString, ToCompactString};
|
||||
use crates_io_api::AsyncClient as CratesIoApiClient;
|
||||
use itertools::Itertools;
|
||||
use maybe_owned::MaybeOwned;
|
||||
use semver::{Version, VersionReq};
|
||||
|
@ -72,8 +71,7 @@ async fn resolve_inner(
|
|||
crate_name.name,
|
||||
curr_version,
|
||||
&version_req,
|
||||
opts.client.clone(),
|
||||
&opts.crates_io_api_client).await?
|
||||
opts.client.clone()).await?
|
||||
else {
|
||||
return Ok(Resolution::AlreadyUpToDate)
|
||||
};
|
||||
|
@ -350,20 +348,11 @@ impl PackageInfo {
|
|||
curr_version: Option<Version>,
|
||||
version_req: &VersionReq,
|
||||
client: Client,
|
||||
crates_io_api_client: &CratesIoApiClient,
|
||||
) -> Result<Option<Self>, BinstallError> {
|
||||
// Fetch crate via crates.io, git, or use a local manifest path
|
||||
let manifest = match opts.manifest_path.as_ref() {
|
||||
Some(manifest_path) => load_manifest_path(manifest_path)?,
|
||||
None => {
|
||||
Box::pin(fetch_crate_cratesio(
|
||||
client,
|
||||
crates_io_api_client,
|
||||
&name,
|
||||
version_req,
|
||||
))
|
||||
.await?
|
||||
}
|
||||
None => Box::pin(fetch_crate_cratesio(client, &name, version_req)).await?,
|
||||
};
|
||||
|
||||
let Some(mut package) = manifest.package else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue