'use strict'; const fs = require('fs'); const path = require('path'); const vm = require('vm'); const ROOT = path.resolve(__dirname, '..'); global.window = global; function load(rel) { vm.runInThisContext(fs.readFileSync(path.join(ROOT, rel), 'utf8'), { filename: rel }); } load('js/core/dicebear.js'); const STYLES = ['bottts','bottts-neutral','identicon','pixel-art','fun-emoji','rings','shapes','avataaars','notionists','adventurer']; for (const s of STYLES) { load('js/data/sources/dicebear-' + s + '.js'); const key = 'HGB_Dicebear_' + s.replace(/-/g, '_'); const def = global[key]; console.log(s, '| def exists:', !!def, '| canvas:', def ? (def.canvas.width + 'x' + def.canvas.height) : '-', '| global key:', key); try { const r = HGB_Dicebear.renderAvatar(s, s + '-1'); console.log(' render ok, svg len:', r.svg.length, '| svg head:', r.svg.slice(0, 60).replace(/\n/g, ' ')); } catch (e) { console.log(' render ERROR:', e.message); } }