MCPcopy Create free account
hub / github.com/fontsource/fontsource / writeAxisRegistry

Function writeAxisRegistry

registry/scripts/google.ts:621–647  ·  view source on GitHub ↗
(
	snapshot: GitSnapshot,
	root: string,
)

Source from the content-addressed store, hash-verified

619};
620
621const writeAxisRegistry = async (
622 snapshot: GitSnapshot,
623 root: string,
624): Promise<void> => {
625 const axisPaths = snapshot.paths.filter((path) =>
626 /^axisregistry\/Lib\/axisregistry\/data\/[^/]+\.textproto$/.test(path),
627 );
628 if (axisPaths.length === 0)
629 throw new Error('No Google axis registry files found');
630 const registry: Record<string, unknown> = {};
631 for (const path of axisPaths) {
632 const axis = parseProto<GoogleAxisProto>(
633 axisProto,
634 snapshot.read(path).toString('utf8'),
635 );
636 const tag = axis.tag ?? '';
637 registry[tag] = {
638 name: axis.display_name,
639 description: axis.description,
640 min: axis.min_value,
641 max: axis.max_value,
642 default: axis.default_value,
643 precision: axis.precision,
644 };
645 }
646 await writeJson(join(root, 'axes.json'), axisRegistrySchema.parse(registry));
647};
648
649const inspectFamilySources = async (
650 snapshot: GitSnapshot,

Callers 1

generateGoogleFunction · 0.85

Calls 3

parseProtoFunction · 0.90
writeJsonFunction · 0.90
toStringMethod · 0.65

Tested by

no test coverage detected