同步是跨端动作(源在 server、目标在 client),脚本放仓库根目录。 只提供服务端→前端一个方向;前端副本只读,手改会被覆盖。 CLAUDE.md 常用命令一节同步收录。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
19 lines
924 B
PowerShell
19 lines
924 B
PowerShell
# server/games/erqiwang/shared/ -> client/js/01_SubGame/codes/shared/ 单向同步
|
|
# 【只有这一个方向】权威源在服务端,前端副本只读;前端的本地改动会被本脚本覆盖。
|
|
$ErrorActionPreference = 'Stop'
|
|
$root = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$src = Join-Path $root 'server\games\erqiwang\shared'
|
|
$dst = Join-Path $root 'client\js\01_SubGame\codes\shared'
|
|
|
|
if (-not (Test-Path $src)) { Write-Error "源目录不存在: $src"; exit 1 }
|
|
if (-not (Test-Path $dst)) { New-Item -ItemType Directory -Path $dst -Force | Out-Null }
|
|
|
|
$files = Get-ChildItem -Path $src -Filter *.js -File
|
|
if ($files.Count -eq 0) { Write-Error "源目录没有 .js 文件: $src"; exit 1 }
|
|
|
|
foreach ($f in $files) {
|
|
Copy-Item -Path $f.FullName -Destination (Join-Path $dst $f.Name) -Force
|
|
Write-Host ("同步: " + $f.Name)
|
|
}
|
|
Write-Host ("完成,共 " + $files.Count + " 个文件 -> " + $dst)
|