feat: 初始化画个标仓库 - AI驱动设计系统(BYOK模式) - 224源/371504图标+25海报源+130技能
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
'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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user