@@ -37,8 +37,7 @@ function getFigmaCredentials() {
3737 const token = env . FIGMA_API_TOKEN
3838
3939 if ( ! file || ! token ) {
40- consola . error ( 'Please provide FIGMA_FILE_ID and FIGMA_API_TOKEN environment variables.' )
41- exit ( 1 )
40+ return null
4241 }
4342
4443 return { file, token }
@@ -61,7 +60,11 @@ function getDeterministicId(prefix: string, name: string): string {
6160}
6261
6362async function checkFigmaVariants ( ) {
64- const { file, token } = getFigmaCredentials ( )
63+ const credentials = getFigmaCredentials ( )
64+ if ( ! credentials )
65+ return
66+
67+ const { file, token } = credentials
6568
6669 const figma = await importFromFigma ( {
6770 file,
@@ -92,7 +95,11 @@ async function checkFigmaVariants() {
9295}
9396
9497async function getFigma ( frameName : string ) {
95- const { file, token } = getFigmaCredentials ( )
98+ const credentials = getFigmaCredentials ( )
99+ if ( ! credentials )
100+ return null
101+
102+ const { file, token } = credentials
96103
97104 try {
98105 const cacheDir = `.figma-cache/${ frameName } ` // Separate cache directory for each variant
@@ -349,6 +356,13 @@ function setIconInfo(iconSet: IconSet, packageInfo: any): void {
349356// ====== MAIN EXECUTION ======
350357
351358async function main ( ) {
359+ // Skip icon build if Figma credentials are not available
360+ const credentials = getFigmaCredentials ( )
361+ if ( ! credentials ) {
362+ consola . info ( 'Skipping Figma icon build: FIGMA_FILE_ID and FIGMA_API_TOKEN not found in environment' )
363+ return
364+ }
365+
352366 await checkFigmaVariants ( )
353367 consola . start ( 'Processing icon variants...' )
354368
@@ -361,6 +375,12 @@ async function main() {
361375 const figma = await getFigma ( variant )
362376 const variantName = sanitizeName ( variant )
363377
378+ // Skip if no credentials available
379+ if ( figma === null ) {
380+ consola . info ( `Skipping variant ${ variantName } : no Figma credentials` )
381+ continue
382+ }
383+
364384 if ( figma === 'not_modified' ) {
365385 // If using cached data, try to load from the cache directory
366386 const cacheDir = `.figma-cache/${ variantName } `
0 commit comments