Skip to content

Commit b7092fa

Browse files
committed
expand support for the NPM ecosystem
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
1 parent a4cc836 commit b7092fa

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pkg/programkind/programkind.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,23 @@ func makeFileType(path string, ext string, mime string) *FileType {
207207
return &FileType{Ext: ext, MIME: mime}
208208
}
209209

210-
// the only JSON files we currently scan are NPM package metadata, which ends in *package.json
211-
if strings.HasSuffix(path, "package.json") {
210+
// typically, JSON and YAML files are data files only scanned via --all, but we want to support the NPM ecosystem
211+
if strings.HasSuffix(path, "package.json") || strings.HasSuffix(path, "package-lock.json") {
212212
return &FileType{
213213
Ext: ext,
214214
MIME: "application/json",
215215
}
216216
}
217217

218+
if strings.HasSuffix(path, "pnpm-lock.yaml") ||
219+
strings.HasSuffix(path, "pnpm-workspace.yaml") ||
220+
strings.HasSuffix(path, "yarn.lock") {
221+
return &FileType{
222+
Ext: ext,
223+
MIME: "application/x-yaml",
224+
}
225+
}
226+
218227
if supportedKind[ext] == "" {
219228
return nil
220229
}

0 commit comments

Comments
 (0)