-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathBuild-CopyAssets.ps1
52 lines (45 loc) · 1.51 KB
/
Build-CopyAssets.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
function AssertPath {
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=1)][string]$path
)
if( (Test-Path $path) -eq $false) {
Write-Error "Asset $path not found";
exit 1;
}
}
function CopyItemWithAssert {
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=1)][string]$sourceDir,
[Parameter(Position=1,Mandatory=0)][string]$targetDir,
[Parameter(Position=2,Mandatory=0)][string]$file
)
$path = $sourceDir + "\" + $file
$targetPath = $targetDir + "\" + $file
Write-Host "Copy Path:" $path
AssertPath $path
Copy-Item $path -Destination $targetDir
Write-Host "To Path:" $targetPath
AssertPath $targetPath
}
function CopyAssets {
$target = '.\src\ConfigServer.Server\Assets'
New-Item -ItemType Directory -Force -Path $target
$assetPath = Convert-Path $target
$sourcePath = Convert-Path '.\src\ConfigServer.Gui\ClientApp\dist'
Write-Host "Copying Assets from ConfigServer.Gui to ConfigServer.Server"
CopyItemWithAssert $sourcePath $assetPath 'runtime.js'
CopyItemWithAssert $sourcePath $assetPath 'polyfills.js'
CopyItemWithAssert $sourcePath $assetPath 'main.js'
CopyItemWithAssert $sourcePath $assetPath 'styles.css'
}
function AssertAssets {
Write-Host "Checking asset have been generated and copied"
AssertPath '.\src\ConfigServer.Server\Assets\runtime.js'
AssertPath '.\src\ConfigServer.Server\Assets\polyfills.js'
AssertPath '.\src\ConfigServer.Server\Assets\main.js'
AssertPath '.\src\ConfigServer.Server\Assets\styles.css'
}
CopyAssets
AssertAssets