Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ packages/testing/config

/.nx/cache
/.nx/workspace-data

# Ignore agent instruction symlinks that are checked out as placeholder files on Windows
/CLAUDE.md
/GEMINI.md
7 changes: 6 additions & 1 deletion tasks/git-hooks/pre-push.mts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ if (currentBranch === 'next' || currentBranch.startsWith('release/')) {
process.exit(0)
}

const buildResult = await execAsync('yarn', ['build'], { NX_TUI: 'false' })

if (buildResult !== 0) {
process.exit(buildResult)
}

const results = await Promise.allSettled([
execAsync('yarn', ['build'], { NX_TUI: 'false' }),
execAsync('yarn', ['lint']),
execAsync('yarn', ['prettier', '--check', '.']),
execAsync('yarn', ['check']),
Expand Down
8 changes: 7 additions & 1 deletion tasks/git-hooks/shared.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ export function execAsync(
extraEnv: Record<string, string> = {},
) {
return new Promise<number>((resolve, reject) => {
const child = spawn(command, args, {
const isWindowsYarn = process.platform === 'win32' && command === 'yarn'
const commandForPlatform = isWindowsYarn ? 'cmd.exe' : command
const argsForPlatform = isWindowsYarn
? ['/d', '/s', '/c', 'yarn.cmd', ...args]
: args

const child = spawn(commandForPlatform, argsForPlatform, {
stdio: 'inherit',
env: { ...process.env, ...extraEnv },
})
Expand Down
4 changes: 4 additions & 0 deletions tasks/smart-format.mts
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,9 @@ if (existingFiles.length > 0) {
}

function quoteAll(files: string[]): string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Windows Paths Split Apart

When a staged Windows file path contains a space, this joins it into the shell command without quoting. A path like web/src/My Component.tsx is split into separate arguments, so the pre-commit formatter can fail or format the wrong targets instead of formatting the staged file.

if (process.platform === 'win32') {
return files.join(' ')
}

return files.map((f) => `'${f.replaceAll("'", "'\\''")}'`).join(' ')
}
Loading