- Ported Minimalist templates to JSON (Swiss Grid, Brutalist, etc.) - Ported Tech templates to JSON (SaaS, Terminal, Cyberpunk, etc.) - Ported Creative templates to JSON (Art Gallery, Zine, Pop Art, etc.) - Ported Industrial templates to JSON (Blueprint, Factory, Schematic, etc.) - Ported Nature templates to JSON (Botanical, Ocean, Mountain, etc.) - Ported Lifestyle templates to JSON (Cookbook, Travel, Coffee House, etc.) - Ported Vintage templates to JSON (Art Deco, Medieval, Retro 80s, etc.) - Updated README.md to reflect the new JSON-based style system (example configuration and contribution workflow) - Completed migration of over 150 styles to the new architecture
29 lines
911 B
JavaScript
29 lines
911 B
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const rootDir = 'd:\\gdfhbfgdbnbdfbdf\\typogenie\\src-tauri\\templates';
|
|
|
|
function walk(dir) {
|
|
const files = fs.readdirSync(dir, { withFileTypes: true });
|
|
files.forEach(dirent => {
|
|
const fullPath = path.join(dir, dirent.name);
|
|
if (dirent.isDirectory()) {
|
|
walk(fullPath);
|
|
} else if (dirent.name.endsWith('.json')) {
|
|
let content = fs.readFileSync(fullPath, 'utf8');
|
|
// Remove BOM
|
|
if (content.charCodeAt(0) === 0xFEFF) {
|
|
content = content.slice(1);
|
|
console.log(`Cleaned BOM: ${fullPath}`);
|
|
}
|
|
// Trim whitespace
|
|
content = content.trim();
|
|
fs.writeFileSync(fullPath, content, { encoding: 'utf8' });
|
|
}
|
|
});
|
|
}
|
|
|
|
walk(rootDir);
|
|
console.log('Finished cleaning BOMs and trimming JSON files.');
|
|
|