Skip to content

Commit f35e56d

Browse files
feat: add script to sync all icons regardless of name change
1 parent 20a7725 commit f35e56d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

packages/icons/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"clean": "rm -rf dist",
2828
"connect": "tsx scripts/figma-connect.ts",
2929
"sync": "tsx scripts/figma-sync.ts",
30+
"sync:full": "FORCE_SYNC=1 tsx scripts/figma-sync.ts",
3031
"test": "vitest run --coverage"
3132
},
3233
"dependencies": {

packages/icons/scripts/figma-sync.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* FIGMA_FILE_KEY (optional; default from code)
1111
* FIGMA_NODE_ID (optional; default from code)
1212
* DRY_RUN=1 (optional) Log actions without writing files
13+
* FORCE_SYNC=1 (optional) Bypass fast-path bail-out and re-download all SVGs
1314
*/
1415

1516
import fs from 'node:fs';
@@ -34,6 +35,7 @@ const FIGMA_ACCESS_TOKEN = process.env.FIGMA_ACCESS_TOKEN;
3435
const FIGMA_FILE_KEY = '98HKKXL2dTle29ikJ3tzk7';
3536
const FIGMA_NODE_ID = '1:1483';
3637
const DRY_RUN = process.env.DRY_RUN === '1';
38+
const FORCE_SYNC = process.env.FORCE_SYNC === '1';
3739

3840
if (!FIGMA_ACCESS_TOKEN || !FIGMA_FILE_KEY) {
3941
console.error('Missing FIGMA_ACCESS_TOKEN.');
@@ -381,6 +383,7 @@ async function main(): Promise<void> {
381383
// 3) Fast-path bail-out: if set of names hasn't changed and sprite exists, stop early
382384
const existingIcons = readExistingIcons();
383385
if (
386+
!FORCE_SYNC &&
384387
existingIcons.length > 0 &&
385388
sameSet(
386389
existingIcons,
@@ -391,6 +394,9 @@ async function main(): Promise<void> {
391394
log('exit', '🙅 No icon name changes detected. Skipping fetch/optimize/build.');
392395
return;
393396
}
397+
if (FORCE_SYNC) {
398+
log('force', '🔄 Full sync enabled — re-downloading all icons.');
399+
}
394400

395401
// 4) Diff output (kept from original for visibility) and set a change summary
396402
let changesetSummary = '';

0 commit comments

Comments
 (0)