From 47888d9232d46e9140a47e43fc45697308dd5a97 Mon Sep 17 00:00:00 2001 From: T4ko0522 Date: Fri, 10 Apr 2026 04:13:35 +0900 Subject: [PATCH] fix(init): auto-fix git symlinks when core.symlinks is false --- justfile | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/justfile b/justfile index 67dd2e2203..5410c99096 100644 --- a/justfile +++ b/justfile @@ -16,12 +16,30 @@ _clean_dist: _clean_dist: Remove-Item -Path 'packages/*/dist' -Recurse -Force -ErrorAction SilentlyContinue -init: _clean_dist +init: _clean_dist _fix_symlinks cargo binstall watchexec-cli cargo-insta typos-cli cargo-shear dprint taplo-cli -y node packages/tools/src/index.ts sync-remote pnpm install pnpm -C docs install +[unix] +_fix_symlinks: + #!/usr/bin/env bash + if [ "$(git config --get core.symlinks)" != "true" ]; then \ + echo "Enabling core.symlinks and re-checking out symlinks..."; \ + git config core.symlinks true; \ + git ls-files -s | grep '^120000' | cut -f2 | while read -r f; do git checkout -- "$f"; done; \ + fi + +[windows] +_fix_symlinks: + $symlinks = git config --get core.symlinks; \ + if ($symlinks -ne 'true') { \ + Write-Host 'Enabling core.symlinks and re-checking out symlinks...'; \ + git config core.symlinks true; \ + git ls-files -s | Where-Object { $_ -match '^120000' } | ForEach-Object { ($_ -split "`t", 2)[1] } | ForEach-Object { git checkout -- $_ }; \ + } + build: pnpm install pnpm --filter @rolldown/pluginutils build