-
Notifications
You must be signed in to change notification settings - Fork 10
/
Build.ps1
57 lines (44 loc) · 1.27 KB
/
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
[CmdLetBinding()]
Param (
[Parameter()]
[string]$BuildDir
)
[string]$scriptPath = $PSScriptRoot;
# set the location history
Push-Location;
# make sure the releases folder exists
if ($null -eq $BuildDir -or $BuildDir.Length -eq 0)
{
$BuildDir = Join-Path -Path $scriptPath -ChildPath 'build';
}
if (-not(Test-Path -Path $BuildDir))
{
New-Item -Path $BuildDir -ItemType Directory -Force | Out-Null;
}
# Get the packages to build in this repo
$packageFiles = Get-ChildItem -Path $scriptPath -Recurse -Filter 'package.json'
if ($packageFiles.Count -eq 0)
{
Write-Error -Message 'No Extensions found to package'
Exit
}
# set our working location to the build folder
Set-Location -Path $BuildDir;
# process each package found
foreach ($package in $packageFiles)
{
Write-Verbose -Message "Processing $($package.fullname)";
# try
# {
Set-Location -Path $package.DirectoryName;
vsce.cmd package;
Get-ChildItem -Path $package.DirectoryName -Filter '*.vsix' | Move-Item -Destination $BuildDir -Force;
# }
# catch
# {
# }
Write-Verbose -Message ('Finished processing package {0}' -f $packageJson.name);
}
# return to the previous user location
Pop-Location;
Write-Verbose -Message 'Extension Packaging Complete';