mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-09-29 20:17:05 -07:00
fix: avoid Array#toReversed() - unsupported on this project's target Node
This commit is contained in:
+13
-6
@@ -162,12 +162,19 @@ export async function downloadCli(version: string): Promise<string> {
|
|||||||
|
|
||||||
// install.sh writes progress to stderr and only the final binary path to
|
// install.sh writes progress to stderr and only the final binary path to
|
||||||
// stdout, but take the last non-empty line regardless - defensive against
|
// stdout, but take the last non-empty line regardless - defensive against
|
||||||
// any stray stdout noise from a future version of the script.
|
// any stray stdout noise from a future version of the script. Walked
|
||||||
const binaryPath = stdout
|
// backwards by index rather than toReversed()/reverse() - toReversed()
|
||||||
.split('\n')
|
// isn't available on this project's target Node version, and reverse()
|
||||||
.map((line) => line.trim())
|
// mutates in place, which unicorn/no-array-reverse flags even when the
|
||||||
.toReversed()
|
// array being mutated is a fresh one from map().
|
||||||
.find(Boolean);
|
const lines = stdout.split('\n').map((line) => line.trim());
|
||||||
|
let binaryPath: string | undefined;
|
||||||
|
for (let i = lines.length - 1; i >= 0; i -= 1) {
|
||||||
|
if (lines[i]) {
|
||||||
|
binaryPath = lines[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!binaryPath) {
|
if (!binaryPath) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|||||||
Reference in New Issue
Block a user