File size: 1,431 Bytes
a8f4b72 | 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 | $ErrorActionPreference = 'Stop'
Write-Host ''
Write-Host 'ProjectOS Bootstrap' -ForegroundColor Cyan
Write-Host ''
$projectRoot = Split-Path -Parent $PSScriptRoot
Set-Location $projectRoot
function Require-Command {
param([Parameter(Mandatory = $true)][string]$Name)
if (-not (Get-Command $Name -ErrorAction SilentlyContinue)) {
throw "$Name is missing. Install it and run bootstrap again."
}
}
Require-Command git
Require-Command node
$nodeVersion = [version](node -p "process.versions.node")
if ($nodeVersion -lt [version]'22.5.0') {
throw "Node.js 22.5 or later is required. Found $nodeVersion."
}
if (-not (Get-Command pnpm -ErrorAction SilentlyContinue)) {
Require-Command npm
npm install --global pnpm@10
}
New-Item -ItemType Directory -Path (Join-Path $projectRoot 'configs') -Force | Out-Null
if (-not (Test-Path (Join-Path $projectRoot 'bootstrap.xml'))) {
Copy-Item -LiteralPath (Join-Path $projectRoot 'defaults\bootstrap.xml') -Destination (Join-Path $projectRoot 'bootstrap.xml')
Write-Host 'Created default bootstrap.xml'
}
pnpm install
if ($LASTEXITCODE -ne 0) {
throw 'pnpm install failed.'
}
pnpm generate
if ($LASTEXITCODE -ne 0) {
throw 'ProjectOS manifest validation or configuration generation failed.'
}
Write-Host ''
Write-Host 'Bootstrap Complete' -ForegroundColor Green
Write-Host 'Generated configuration is ready. Start ProjectOS with: pnpm dev'
|