diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-01-24 03:52:13 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-01-24 03:52:13 +0800 |
| commit | b32a021c2d5075303f5987e702c9df83e7c365e7 (patch) | |
| tree | 84b032fc5c1ef6785b2ee04e82fb58a3eb627782 | |
| parent | 058613e9d45dbf7bebca73fe678245632b2847fa (diff) | |
Move hide logic to separate script
| -rw-r--r-- | dev_deploy.ps1 | 8 | ||||
| -rw-r--r-- | scripts/hide_ignored_file.ps1 | 29 |
2 files changed, 29 insertions, 8 deletions
diff --git a/dev_deploy.ps1 b/dev_deploy.ps1 index 2eb4fa5..8e9bff0 100644 --- a/dev_deploy.ps1 +++ b/dev_deploy.ps1 @@ -5,14 +5,6 @@ $scriptPath = $MyInvocation.MyCommand.Path $scriptDir = Split-Path $scriptPath -Parent Set-Location $scriptDir -# Hide .cargo and .temp directories before build -if (Test-Path .cargo) { - attrib +h .cargo -} -if (Test-Path .temp) { - attrib +h .temp -} - # Build $env:FORCE_BUILD=$(Get-Date -Format 'mm') cargo build --workspace diff --git a/scripts/hide_ignored_file.ps1 b/scripts/hide_ignored_file.ps1 new file mode 100644 index 0000000..27355c2 --- /dev/null +++ b/scripts/hide_ignored_file.ps1 @@ -0,0 +1,29 @@ +# Hide all dotfiles and git-ignored files before build +# Set working directory to parent of script's directory +Set-Location -Path (Join-Path $PSScriptRoot "..") + +# First, unhide all files and directories in the current directory, but skip .temp and .git directories +Get-ChildItem -Path . -Force -Recurse -ErrorAction SilentlyContinue | Where-Object { + $_.FullName -notmatch '\\.temp\\' -and $_.FullName -notmatch '\\.git\\' +} | ForEach-Object { + attrib -h $_.FullName 2>&1 | Out-Null +} + +# Get all dotfiles and directories +Get-ChildItem -Path . -Force -Recurse -ErrorAction SilentlyContinue | Where-Object { + $_.Name -match '^\..*' -and $_.FullName -notmatch '\\\.\.$' -and $_.FullName -notmatch '\\\.$' +} | ForEach-Object { + attrib +h $_.FullName 2>&1 | Out-Null +} + +# Get git ignored files and hide them +if (Get-Command git -ErrorAction SilentlyContinue) { + git status --ignored --short | ForEach-Object { + if ($_ -match '^!!\s+(.+)$') { + $ignoredPath = $matches[1] + if (Test-Path $ignoredPath) { + attrib +h $ignoredPath 2>&1 | Out-Null + } + } + } +} |
