You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
932 B
22 lines
932 B
// 探查 axure v29 JSON 的 sitemap 与 pages 结构
|
|
import fs from 'node:fs';
|
|
const data = JSON.parse(fs.readFileSync('e:/code/crm-backend-matt/.scratch/lanhu-latest/axure-v29.json', 'utf8'));
|
|
|
|
// sitemap 树
|
|
function walk(nodes, depth, path) {
|
|
for (const n of (nodes || [])) {
|
|
const label = `${' '.repeat(depth)}${n.pageName || n.name || '?'} ${n.pageUrl || n.url || ''} ${n.type || n.nodeClass || ''}`;
|
|
console.log(label);
|
|
if (n.children || n.childKeys) walk(n.children || n.childKeys, depth + 1, path + '/' + (n.pageName || n.name));
|
|
}
|
|
}
|
|
const sm = data.sitemap || {};
|
|
console.log('sitemap keys:', Object.keys(sm).join(','));
|
|
walk(sm.rootNodes, 0, '');
|
|
|
|
// 每页结构
|
|
console.log('\n=== page entries ===');
|
|
for (const [k, v] of Object.entries(data.pages || {})) {
|
|
const keys = v && typeof v === 'object' ? Object.keys(v).slice(0, 20).join(',') : String(v).slice(0, 80);
|
|
console.log(`${k} :: ${keys}`);
|
|
}
|
|
|