Skip to content

Commit

Permalink
fix(node): Strip a trailing "/" before creating globs
Browse files Browse the repository at this point in the history
Otherwise paths will not be matched correctly. This fixes a regression
from f99e2ed which did contain the `removeSuffix("/")` call, at least
for PNPM.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Jan 9, 2024
1 parent e1c0651 commit bd836a3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
packages:
- 'src/app/'
- 'src/packages/**'
- 'src/app/**'
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class NpmDetection(private val definitionFiles: Collection<File>) {
definitionFiles.associate { file ->
val projectDir = file.parentFile
val patterns = NodePackageManager.entries.mapNotNull { it.getWorkspaces(projectDir) }.flatten()
projectDir to patterns.map { FileSystems.getDefault().getPathMatcher("glob:$it") }
projectDir to patterns.map {
FileSystems.getDefault().getPathMatcher("glob:${it.removeSuffix("/")}")
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class NpmDetectionTest : WordSpec({
PNPM.getWorkspaces(projectDir) shouldNotBeNull {
mapNotNull {
it.withoutPrefix(projectDir.path)
}.shouldContainExactly("/src/packages/**", "/src/app/**")
}.shouldContainExactly("/src/app/", "/src/packages/**")
}
}

Expand Down

0 comments on commit bd836a3

Please sign in to comment.