Skip to content

Commit

Permalink
fix: hoist dependencies to the real parent (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabienr authored Jul 4, 2024
1 parent ea95e30 commit 94485c6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tasty-houses-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-bin": patch
---

fix: hoist dependencies to the real parent in nodeModuleCollector
13 changes: 13 additions & 0 deletions pkg/node-modules/nodeModuleCollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,19 @@ func (t *Collector) resolveDependency(parentNodeModuleDir string, name string) (
if realParentNodeModuleDir == "" {
return nil, nil
}

// XXX consumers expect the node_modules shape or the dependency tree ?
// hoist the depends to the actual parent
if realParentNodeModuleDir != parentNodeModuleDir {
dependencyNameToDependency = t.NodeModuleDirToDependencyMap[realParentNodeModuleDir]
if dependencyNameToDependency != nil {
dependency := (*dependencyNameToDependency)[name]
if dependency != nil {
return nil, nil
}
}
}

dependencyDir := filepath.Join(realParentNodeModuleDir, name)
dependency, err := readPackageJson(dependencyDir)
if err != nil {
Expand Down

0 comments on commit 94485c6

Please sign in to comment.