Skip to content

Commit

Permalink
chore(node): Ensure that package.json is a file
Browse files Browse the repository at this point in the history
To be on the safe side, ensure that the thing named "package.json" is a
file (and not e.g. a directory).

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Jan 24, 2024
1 parent d895de6 commit c6793a6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/package-managers/node/src/main/kotlin/Npm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ open class Npm(
logger.info { "Searching for 'package.json' files in '$nodeModulesDir'..." }

val nodeModulesFiles = nodeModulesDir.walk().maxDepth(modulesSearchDepth).filter {
it.name == "package.json" && isValidNodeModulesDirectory(nodeModulesDir, nodeModulesDirForPackageJson(it))
it.isFile && it.name == "package.json" &&
isValidNodeModulesDirectory(nodeModulesDir, nodeModulesDirForPackageJson(it))
}

return runBlocking(Dispatchers.IO) {
Expand Down

0 comments on commit c6793a6

Please sign in to comment.