diff --git a/registry/src/auth/github.rs b/registry/src/auth/github.rs index d3e87cf..4ff5d46 100644 --- a/registry/src/auth/github.rs +++ b/registry/src/auth/github.rs @@ -72,7 +72,7 @@ impl AuthImpl for GitHubAuth { impl Display for GitHubAuth { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "GitHub") + write!(f, "GitHub (client id: {})", self.client_id) } } diff --git a/registry/src/endpoints/publish_version.rs b/registry/src/endpoints/publish_version.rs index 9ca0625..bb342b9 100644 --- a/registry/src/endpoints/publish_version.rs +++ b/registry/src/endpoints/publish_version.rs @@ -12,7 +12,7 @@ use async_compression::Level; use convert_case::{Case, Casing}; use fs_err::tokio as fs; use pesde::{ - manifest::Manifest, + manifest::{DependencyType, Manifest}, source::{ git_index::GitBasedSource, ids::VersionId, @@ -283,7 +283,12 @@ pub async fn publish_package( RegistryError::InvalidArchive(format!("manifest has invalid dependencies: {e}")) })?; - for (specifier, _) in dependencies.values() { + for (specifier, ty) in dependencies.values() { + // we need not verify dev dependencies, as they won't be installed + if *ty == DependencyType::Dev { + continue; + } + match specifier { DependencySpecifiers::Pesde(specifier) => { if specifier diff --git a/registry/src/storage/fs.rs b/registry/src/storage/fs.rs index 492ed52..7ed9d89 100644 --- a/registry/src/storage/fs.rs +++ b/registry/src/storage/fs.rs @@ -124,6 +124,6 @@ impl StorageImpl for FSStorage { impl Display for FSStorage { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "FS") + write!(f, "FS ({})", self.root.display()) } } diff --git a/registry/src/storage/mod.rs b/registry/src/storage/mod.rs index f6a13c6..ffb6756 100644 --- a/registry/src/storage/mod.rs +++ b/registry/src/storage/mod.rs @@ -19,31 +19,27 @@ pub trait StorageImpl: Display { package_name: &PackageName, version: &VersionId, contents: Vec, - ) -> Result<(), crate::error::RegistryError>; + ) -> Result<(), RegistryError>; async fn get_package( &self, package_name: &PackageName, version: &VersionId, - ) -> Result; + ) -> Result; async fn store_readme( &self, package_name: &PackageName, version: &VersionId, contents: Vec, - ) -> Result<(), crate::error::RegistryError>; + ) -> Result<(), RegistryError>; async fn get_readme( &self, package_name: &PackageName, version: &VersionId, - ) -> Result; + ) -> Result; - async fn store_doc( - &self, - doc_hash: String, - contents: Vec, - ) -> Result<(), crate::error::RegistryError>; - async fn get_doc(&self, doc_hash: &str) -> Result; + async fn store_doc(&self, doc_hash: String, contents: Vec) -> Result<(), RegistryError>; + async fn get_doc(&self, doc_hash: &str) -> Result; } impl StorageImpl for Storage { @@ -120,14 +116,14 @@ impl Display for Storage { pub fn get_storage_from_env() -> Storage { if let Ok(endpoint) = benv!(parse "S3_ENDPOINT") { Storage::S3(s3::S3Storage { - s3_bucket: Bucket::new( + bucket: Bucket::new( endpoint, UrlStyle::Path, benv!(required "S3_BUCKET_NAME"), benv!(required "S3_REGION"), ) .unwrap(), - s3_credentials: Credentials::new( + credentials: Credentials::new( benv!(required "S3_ACCESS_KEY"), benv!(required "S3_SECRET_KEY"), ), diff --git a/registry/src/storage/s3.rs b/registry/src/storage/s3.rs index 35dd91e..222b56c 100644 --- a/registry/src/storage/s3.rs +++ b/registry/src/storage/s3.rs @@ -13,8 +13,8 @@ use std::{fmt::Display, time::Duration}; #[derive(Debug)] pub struct S3Storage { - pub s3_bucket: Bucket, - pub s3_credentials: Credentials, + pub bucket: Bucket, + pub credentials: Credentials, pub reqwest_client: reqwest::Client, } @@ -28,8 +28,8 @@ impl StorageImpl for S3Storage { contents: Vec, ) -> Result<(), RegistryError> { let object_url = PutObject::new( - &self.s3_bucket, - Some(&self.s3_credentials), + &self.bucket, + Some(&self.credentials), &format!( "{package_name}/{}/{}/pkg.tar.gz", version.version(), @@ -57,8 +57,8 @@ impl StorageImpl for S3Storage { version: &VersionId, ) -> Result { let object_url = GetObject::new( - &self.s3_bucket, - Some(&self.s3_credentials), + &self.bucket, + Some(&self.credentials), &format!( "{package_name}/{}/{}/pkg.tar.gz", version.version(), @@ -79,8 +79,8 @@ impl StorageImpl for S3Storage { contents: Vec, ) -> Result<(), RegistryError> { let object_url = PutObject::new( - &self.s3_bucket, - Some(&self.s3_credentials), + &self.bucket, + Some(&self.credentials), &format!( "{package_name}/{}/{}/readme.gz", version.version(), @@ -108,8 +108,8 @@ impl StorageImpl for S3Storage { version: &VersionId, ) -> Result { let object_url = GetObject::new( - &self.s3_bucket, - Some(&self.s3_credentials), + &self.bucket, + Some(&self.credentials), &format!( "{package_name}/{}/{}/readme.gz", version.version(), @@ -125,8 +125,8 @@ impl StorageImpl for S3Storage { async fn store_doc(&self, doc_hash: String, contents: Vec) -> Result<(), RegistryError> { let object_url = PutObject::new( - &self.s3_bucket, - Some(&self.s3_credentials), + &self.bucket, + Some(&self.credentials), // capitalize Doc to prevent conflicts with scope names &format!("Doc/{}.gz", doc_hash), ) @@ -147,8 +147,8 @@ impl StorageImpl for S3Storage { async fn get_doc(&self, doc_hash: &str) -> Result { let object_url = GetObject::new( - &self.s3_bucket, - Some(&self.s3_credentials), + &self.bucket, + Some(&self.credentials), &format!("Doc/{}.gz", doc_hash), ) .sign(S3_SIGN_DURATION); @@ -161,6 +161,6 @@ impl StorageImpl for S3Storage { impl Display for S3Storage { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "S3") + write!(f, "S3 (bucket name: {})", self.bucket.name()) } }