Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: alias name issue #119

Merged
merged 4 commits into from
Jun 13, 2024
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
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
Loading