Skip to content

Commit f2f95f0

Browse files
committed
chore(node): Log about project-specific .npmrc files
As these can interfere with authentication, it is useful to know about them. Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent c53d534 commit f2f95f0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

plugins/package-managers/node/src/main/kotlin/NodePackageManager.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ import org.ossreviewtoolkit.model.config.AnalyzerConfiguration
3535
import org.ossreviewtoolkit.model.utils.DependencyGraphBuilder
3636
import org.ossreviewtoolkit.utils.common.realFile
3737

38+
const val NPM_RUNTIME_CONFIGURATION_FILENAME = ".npmrc"
39+
3840
abstract class NodePackageManager(val managerType: NodePackageManagerType) : PackageManager(managerType.projectType) {
3941
internal abstract val graphBuilder: DependencyGraphBuilder<*>
4042

@@ -74,6 +76,21 @@ abstract class NodePackageManager(val managerType: NodePackageManagerType) : Pac
7476
)
7577
}
7678

79+
override fun beforeResolution(
80+
analysisRoot: File,
81+
definitionFiles: List<File>,
82+
analyzerConfig: AnalyzerConfiguration
83+
) {
84+
super.beforeResolution(analysisRoot, definitionFiles, analyzerConfig)
85+
86+
definitionFiles.forEach {
87+
val npmrc = it.resolveSibling(NPM_RUNTIME_CONFIGURATION_FILENAME)
88+
if (npmrc.isFile) {
89+
logger.info { "There is a project-specific runtime configuration file at '${npmrc.absolutePath}'." }
90+
}
91+
}
92+
}
93+
7794
override fun mapDefinitionFiles(
7895
analysisRoot: File,
7996
definitionFiles: List<File>,

0 commit comments

Comments
 (0)