Skip to content

Commit 06df2d4

Browse files
authored
Improving buildDescriptorExcludeList for npm (#4976)
Signed-off-by: Vijayan T <[email protected]>
1 parent c3eeb33 commit 06df2d4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pkg/whitesource/configHelper.go

+13
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,19 @@ func (c *ConfigOptions) addBuildToolDefaults(config *ScanOptions, utils Utils) e
266266
}
267267

268268
}
269+
if config.BuildTool == "npm" {
270+
if len(config.BuildDescriptorExcludeList) > 0 {
271+
var excludePaths []string
272+
for _, buildDescriptor := range config.BuildDescriptorExcludeList {
273+
if strings.HasSuffix(buildDescriptor, "pom.xml") {
274+
continue
275+
}
276+
modulePath, _ := filepath.Split(buildDescriptor)
277+
excludePaths = append(excludePaths, modulePath)
278+
}
279+
*c = append(*c, ConfigOption{Name: "npm.ignoreDirectoryPatterns", Value: strings.Join(excludePaths, ",")})
280+
}
281+
}
269282

270283
if config.BuildTool == "docker" {
271284
// for now only support default name of Dockerfile

0 commit comments

Comments
 (0)