Skip to content

Commit

Permalink
Prune deasync before pack
Browse files Browse the repository at this point in the history
  • Loading branch information
tothegills committed Jan 11, 2024
1 parent 0408c06 commit e3c7945
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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

Expand Down

0 comments on commit e3c7945

Please sign in to comment.