Skip to content

Commit

Permalink
filter for directories only when generating figma file list
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoppermann committed Jun 26, 2023
1 parent 5231b07 commit ce79adb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/buildPlatforms/buildFigma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ export const buildFigma = (buildOptions: ConfigGeneratorOptions): void => {
/** -----------------------------------
* Create list of files
* ----------------------------------- */
const dirs = fs.readdirSync(`${buildOptions.buildPath}figma`)
const dirs = fs.readdirSync(`${buildOptions.buildPath}figma`, {withFileTypes: true}).filter(dir => dir.isDirectory())
const files = dirs.flatMap(dir => {
const localFiles = fs.readdirSync(`${buildOptions.buildPath}figma/${dir}`)
return localFiles.map(file => `${buildOptions.buildPath}figma/${dir}/${file}`)
})

fs.writeFileSync(`${buildOptions.buildPath}figma/files.json`, JSON.stringify(files, null, 2))
}

Expand Down

0 comments on commit ce79adb

Please sign in to comment.