feat: 初始化画个标仓库 - AI驱动设计系统(BYOK模式) - 224源/371504图标+25海报源+130技能
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
/* 探测 24 坐标系图标库 sprite 可达性 */
|
||||
const https = require('https');
|
||||
function fetch(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const req = https.get(url, { timeout: 15000 }, (res) => {
|
||||
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
||||
res.resume();
|
||||
return resolve(fetch(res.headers.location.startsWith('/') ? 'https://unpkg.com' + res.headers.location : res.headers.location));
|
||||
}
|
||||
if (res.statusCode !== 200) { res.resume(); return reject(new Error(res.statusCode + ' ' + url)); }
|
||||
const chunks = [];
|
||||
res.on('data', c => chunks.push(c));
|
||||
res.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
|
||||
});
|
||||
req.on('error', reject);
|
||||
req.on('timeout', () => req.destroy(new Error('timeout')));
|
||||
});
|
||||
}
|
||||
(async () => {
|
||||
const urls = {
|
||||
remix: 'https://unpkg.com/remixicon@4.5.0/symbols/remixicon.symbol.svg',
|
||||
phosphor: 'https://unpkg.com/phosphor-icons/core/assets/Phosphor.svg',
|
||||
bootstrap: 'https://unpkg.com/bootstrap-icons@1.11.3/bootstrap-icons.svg',
|
||||
heroicons_solid: 'https://unpkg.com/heroicons@2.1.5/24/solid.svg'
|
||||
};
|
||||
for (const [k, u] of Object.entries(urls)) {
|
||||
try {
|
||||
const s = await fetch(u);
|
||||
const syms = (s.match(/<symbol/g) || []).length;
|
||||
const vb = (s.match(/viewBox="0 0 (\d+) (\d+)"/) || [])[0] || '';
|
||||
console.log(`${k}: OK ${(s.length / 1024).toFixed(0)}KB symbols=${syms} ${vb}`);
|
||||
} catch (e) {
|
||||
console.log(`${k}: FAIL ${e.message}`);
|
||||
}
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user