From e3c79458d12d668c4d629f16581d5de1f45aff94 Mon Sep 17 00:00:00 2001 From: Shane Date: Thu, 11 Jan 2024 13:36:52 +1000 Subject: [PATCH] Prune deasync before pack --- pack.ps1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pack.ps1 b/pack.ps1 index 08ac4bb1..d824e94e 100644 --- a/pack.ps1 +++ b/pack.ps1 @@ -54,6 +54,23 @@ function UpdateTaskManifests($workingDirectory, $version, $envName) { } } + +function IsUnsupportedNode($directory) { + $result = $directory | Select-String -Pattern 'node-(\d+)' + foreach ($r in $result) { + if ([int] $r.Matches.Groups[1].Value -gt 9) { + return $false + } + } + return $true +} + +function PruneDeasync($moduleDirectory) { + Get-ChildItem $moduleDirectory\deasync\bin -Filter "*-ia32-*" -Directory | Remove-Item -Recurse + + Get-ChildItem $moduleDirectory\deasync\bin -Directory | Where-Object {IsUnsupportedNode $_.FullName} | Remove-Item -Recurse +} + function SetupTaskDependencies($workingDirectory) { $tempPath = "$basePath/modules"; @@ -66,6 +83,7 @@ function SetupTaskDependencies($workingDirectory) { $command = "$goPath/bin/node-prune" Invoke-Expression "$command $tempPath/node_modules" + PruneDeasync "$tempPath/node_modules" $taskManifestFiles = Get-ChildItem $workingDirectory -Include "task.json" -Recurse