-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.ps1
32 lines (23 loc) · 891 Bytes
/
deploy.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
param([Parameter(Mandatory)][string] $npmToken, [switch] $details)
$ErrorActionPreference = "Continue"
function Set-NpmToken() {
"//registry.npmjs.org/:_authToken=$npmToken" | Out-File "$(Get-Location)\.npmrc" -Encoding ASCII
}
function Get-Tarball() {
return (Get-ChildItem -Filter *.tgz | Select-Object -First 1).Name
}
function Run($command) {
Write-Host "> " -ForegroundColor Cyan -NoNewLine
Write-Host $command -ForegroundColor Yellow
# Capture stderr (2>) and stdout (&1) into the same stream
$output = (iex $command) 2>&1
if($details -and ![string]::IsNullOrWhiteSpace($output)) {
Write-Host $output
}
}
$repo = Split-Path -parent $PSCommandPath
foreach($package in "totem-timeline", "totem-timeline-react", "totem-timeline-signalr") {
cd "$repo\src\$package\dist"
Run "Set-NpmToken"
Run "npm publish $(Get-Tarball)"
}