MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / createTypes

Function createTypes

utils/lang.js:398–416  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

396}
397
398function createTypes() {
399 const enPath = path.resolve(dir, "en-us.json");
400 const enData = JSON.parse(fs.readFileSync(enPath, "utf8"));
401 const keys = Object.keys(enData);
402
403 const typeDef = `// Auto-generated by 'pnpm lang createTypes'
404// Do not edit manually
405
406declare type LangStrings = {
407${keys.map((k) => ` ${JSON.stringify(k)}: string;`).join("\n")}
408};
409
410declare var strings: LangStrings;
411`;
412
413 const typePath = path.resolve(dir, "index.d.ts");
414 fs.writeFileSync(typePath, typeDef, "utf8");
415 console.log(`Generated types for ${keys.length} keys in src/lang/index.d.ts`);
416}

Callers 3

lang.jsFile · 0.85
addToAllFilesFunction · 0.85
bulkAddStringsFunction · 0.85

Calls 1

logMethod · 0.80

Tested by

no test coverage detected