Repository navigation
Expand file tree
/
Copy pathbuild.ps1
More file actions
58 lines (47 loc) · 1.82 KB
/
Copy pathbuild.ps1
File metadata and controls
58 lines (47 loc) · 1.82 KB
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
$ErrorActionPreference = 'Stop'
$repoRoot = $PSScriptRoot
$webProject = Join-Path $repoRoot 'src\VirtoCommerce.SiteBuilder.Web'
$appsDir = Join-Path $webProject 'Apps'
$shellDir = Join-Path $appsDir 'site-builder-shell'
$contentDir = Join-Path $webProject 'Content'
# 1. Web project: npm install + webpack build
Write-Host '=== Web project: npm install ===' -ForegroundColor Cyan
Push-Location $webProject
try {
npm i
if ($LASTEXITCODE -ne 0) { throw 'npm install failed' }
Write-Host '=== Web project: webpack build ===' -ForegroundColor Cyan
npm run webpack:build
if ($LASTEXITCODE -ne 0) { throw 'webpack build failed' }
}
finally { Pop-Location }
# 2. Shell: yarn install + build
Write-Host '=== Shell: yarn install ===' -ForegroundColor Cyan
Push-Location $shellDir
try {
yarn
if ($LASTEXITCODE -ne 0) { throw 'shell yarn install failed' }
Write-Host '=== Shell: yarn build ===' -ForegroundColor Cyan
yarn build
if ($LASTEXITCODE -ne 0) { throw 'shell yarn build failed' }
}
finally { Pop-Location }
# 3. Create Content directory and symlinks
Write-Host '=== Creating Content symlinks ===' -ForegroundColor Cyan
if (-not (Test-Path $contentDir)) {
New-Item -ItemType Directory -Path $contentDir | Out-Null
}
$shellLink = Join-Path $contentDir 'site-builder-shell'
$shellDist = Join-Path $shellDir 'dist'
if (Test-Path $shellLink) { Remove-Item $shellLink -Force }
New-Item -ItemType SymbolicLink -Path $shellLink -Target $shellDist | Out-Null
Write-Host " $shellLink -> $shellDist"
# 4. Build .NET solution
Write-Host '=== Building solution ===' -ForegroundColor Cyan
Push-Location $repoRoot
try {
dotnet build VirtoCommerce.SiteBuilder.sln
if ($LASTEXITCODE -ne 0) { throw 'dotnet build failed' }
}
finally { Pop-Location }
Write-Host '=== Build completed successfully ===' -ForegroundColor Green