Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "Include mvn and gradle files in repo archives"
}
13 changes: 12 additions & 1 deletion packages/core/src/shared/filetypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,19 @@ export const codefileExtensions = new Set([
// Code file names without an extension
export const codefileNames = new Set(['Dockerfile', 'Dockerfile.build'])

// To match gradlew, .mvn/*, etc
export const wellKnownSubnames = new Set(['gradle', 'mvn'])

/** Returns true if `filename` is a code file. */
export function isCodeFile(filename: string): boolean {
const ext = path.extname(filename).toLowerCase()
return codefileExtensions.has(ext) || codefileNames.has(path.basename(filename))
if (codefileExtensions.has(ext) || codefileNames.has(path.basename(filename))) {
return true
}
for (const subname of wellKnownSubnames) {
if (filename.includes(subname)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a very loose check.

surely these changes deserve a test...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this implicitness was intentional, as I wouldn't want to chase down specific extensions/file names for them. but we could also just include the missing file names and extensions. updated to the latter and added some tests.

return true
}
}
return false
}
Loading