diff --git a/deplist_test.go b/deplist_test.go index cf5cfe6..2b8f8a0 100644 --- a/deplist_test.go +++ b/deplist_test.go @@ -74,7 +74,6 @@ func BuildWant() []Dependency { "d3-timer", "d3-scale-chromatic", "d3-time-format", - "d3-array", "d3-axis", "d3-timer", "d3-ease", @@ -93,7 +92,6 @@ func BuildWant() []Dependency { "d3-time", "js-tokens", "d3-format", - "safer-buffer", "d3-contour", "d3-geo", "safer-buffer", diff --git a/internal/scan/nodejs.go b/internal/scan/nodejs.go index 1f3941d..d148107 100644 --- a/internal/scan/nodejs.go +++ b/internal/scan/nodejs.go @@ -7,6 +7,7 @@ import ( "path/filepath" "strings" + "github.com/mcoops/deplist/internal/utils" log "github.com/sirupsen/logrus" ) @@ -45,9 +46,14 @@ var gatheredNode map[string]NodeJSGather func recordPackage(packageName, version string) { // opposite now, we don't care if its specifying version ranges like 5.x.x, // or 5.* etc. Just get the versions. - if len(version) > 0 && - (version[0] == '^' || version[0] == '~' || version[0] == '*' || version[len(version)-1] == 'x') { - return + if len(version) > 0 { + if !utils.CharIsDigit(version) { + return + } + + if version[len(version)-1] == 'x' { + return + } } if _, ok := gatheredNode[packageName+version]; !ok { diff --git a/internal/utils/utils.go b/internal/utils/utils.go index b049666..7232dab 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -15,3 +15,14 @@ func BelongsToIgnoreList(needle string) bool { } return false } + +func CharIsDigit(c string) bool { + if len(c) == 0 { + return false + } + + if c[0] < '0' || c[0] > '9' { + return false + } + return true +}