Skip to content

Commit

Permalink
fix: alias name issue (such as for handling @electron/remote) (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
beyondkmp authored Jun 13, 2024
1 parent d0aa23a commit 6a940e4
Show file tree
Hide file tree
Showing 9 changed files with 1,475 additions and 61 deletions.
5 changes: 5 additions & 0 deletions .changeset/green-owls-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-bin": patch
---

fix: alias name issue in node modules resolution dependency tree
2 changes: 1 addition & 1 deletion pkg/node-modules/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func nodeDepTree(t *testing.T, dir string) {
})
})
g.Expect(r).To(ConsistOf([]string{
"react", "js-tokens", "loose-envify",
"react", "remote", "js-tokens", "loose-envify",
}))
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/node-modules/nodeModuleCollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type Dependency struct {
conflictDependency map[string]*Dependency
dir string
isOptional int
alias string
}

type Collector struct {
Expand Down Expand Up @@ -237,6 +238,7 @@ func (t *Collector) resolveDependency(parentNodeModuleDir string, name string) (
}

(*dependencyNameToDependency)[name] = dependency
dependency.alias = name
dependency.dir = dependencyDir
return dependency, nil
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/node-modules/nodeModuleCollector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestReadDependencyTreeByNpm(t *testing.T) {
return lo.Keys(*it)
})
g.Expect(r).To(ConsistOf([]string{
"js-tokens", "react", "loose-envify",
"js-tokens", "react", "remote", "loose-envify",
}))
}

Expand All @@ -54,6 +54,6 @@ func TestReadDependencyTreeByPnpm(t *testing.T) {
return lo.Keys(*it)
})
g.Expect(r).To(ConsistOf([]string{
"js-tokens", "react", "loose-envify",
"js-tokens", "react", "remote", "loose-envify",
}))
}
Loading

0 comments on commit 6a940e4

Please sign in to comment.