Skip to content
Source
Sign inSign up
TanStack/intent

fix: make Windows unit and integration test suites pass under test:pr #342

MergedLadyBluenotes(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/342/headmerged by LadyBluenotes(GitHub profile, opens in a new tab)

Showing 9 changed files with 19 additions and 4 deletions (loading 6).

x
0 of 9 viewed, 9 left
5 additions and 0 deletions.changeset/windows-tsgo-close-wait.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/intent': patch
+---
+​
+Spawn the TypeScript 7 `tsgo` compiler process from the parent directory in `withNativeCompiler` while keeping `--cwd` set to the project root, so Windows callers can remove or rename the checked directory immediately after `intent validate` or `intent repair` without hitting `EPERM`.
11 additions and 1 deletionpackages/intent/src/validate/blocks.tsModified
View file
@@ -214,13 +214,23 @@
return await run(async (sources, compilerOptions) => {
// A new configuration per call opens a new project that lists only
// this call's files, whatever the compiler process kept from earlier.
+ const first = projects === 0
const config = `${virtualDir}/tsconfig-${projects++}.json`
for (const [path, code] of sources) files.set(path, code)
files.set(
config,
JSON.stringify({ compilerOptions, files: [...sources.keys()] }),
- const snapshot = await api.updateSnapshot({ openProjects: [config] })
+ // Spawn tsgo from the parent directory so Windows does not lock root
+ // while the child process closes its stdio pipe after api.close().
+ const cwd = process.cwd()
+ if (first) process.chdir(dirname(root))
+ let snapshot: NativeApi.Snapshot