Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PNPM: Handle projects with nested subprojects #9863

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all 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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
oheger-bosch marked this conversation as resolved.
Show resolved Hide resolved
"name": "pnpm-package-with-nested-project",
"version": "1.0.0",
"description": "PNPM project with a nested sub project.",
"repository": {
"type": "git",
"url": "https://github.com/oss-review-toolkit/ort.git"
},
"license": "Apache-2.0",
"author": "The Author <[email protected]> (https://www.the.author.example/index.html)",
"private": true,
"dependencies": {
"cheerio": "1.0.0-rc.1",
"long": "^3.2.0",
"web-animations-js": "github:web-animations/web-animations-js#2.3.2"
},
"devDependencies": {
"cson": "~4.1.0"
},
"optionalDependencies": {
"promise": "~7.3.1"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "pnpm-nested-sub-project",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "https://github.com/oss-review-toolkit/ort.git"
},
"license": "Apache-2.0",
"author": "The Author <[email protected]> (https://www.the.author.example/index.html)",
"description": "A sub project nested in another one",
"dependencies": {
"proxy-from-env": "~1.1.0"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.should

import org.ossreviewtoolkit.analyzer.analyze
import org.ossreviewtoolkit.analyzer.collateMultipleProjects
import org.ossreviewtoolkit.analyzer.create
import org.ossreviewtoolkit.analyzer.resolveSingleProject
import org.ossreviewtoolkit.model.toYaml
Expand Down Expand Up @@ -70,4 +71,14 @@ class PnpmFunTest : StringSpec({
patchActualResult(result.toYaml(), patchStartAndEndTime = true) should
matchExpectedResult(expectedResultFile, definitionFile)
}

"Resolve dependencies correctly for a nested project" {
val definitionFile = getAssetFile("projects/synthetic/pnpm/nested-project/package.json")
val nestedDefinitionFile = definitionFile.parentFile.resolve("sub/package.json")
val expectedResultFile = getAssetFile("projects/synthetic/pnpm/nested-project-expected-output.yml")

val result = create("PNPM").collateMultipleProjects(definitionFile, nestedDefinitionFile).withResolvedScopes()

result.toYaml() should matchExpectedResult(expectedResultFile, definitionFile)
}
})
Loading
Loading