Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
add: handle missing pulumi.name field in package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
thdxr committed Sep 3, 2024
1 parent 74a86ae commit 895512e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/npm/npm.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
type Package struct {
Name string `json:"name"`
Version string `json:"version"`
Pulumi struct {
Pulumi *struct {
Name string `json:"name"`
Version string `json:"version"`
}
Expand Down
11 changes: 9 additions & 2 deletions pkg/project/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,17 @@ func FindProvider(name string, version string) (*ProviderLockEntry, error) {
if err != nil {
continue
}
if pkg.Pulumi.Name == "" {
if pkg.Pulumi == nil {
continue
}
alias := strings.ReplaceAll(pkg.Pulumi.Name, "-", "")
alias := pkg.Pulumi.Name
if alias == "" {
alias = pkg.Name
alias = strings.ReplaceAll(alias, "/", "")
alias = strings.ReplaceAll(alias, "@", "")
alias = strings.ReplaceAll(alias, "pulumi", "")
}
alias = strings.ReplaceAll(alias, "-", "")
return &ProviderLockEntry{
Name: name,
Package: pkg.Name,
Expand Down

0 comments on commit 895512e

Please sign in to comment.