Skip to content

Commit 725303e

Browse files
committed
Update stats for DPL
1 parent 16780cf commit 725303e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

stats/code.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
let nodeCount = 0
2-
const nodeTypeCounts: Map<NodeType, number> = new Map
2+
const nodeTypeCounts = new Map<NodeType, number>()
3+
4+
async function initialize() {
5+
await figma.loadAllPagesAsync()
6+
}
37

48
function visit(node) {
59
nodeTypeCounts.set(node.type, 1 + (nodeTypeCounts.get(node.type) | 0))
610
nodeCount++
711
if (node.children) node.children.forEach(visit)
812
}
913

14+
initialize();
1015
visit(figma.root)
1116

1217
let text = `Node count: ${nodeCount}\n`
13-
let nodeTypes = Array.from(nodeTypeCounts.entries())
18+
const nodeTypes = Array.from(nodeTypeCounts.entries())
1419
nodeTypes.sort((a, b) => b[1] - a[1])
1520
text += `Node types:` + nodeTypes.map(([k,v]) => `\n ${k}: ${v}`).join('')
1621

stats/manifest.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"editorType": ["figma", "figjam"],
77
"networkAccess": {
88
"allowedDomains": ["none"]
9-
}
9+
},
10+
"documentAccess": "dynamic-page"
1011
}

0 commit comments

Comments
 (0)