File tree Expand file tree Collapse file tree 3 files changed +26
-6
lines changed
Expand file tree Collapse file tree 3 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -24,12 +24,14 @@ function isTextSearchNode(node: SceneNode): node is TextSearchNode {
2424 return 'findAllWithCriteria' in node
2525}
2626
27- export async function exportDevup (
28- output : 'json' | 'excel' ,
27+ /**
28+ * Build the Devup config object from the current Figma file.
29+ * Extracts colors from Devup variable collection and typography from text styles.
30+ * When treeshaking is enabled, only typography used in the document is included.
31+ */
32+ export async function buildDevupConfig (
2933 treeshaking : boolean = true ,
30- ) {
31- perfReset ( )
32- const t = perfStart ( )
34+ ) : Promise < Devup > {
3335 const devup : Devup = { }
3436
3537 const tColors = perfStart ( )
@@ -236,6 +238,16 @@ export async function exportDevup(
236238 )
237239 }
238240
241+ return devup
242+ }
243+
244+ export async function exportDevup (
245+ output : 'json' | 'excel' ,
246+ treeshaking : boolean = true ,
247+ ) {
248+ perfReset ( )
249+ const t = perfStart ( )
250+ const devup = await buildDevupConfig ( treeshaking )
239251 perfEnd ( 'exportDevup()' , t )
240252 console . info ( perfReport ( ) )
241253
Original file line number Diff line number Diff line change 1- export { exportDevup } from './export-devup'
1+ export { buildDevupConfig , exportDevup } from './export-devup'
22export { importDevup } from './import-devup'
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import { wrapComponent } from '../codegen/utils/wrap-component'
1717import { getComponentName } from '../utils'
1818import { downloadFile } from '../utils/download-file'
1919import { toPascal } from '../utils/to-pascal'
20+ import { buildDevupConfig } from './devup'
2021
2122const NOTIFY_TIMEOUT = 3000
2223// Figma throttles >4 concurrent exportAsync calls for large PNGs (screenshots).
@@ -180,6 +181,9 @@ export async function exportPagesAndComponents() {
180181 // Deferred work collectors
181182 const screenshotTargets : ScreenshotTarget [ ] = [ ]
182183
184+ // Fire devup config build early — runs in parallel with codegen
185+ const devupConfigPromise = buildDevupConfig ( )
186+
183187 // Reset global asset registry so buildTree() populates it fresh
184188 resetGlobalAssetNodes ( )
185189
@@ -341,6 +345,10 @@ export async function exportPagesAndComponents() {
341345 return
342346 }
343347
348+ // Await devup config (started in parallel with codegen) and add to ZIP
349+ const devupConfig = await devupConfigPromise
350+ zip . file ( 'devup.json' , JSON . stringify ( devupConfig ) , ZIP_TEXT_FILE_OPTIONS )
351+
344352 // Asset nodes were already collected by Codegen's buildTree() into the
345353 // global registry — no need to re-walk the Figma node tree via IPC.
346354 const assetNodes = getGlobalAssetNodes ( )
You can’t perform that action at this time.
0 commit comments