mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix: align asset-manifest generator output with prettier config
The generator was using JSON.stringify which outputs double quotes, but our prettier config requires single quotes and trailing commas. This caused lint-staged to reformat the file during pre-commit, resulting in empty commit errors.
This commit is contained in:
@@ -18,14 +18,20 @@ const notFoundImages = readdirSync(notFoundDir)
|
||||
.filter((file) => /^not-found-.*\.(jpg|jpeg|gif|png)$/i.test(file))
|
||||
.map((file) => `assets/not-found/${file}`);
|
||||
|
||||
// Generate TypeScript file
|
||||
// Generate TypeScript file with proper formatting (matches prettier config)
|
||||
const formatArray = (arr) => {
|
||||
if (arr.length === 0) return '[]';
|
||||
if (arr.length === 1) return `['${arr[0]}']`;
|
||||
return '[\n ' + arr.map((item) => `'${item}',`).join('\n ') + '\n]';
|
||||
};
|
||||
|
||||
const output = `// Auto-generated file - do not edit manually
|
||||
// Run 'node scripts/generate-asset-manifest.js' to regenerate
|
||||
// This file is generated from public/assets/ directory
|
||||
|
||||
export const BANNERS = ${JSON.stringify(banners, null, 2)} as const;
|
||||
export const BANNERS = ${formatArray(banners)} as const;
|
||||
|
||||
export const NOT_FOUND_IMAGES = ${JSON.stringify(notFoundImages, null, 2)} as const;
|
||||
export const NOT_FOUND_IMAGES = ${formatArray(notFoundImages)} as const;
|
||||
`;
|
||||
|
||||
// Ensure directory exists
|
||||
|
||||
Reference in New Issue
Block a user