11import { execSync } from "node:child_process" ;
2- import {
3- cp ,
4- mkdtemp ,
5- readdir ,
6- readFile ,
7- realpath ,
8- rm ,
9- writeFile ,
10- } from "node:fs/promises" ;
2+ import { cp , mkdtemp , readdir , realpath , rm } from "node:fs/promises" ;
113import { tmpdir } from "node:os" ;
124import path , { join } from "node:path" ;
135import { fileURLToPath } from "node:url" ;
@@ -51,29 +43,6 @@ async function assertFixtureClean() {
5143 }
5244}
5345
54- /**
55- * Normalize CRLF to LF in .res and .resi files.
56- * This is needed on Windows where git checkout may convert line endings
57- * despite .gitattributes settings, causing the formatter to detect changes.
58- */
59- async function normalizeLineEndings ( dir ) {
60- const entries = await readdir ( dir , { withFileTypes : true } ) ;
61- for ( const entry of entries ) {
62- const fullPath = join ( dir , entry . name ) ;
63- if ( entry . isDirectory ( ) ) {
64- if ( entry . name !== "node_modules" && entry . name !== ".yarn" ) {
65- await normalizeLineEndings ( fullPath ) ;
66- }
67- } else if ( entry . name . endsWith ( ".res" ) || entry . name . endsWith ( ".resi" ) ) {
68- const content = await readFile ( fullPath , "utf8" ) ;
69- const normalized = content . replace ( / \r \n / g, "\n" ) ;
70- if ( normalized !== content ) {
71- await writeFile ( fullPath , normalized ) ;
72- }
73- }
74- }
75- }
76-
7746export async function createSandbox ( ) {
7847 // Ensure fixture is clean before copying
7948 await assertFixtureClean ( ) ;
@@ -85,12 +54,6 @@ export async function createSandbox() {
8554 // Copy the fixture directory to the sandbox
8655 await cp ( fixtureDir , realDir , { recursive : true } ) ;
8756
88- // On Windows, git checkout may use CRLF line endings despite .gitattributes.
89- // Normalize to LF so the formatter doesn't detect spurious changes.
90- if ( process . platform === "win32" ) {
91- await normalizeLineEndings ( realDir ) ;
92- }
93-
9457 // Run yarn install to create proper node_modules workspace symlinks.
9558 // rewatch resolves dependencies via node_modules/<pkgName> and checks if
9659 // the canonical path is inside the workspace root (no node_modules segment)
0 commit comments