[CmdletBinding()] param( [string]$OutputRoot = (Join-Path (Split-Path -Parent $PSScriptRoot) 'third_party\json-family'), [switch]$Force ) $ErrorActionPreference = 'Stop' Set-StrictMode -Version Latest $sources = @( @{ Name = 'toon' Url = 'https://github.com/toon-format/toon.git' }, @{ Name = 'ison' Url = 'https://github.com/ISON-format/ison.git' }, @{ Name = 'zon' Url = 'https://github.com/ZON-Format/zon-TS.git' }, @{ Name = 'tonl' Url = 'https://github.com/tonl-dev/tonl.git' } ) New-Item -ItemType Directory -Force -Path $OutputRoot | Out-Null foreach ($source in $sources) { $target = Join-Path $OutputRoot $source.Name if (Test-Path -LiteralPath $target) { if ($Force) { Remove-Item -LiteralPath $target -Recurse -Force } else { git -C $target fetch --all --tags --prune git -C $target pull --ff-only if ($LASTEXITCODE -ne 0) { throw "Failed to update $($source.Name) specs in $target" } continue } } git clone --depth 1 $source.Url $target if ($LASTEXITCODE -ne 0) { throw "Failed to clone $($source.Name) specs from $($source.Url)" } } @{ generated_at = (Get-Date).ToUniversalTime().ToString('o') purpose = 'Spec, fixture, and golden-test source snapshots only; not runtime dependencies.' sources = $sources } | ConvertTo-Json -Depth 4 | Set-Content -LiteralPath (Join-Path $OutputRoot 'manifest.json') -Encoding utf8NoBOM