| 225 | |
| 226 | // 2. EMBED-ICONS |
| 227 | async function copyEmbedIcons() { |
| 228 | const folderName = 'embed-icons' |
| 229 | const extension = '.png' |
| 230 | |
| 231 | const sourceFolderPath = join(ASSETS_FOLDER_PATH, folderName) |
| 232 | const itemsToCopy = readdirSync(sourceFolderPath).filter((icon) => icon.endsWith(extension)) |
| 233 | |
| 234 | for (const publicFolderPath of PUBLIC_FOLDER_PATHS) { |
| 235 | const destinationFolderPath = join(publicFolderPath, folderName) |
| 236 | |
| 237 | // Delete the folder if it exists |
| 238 | if (existsSync(destinationFolderPath)) { |
| 239 | rmSync(destinationFolderPath, { recursive: true }) |
| 240 | } |
| 241 | |
| 242 | // Make the new folder |
| 243 | mkdirSync(destinationFolderPath, { recursive: true }) |
| 244 | |
| 245 | // Copy all items into the new folder |
| 246 | for (const item of itemsToCopy) { |
| 247 | await writeFile(join(destinationFolderPath, item), readFileSync(join(sourceFolderPath, item))) |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | // add to the asset declaration file |
| 252 | for (const item of itemsToCopy) { |
| 253 | const name = item.replace(extension, '') |
| 254 | collectedAssetUrls.embedIcons[name] = { file: `${folderName}/${item}` } |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | // 3. FONTS |
| 259 | async function copyFonts() { |