MCPcopy Create free account
hub / github.com/broofa/mime / writeTypesFile

Function writeTypesFile

scripts/build.ts:103–118  ·  view source on GitHub ↗
(name: string, types: Record<string, string[]>)

Source from the content-addressed store, hash-verified

101}
102
103async function writeTypesFile(name: string, types: Record<string, string[]>) {
104 const dirpath = path.join(ROOT_DIR, '/types');
105 const filepath = path.join(dirpath, `${name}.ts`);
106 await mkdir(dirpath, { recursive: true });
107
108 // Generate source content
109 let source = TYPES_TEMPLATE.replace(TYPES_MARKER, JSON.stringify(types));
110
111 // Format
112 source = await prettier.format(source, {
113 parser: 'typescript',
114 ...PRETTIER_OPTIONS,
115 });
116
117 await writeFile(filepath, source);
118}
119
120async function main() {
121 const mimedb = await fetch(MIME_DB_URL).then((res) => {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected