mirror of
https://github.com/pesde-pkg/pesde.git
synced 2024-12-12 11:00:36 +00:00
fix: 🐛 link root dependencies to their dependents aswell
This commit is contained in:
parent
875379ecbe
commit
33aa9dbff9
1 changed files with 8 additions and 4 deletions
|
@ -129,6 +129,7 @@ pub(crate) fn link<P: AsRef<Path>, Q: AsRef<Path>>(
|
||||||
destination_dir: P,
|
destination_dir: P,
|
||||||
parent_dependency_packages_dir: Q,
|
parent_dependency_packages_dir: Q,
|
||||||
only_name: bool,
|
only_name: bool,
|
||||||
|
as_root: bool,
|
||||||
) -> Result<(), LinkingError> {
|
) -> Result<(), LinkingError> {
|
||||||
let (_, source_dir) = resolved_pkg.directory(project.path());
|
let (_, source_dir) = resolved_pkg.directory(project.path());
|
||||||
let file = Manifest::from_path(&source_dir)?;
|
let file = Manifest::from_path(&source_dir)?;
|
||||||
|
@ -152,10 +153,10 @@ pub(crate) fn link<P: AsRef<Path>, Q: AsRef<Path>>(
|
||||||
.get(&pkg_name)
|
.get(&pkg_name)
|
||||||
.and_then(|v| v.get(resolved_pkg.pkg_ref.version()))
|
.and_then(|v| v.get(resolved_pkg.pkg_ref.version()))
|
||||||
{
|
{
|
||||||
Some(specifier) => project.path().join(packages_folder(
|
Some(specifier) if as_root => project.path().join(packages_folder(
|
||||||
specifier.realm().copied().unwrap_or_default(),
|
specifier.realm().copied().unwrap_or_default(),
|
||||||
)),
|
)),
|
||||||
None => destination_dir.as_ref().to_path_buf(),
|
_ => destination_dir.as_ref().to_path_buf(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let destination_file = destination_dir.join(format!(
|
let destination_file = destination_dir.join(format!(
|
||||||
|
@ -282,6 +283,7 @@ impl Project {
|
||||||
&container_dir,
|
&container_dir,
|
||||||
&self.path().join(resolved_pkg.packages_folder()),
|
&self.path().join(resolved_pkg.packages_folder()),
|
||||||
!is_duplicate_in(dep_name.name(), &resolved_pkg_dep_names),
|
!is_duplicate_in(dep_name.name(), &resolved_pkg_dep_names),
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
LinkingDependenciesError(
|
LinkingDependenciesError(
|
||||||
|
@ -295,7 +297,8 @@ impl Project {
|
||||||
}
|
}
|
||||||
|
|
||||||
if root_deps.contains(&name) {
|
if root_deps.contains(&name) {
|
||||||
let linking_dir = &self.path().join(resolved_pkg.packages_folder());
|
let specifier = lockfile.root_specifier(resolved_pkg).unwrap();
|
||||||
|
let linking_dir = &self.path().join(packages_folder(specifier.realm().copied().unwrap_or_default()));
|
||||||
|
|
||||||
debug!(
|
debug!(
|
||||||
"linking root package {name}@{version} to directory {}",
|
"linking root package {name}@{version} to directory {}",
|
||||||
|
@ -307,8 +310,9 @@ impl Project {
|
||||||
resolved_pkg,
|
resolved_pkg,
|
||||||
lockfile,
|
lockfile,
|
||||||
linking_dir,
|
linking_dir,
|
||||||
linking_dir,
|
self.path().join(resolved_pkg.packages_folder()),
|
||||||
!is_duplicate_in(name.name(), &root_dep_names),
|
!is_duplicate_in(name.name(), &root_dep_names),
|
||||||
|
true,
|
||||||
)
|
)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
LinkingDependenciesError(
|
LinkingDependenciesError(
|
||||||
|
|
Loading…
Reference in a new issue