Commit fe5789e
authored
fix(init): auto-fix git symlinks when
## Problem
This repository contains git symlinks in `packages/core/` that reference
files in the upstream `vite/`
directory:
- `packages/core/vite-rolldown.config.ts` →
`../../vite/packages/vite/rolldown.config.ts`
- `packages/core/rollupLicensePlugin.ts` →
`../../vite/packages/vite/rollupLicensePlugin.ts`
In a fresh Windows clone of this repository, `core.symlinks` can be
`false`. In that case, git checks
out these entries as plain text files containing the target path instead
of actual symlinks. This
causes the build to fail with `Unexpected token`, because the files are
imported as TypeScript modules
but only contain a path string.
## Solution
Add a `_fix_symlinks` recipe to `justfile` and run it as part of `just
init`. The recipe checks
`core.symlinks`, and when it is not `true`, it enables it and re-checks
out all tracked symlink
entries.
Both unix and Windows implementations are included.
The recipe is idempotent: when `core.symlinks=true`, it does nothing.
## Test plan
- Verified on Windows with a fresh `git clone` of this repository that
`core.symlinks=false` and the
symlinks are checked out incorrectly
- Ran `just _fix_symlinks` on Windows via PowerShell and confirmed the
symlinks were restored
- Ran the unix `_fix_symlinks` commands manually in Git Bash and
confirmed the symlinks were restored
- Confirmed idempotency: running the recipe again with
`core.symlinks=true` is a no-opcore.symlinks is false (#1353)1 parent 31e90b9 commit fe5789e
1 file changed
+19
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
25 | 43 | | |
26 | 44 | | |
27 | 45 | | |
| |||
0 commit comments