Nathan Voss a55b71d4ef
feat: exclude devDependencies from package-lock.json parsing (#3371)
Signed-off-by: Nathan Voss <njvoss299@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Co-authored-by: Keith Zantow <kzantow@gmail.com>
2024-10-30 12:02:27 -04:00

34 lines
999 B
Go

package javascript
const npmBaseURL = "https://registry.npmjs.org"
type CatalogerConfig struct {
SearchRemoteLicenses bool `json:"search-remote-licenses" yaml:"search-remote-licenses" mapstructure:"search-remote-licenses"`
NPMBaseURL string `json:"npm-base-url" yaml:"npm-base-url" mapstructure:"npm-base-url"`
IncludeDevDependencies bool `json:"include-dev-dependencies" yaml:"include-dev-dependencies" mapstructure:"include-dev-dependencies"`
}
func DefaultCatalogerConfig() CatalogerConfig {
return CatalogerConfig{
SearchRemoteLicenses: false,
NPMBaseURL: npmBaseURL,
}
}
func (j CatalogerConfig) WithSearchRemoteLicenses(input bool) CatalogerConfig {
j.SearchRemoteLicenses = input
return j
}
func (j CatalogerConfig) WithNpmBaseURL(input string) CatalogerConfig {
if input != "" {
j.NPMBaseURL = input
}
return j
}
func (j CatalogerConfig) WithIncludeDevDependencies(input bool) CatalogerConfig {
j.IncludeDevDependencies = input
return j
}