Skip to content

Commit

Permalink
feat(yarn2): Support parsing the project's authors
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Viernau <[email protected]>
  • Loading branch information
fviernau committed Nov 15, 2024
1 parent 609903b commit 9c12e33
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
project:
id: "Yarn2::yarn2-package-with-lockfile:1.0.0"
definition_file_path: "<REPLACE_DEFINITION_FILE_PATH>"
authors:
- "The Author"
declared_licenses:
- "Apache-2.0"
declared_licenses_processed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
project:
id: "Yarn2::yarn2-package-with-lockfile:1.0.0"
definition_file_path: "<REPLACE_DEFINITION_FILE_PATH>"
authors:
- "The Author"
declared_licenses:
- "Apache-2.0"
declared_licenses_processed:
Expand Down
6 changes: 5 additions & 1 deletion plugins/package-managers/node/src/main/kotlin/yarn2/Yarn2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,9 @@ class Yarn2(
val projectFile = definitionFile.resolveSibling(header.version).resolve(definitionFile.name)
val packageJson = parsePackageJson(projectFile)
val additionalData = processAdditionalPackageInfo(packageJson)
val authors = packageJson.authors
.flatMap { parseAuthorString(it.name) }
.mapNotNullTo(mutableSetOf()) { it.name }

val id = Identifier("Yarn2", namespace, name, version)
allProjects += id to Project(
Expand All @@ -413,7 +416,8 @@ class Yarn2(
declaredLicenses = declaredLicenses,
vcs = additionalData.vcsFromPackage,
vcsProcessed = processProjectVcs(definitionFile.parentFile, additionalData.vcsFromPackage, homepageUrl),
homepageUrl = homepageUrl
homepageUrl = homepageUrl,
authors = authors
)
id
} else {
Expand Down

0 comments on commit 9c12e33

Please sign in to comment.