Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/config/bin_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cargo_metadata::{Metadata, Target};
use super::{project::ProjectDefinition, Profile, ProjectConfig};
use crate::{
config::Opts,
ext::{MetadataExt, PackageExt, PathBufExt, PathExt},
ext::{MetadataExt, PathBufExt, PathExt},
internal_prelude::*,
};
pub struct BinPackage {
Expand Down Expand Up @@ -48,7 +48,7 @@ impl BinPackage {
let packages = metadata.workspace_packages();
let package = packages
.iter()
.find(|p| *p.name == name && p.has_bin_target())
.find(|p| *p.name == name)
.ok_or_else(|| eyre!(r#"Could not find the project bin-package "{name}""#,))?;

let package = (*package).clone();
Expand Down
13 changes: 11 additions & 2 deletions src/config/lib_package.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::{
config::Opts,
ext::{MetadataExt, PathBufExt, PathExt},
ext::{MetadataExt, PackageExt, PathBufExt, PathExt},
internal_prelude::*,
logger::GRAY,
service::site::{SiteFile, SourcedSiteFile},
};
use camino::Utf8PathBuf;
Expand Down Expand Up @@ -45,6 +46,14 @@ impl LibPackage {
.find(|p| *p.name == name)
.ok_or_else(|| eyre!(r#"Could not find the project lib-package "{name}""#,))?;

let Some(target_lib) = package.cdylib_target() else {
return Err(eyre!(
r#"Could not find a cdylib library target for the leptos lib-package "{}" defined in {}"#,
package.name,
GRAY.paint(package.manifest_path.as_str()),
));
};

let mut features = if !cli.lib_features.is_empty() {
cli.lib_features.clone()
} else if !config.lib_features.is_empty() {
Expand All @@ -70,7 +79,7 @@ impl LibPackage {
.join("front")
.join("wasm32-unknown-unknown")
.join(profile.to_string())
.join(name.replace('-', "_"))
.join(target_lib.name.clone())
.with_extension("wasm");
let site = config
.site_pkg_dir
Expand Down
14 changes: 1 addition & 13 deletions src/config/project.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::{
config::{hash_file::HashFile, lib_package::LibPackage},
ext::{PackageExt, Paint, PathBufExt, PathExt},
ext::{PathBufExt, PathExt},
internal_prelude::*,
logger::GRAY,
service::site::Site,
};
use camino::{Utf8Path, Utf8PathBuf};
Expand Down Expand Up @@ -456,17 +455,6 @@ impl ProjectDefinition {
) -> Result<(Self, ProjectConfig)> {
let conf = ProjectConfig::parse(dir, metadata, cargo_metadata)?;

ensure!(
package.cdylib_target().is_some(),
"Cargo.toml has leptos metadata but is missing a cdylib library target. {}",
GRAY.paint(package.manifest_path.as_str())
);
ensure!(
package.has_bin_target(),
"Cargo.toml has leptos metadata but is missing a bin target. {}",
GRAY.paint(package.manifest_path.as_str())
);

Ok((
ProjectDefinition {
name: package.name.to_string(),
Expand Down
2 changes: 1 addition & 1 deletion src/ext/eyre.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub(crate) mod reexports {
//! re-exports

pub use super::{AnyhowCompatWrapErr as _, CustomWrapErr as _};
pub use color_eyre::eyre::{self, anyhow, bail, ensure, eyre, Report as Error, Result};
pub use color_eyre::eyre::{self, anyhow, bail, eyre, Report as Error, Result};
}
use reexports::*;

Expand Down