-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.ps1
59 lines (49 loc) · 963 Bytes
/
build.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
param(
# Determines if we run `npm pack`.
[Parameter()]
[switch]
$Pack,
# Determines if we run the tests.
[Parameter()]
[switch]
$Test,
# Runs the watch npm command instead.
[Parameter()]
[switch]
$Watch
)
if (!(Test-Path "$PSScriptRoot/PowerShellEditorServices")) {
& "$PSScriptRoot/downloadPSES.ps1"
}
if (!(Test-Path "$PSScriptRoot/Snippets")) {
& "$PSScriptRoot/downloadSnippets.ps1"
}
if (!(Get-Command npm)) {
throw "You must install Node.js & npm."
}
npm install
if (!$?) {
throw "npm failed to install"
}
if ($Watch.IsPresent) {
npm run watch
if (!$?) {
throw "npm failed to run"
}
return
} else {
npm run compile
if (!$?) {
throw "npm failed to compile"
}
}
if ($Test.IsPresent) {
# We would run the tests here.
}
if ($Pack.IsPresent) {
npm pack
if (!$?) {
throw "npm failed to pack"
}
}
Write-Host "Completed!"