Skip to content

Instantly share code, notes, and snippets.

@stephaneerard
Created December 14, 2020 08:44
Show Gist options
  • Select an option

  • Save stephaneerard/4bf876d5241a3217ed3ad92f66525b46 to your computer and use it in GitHub Desktop.

Select an option

Save stephaneerard/4bf876d5241a3217ed3ad92f66525b46 to your computer and use it in GitHub Desktop.
$npm = @("config-lib", "config-api", "config-cli")
$processes = [System.Collections.ArrayList]@()
$location = get-location
try {
foreach ($package in $npm) {
set-location $psscriptroot\..\src\$package
$process = ./node_modules/.bin/tsc --watch &
$processes.Add($process) | out-null
}
}
finally {
foreach($process in $processes){
do { Start-Sleep -Seconds 1 } until ($process.HasExited);
$process | stop-job
}
set-location $location
}
@indented-automation

Copy link
Copy Markdown
$npm = @("config-lib", "config-api", "config-cli")

$processes = foreach ($package in $npm) {
    Start-Process -FilePath ./node_modules/.bin/tsc -ArgumentList '--watch' -WorkingDirectory "$psscriptroot\..\src\$package" -PassThru
}

foreach($process in $processes){
    do {
        Start-Sleep -Seconds 1
    } until ($process.HasExited)
    if (-not $process.HasExited) {
        $process | Stop-Process
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment