MCPcopy
hub / github.com/tldraw/tldraw / copyEmbedIcons

Function copyEmbedIcons

internal/scripts/refresh-assets.ts:227–256  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

225
226// 2. EMBED-ICONS
227async 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
259async function copyFonts() {

Callers 1

mainFunction · 0.85

Calls 4

writeFileFunction · 0.90
filterMethod · 0.80
endsWithMethod · 0.80
replaceMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…