Skip to content

Commit a8da7d4

Browse files
committed
refactor(yarn): Use a more speaking name for output
Signed-off-by: Frank Viernau <[email protected]>
1 parent 6d6bc90 commit a8da7d4

File tree

1 file changed

+3
-4
lines changed
  • plugins/package-managers/node/src/main/kotlin

1 file changed

+3
-4
lines changed

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

+3-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import kotlin.time.Duration.Companion.days
2525

2626
import kotlinx.serialization.encodeToString
2727
import kotlinx.serialization.json.Json
28-
import kotlinx.serialization.json.JsonElement
2928
import kotlinx.serialization.json.JsonObject
3029
import kotlinx.serialization.json.JsonPrimitive
3130
import kotlinx.serialization.json.decodeToSequence
@@ -101,7 +100,7 @@ class Yarn(
101100
}
102101

103102
/**
104-
* Parse the given [output] of a Yarn _info_ command to a [PackageJson]. The output is typically a JSON object with the
103+
* Parse the given [stdout] of a Yarn _info_ command to a [PackageJson]. The output is typically a JSON object with the
105104
* metadata of the package that was queried. However, under certain circumstances, Yarn may return multiple JSON objects
106105
* separated by newlines; for instance, if the operation is retried due to network problems. This function filters for
107106
* the object with the data based on the _type_ field. Result is *null* if no matching object is found or the input is
@@ -110,9 +109,9 @@ class Yarn(
110109
* Note: The mentioned network issue can be reproduced by setting the network timeout to be very short via the command
111110
* line option '--network-timeout'.
112111
*/
113-
internal fun parseYarnInfo(output: String): PackageJson? =
112+
internal fun parseYarnInfo(stdout: String): PackageJson? =
114113
runCatching {
115-
output.byteInputStream().use { inputStream ->
114+
stdout.byteInputStream().use { inputStream ->
116115
Json.decodeToSequence<JsonObject>(inputStream)
117116
.firstOrNull { (it["type"] as? JsonPrimitive)?.content == "inspect" }?.let {
118117
it["data"]?.let(::parsePackageJson)

0 commit comments

Comments
 (0)