ProjectOS / bootstrap /bootstrap-projectos.ps1
AnthropicallyHuggingFaces's picture
Sync full ProjectOS monorepo from GitHub 7f633f5
a8f4b72 verified
Raw History Blame Contribute Delete
1.43 kB
$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'