Skip to content

Commit

Permalink
delete the findParent
Browse files Browse the repository at this point in the history
  • Loading branch information
beyondkmp committed Sep 15, 2024
1 parent 82d3a96 commit c7f71b2
Show file tree
Hide file tree
Showing 5 changed files with 6,503 additions and 344 deletions.
20 changes: 1 addition & 19 deletions pkg/node-modules/nodeModuleCollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"sort"
"strings"

"github.com/develar/app-builder/pkg/fs"
"github.com/develar/app-builder/pkg/log"
"github.com/develar/errors"
jsoniter "github.com/json-iterator/go"
Expand Down Expand Up @@ -250,24 +249,7 @@ func (t *Collector) resolveDependency(parentNodeModuleDir string, name string) (
}
}

realParentNodeModuleDir := fs.FindParentWithFile(parentNodeModuleDir, name)
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)
dependencyDir := filepath.Join(parentNodeModuleDir, name)
info, err := os.Stat(dependencyDir)
if err == nil && !info.IsDir() {
return nil, nil
Expand Down
Loading

0 comments on commit c7f71b2

Please sign in to comment.