feat: port all template categories to JSON format
- 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
This commit is contained in:
48
debug_template_load.cjs
Normal file
48
debug_template_load.cjs
Normal file
@@ -0,0 +1,48 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const templatesDirs = [
|
||||
'd:\\gdfhbfgdbnbdfbdf\\typogenie\\src-tauri\\target\\debug\\templates',
|
||||
'd:\\gdfhbfgdbnbdfbdf\\typogenie\\src-tauri\\target\\release\\templates'
|
||||
];
|
||||
|
||||
const ids = new Map(); // id -> filename
|
||||
|
||||
function scanDir(dir) {
|
||||
if (!fs.existsSync(dir)) {
|
||||
console.log(`Directory not found: ${dir}`);
|
||||
return;
|
||||
}
|
||||
console.log(`Scanning: ${dir}`);
|
||||
const files = fs.readdirSync(dir, { withFileTypes: true });
|
||||
|
||||
files.forEach(dirent => {
|
||||
const fullPath = path.join(dir, dirent.name);
|
||||
if (dirent.isDirectory()) {
|
||||
scanDir(fullPath);
|
||||
} else if (dirent.name.endsWith('.json')) {
|
||||
try {
|
||||
const content = fs.readFileSync(fullPath, 'utf8');
|
||||
const json = JSON.parse(content);
|
||||
// Handle array or object
|
||||
const template = Array.isArray(json) ? json[0] : json;
|
||||
|
||||
if (template.id) {
|
||||
if (ids.has(template.id)) {
|
||||
console.error(`[DUPLICATE ID] ${template.id} found in ${dirent.name} AND ${ids.get(template.id)}`);
|
||||
} else {
|
||||
ids.set(template.id, dirent.name);
|
||||
console.log(`[OK] ${dirent.name} (ID: ${template.id})`);
|
||||
}
|
||||
} else {
|
||||
console.error(`[MISSING ID] ${dirent.name}`);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(`[FAIL] ${dirent.name}: ${e.message}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Only scan one directory (debug) to check for uniqueness within the app load
|
||||
scanDir('d:\\gdfhbfgdbnbdfbdf\\typogenie\\src-tauri\\target\\debug\\templates');
|
||||
Reference in New Issue
Block a user