Adds lib/debug.ts with debugProps(id, component, file) that returns data-debug-id and data-debug-label attrs in dev mode, empty object in production. Adds __tests__/lib/debug.test.ts covering both modes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
16 lines
352 B
TypeScript
16 lines
352 B
TypeScript
export type DebugProps = {
|
|
'data-debug-id': string
|
|
'data-debug-label': string
|
|
}
|
|
|
|
export function debugProps(
|
|
id: string,
|
|
component: string,
|
|
file: string
|
|
): DebugProps | Record<string, never> {
|
|
if (process.env.NODE_ENV === 'production') return {}
|
|
return {
|
|
'data-debug-id': id,
|
|
'data-debug-label': `${component} — ${file}`,
|
|
}
|
|
}
|