验收20%

This commit is contained in:
2026-07-16 07:42:07 +08:00
parent 0dec90ffdd
commit cb25317412
108 changed files with 6477 additions and 1308 deletions
+45
View File
@@ -0,0 +1,45 @@
param(
[string]$ManifestPath = 'docs/design/assets/a01-vnext/source/a01-psd-manifest.json',
[string]$PsdPath = 'docs/design/assets/a01-vnext/source/A01-layered-source-v1.psd'
)
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$rootFullPath = [IO.Path]::GetFullPath($root).TrimEnd([IO.Path]::DirectorySeparatorChar) + [IO.Path]::DirectorySeparatorChar
function Resolve-WorkspaceFile {
param([string]$Path)
$candidate = if ([IO.Path]::IsPathRooted($Path)) { $Path } else { Join-Path $root $Path }
$fullPath = [IO.Path]::GetFullPath($candidate)
if (-not $fullPath.StartsWith($rootFullPath, [StringComparison]::OrdinalIgnoreCase)) {
throw "Path must remain inside the workspace: $Path"
}
if (-not (Test-Path -LiteralPath $fullPath -PathType Leaf)) {
throw "Required file does not exist: $fullPath"
}
return $fullPath
}
function ConvertTo-JavaScriptString {
param([string]$Value)
$escaped = $Value.Replace('\', '\\').Replace("'", "\'").Replace("`r", '\r').Replace("`n", '\n')
return "'$escaped'"
}
$resolvedManifest = Resolve-WorkspaceFile -Path $ManifestPath
$resolvedPsd = Resolve-WorkspaceFile -Path $PsdPath
$jsxPath = Resolve-WorkspaceFile -Path 'scripts/photoshop/a01-export-layered-assets.jsx'
if (-not (Get-Process -Name Photoshop -ErrorAction SilentlyContinue)) {
throw 'Adobe Photoshop must already be running.'
}
$app = New-Object -ComObject 'Photoshop.Application.150'
$bootstrap = @"
var JIAPU_A01_ROOT = $(ConvertTo-JavaScriptString $rootFullPath.TrimEnd([IO.Path]::DirectorySeparatorChar));
var JIAPU_A01_MANIFEST = $(ConvertTo-JavaScriptString $resolvedManifest);
var JIAPU_A01_PSD = $(ConvertTo-JavaScriptString $resolvedPsd);
$.evalFile(new File($(ConvertTo-JavaScriptString $jsxPath)));
"@
$app.DoJavaScript($bootstrap, @(), 1)
Write-Output 'A01-LAYERED-ASSETS EXPORT PASS'