MCPcopy
hub / github.com/tldraw/tldraw / writeAssetDeclarationDTSFile

Function writeAssetDeclarationDTSFile

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

Source from the content-addressed store, hash-verified

543}
544
545async function writeAssetDeclarationDTSFile() {
546 let dts = `
547 export type AssetUrl = string | { src: string }
548 export type AssetUrlOptions = { baseUrl?: string } | ((assetUrl: string) => string)
549 export type AssetUrls = {
550 `
551
552 for (const [type, assets] of Object.entries(collectedAssetUrls)) {
553 dts += `${type}: {\n`
554 for (const name of Object.keys(assets)) {
555 dts += `${JSON.stringify(name)}: string,\n`
556 }
557 dts += '},\n'
558 }
559
560 dts += `
561 }
562 `
563
564 const assetDeclarationFilePath = join(REPO_ROOT, 'packages', 'assets', 'types.d.ts')
565 await writeCodeFile(
566 'internal/scripts/refresh-assets.ts',
567 'typescript',
568 assetDeclarationFilePath,
569 dts
570 )
571}
572
573function getNewPublishDates(packageVersion: string) {
574 const currentVersion = new SemVer(version)

Callers 1

mainFunction · 0.85

Calls 3

writeCodeFileFunction · 0.90
entriesMethod · 0.65
keysMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…