-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsync-design-system.ps1
More file actions
48 lines (38 loc) · 2.22 KB
/
Copy pathsync-design-system.ps1
File metadata and controls
48 lines (38 loc) · 2.22 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
<#
sync-design-system.ps1 — refresh Wend's bundled copy of the shared design-system.
Wend vendors a COPY of the design-system into Wend.Api/wwwroot/design-system so the app is
self-contained: no build step, and it works on any clone without anyone re-running anything.
This script re-copies it from the source of truth whenever the design-system is updated.
Only the person who owns the source-of-truth design-system needs to run this (Malin) — everyone
else just gets the committed copy via `git pull`. After running, review the diff and commit.
Usage:
./sync-design-system.ps1
./sync-design-system.ps1 -Source 'D:\path\to\design-system'
#>
param(
# The design-system source-of-truth folder.
[string]$Source = 'C:\Users\Nugget\Documents\Development\GitHub\repos\workbench\libraries\design-system'
)
$ErrorActionPreference = 'Stop'
# Destination is resolved relative to THIS script, so it works from any working directory.
$dst = Join-Path $PSScriptRoot 'Wend.Api\wwwroot\design-system'
if (-not (Test-Path $Source)) {
Write-Error "Canonical design-system not found at '$Source'. Pass -Source <path> if it lives elsewhere."
}
# The parts Wend uses. (gallery/sandbox/docs are intentionally left out.)
# 'assets' carries the self-hosted fonts the 2.x type identity depends on —
# without it Sora/Figtree silently fall back to system fonts.
$parts = 'tokens','base','primitives','components','compositions','utilities','theme','assets'
# Mirror cleanly: wipe the old bundle first so files removed upstream don't linger as stale copies.
if (Test-Path $dst) { Remove-Item $dst -Recurse -Force }
New-Item -ItemType Directory -Force $dst | Out-Null
foreach ($part in $parts) {
$from = Join-Path $Source $part
if (-not (Test-Path $from)) { Write-Error "Missing design-system part: $from" }
Copy-Item $from (Join-Path $dst $part) -Recurse -Force
}
Copy-Item (Join-Path $Source 'VERSION') (Join-Path $dst 'VERSION') -Force
$version = (Get-Content (Join-Path $dst 'VERSION') -Raw).Trim()
$cssCount = (Get-ChildItem $dst -Recurse -Filter *.css | Measure-Object).Count
Write-Host "Design-system synced to v$version ($cssCount CSS files) -> Wend.Api/wwwroot/design-system"
Write-Host "Review with 'git status' / 'git diff', then commit."