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 6b812b2
Show file tree
Hide file tree
Showing 3 changed files with 7 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
4 changes: 3 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,7 @@ 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 }

Check warning

Code scanning / detekt

Line detected, which is longer than the defined maximum line length in the code style. Warning

Line detected, which is longer than the defined maximum line length in the code style.

val id = Identifier("Yarn2", namespace, name, version)
allProjects += id to Project(
Expand All @@ -413,7 +414,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 6b812b2

Please sign in to comment.