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

Function generateLicense

packages/cli/src/google/license.ts:11–39  ·  view source on GitHub ↗
(
	fontLicense: (typeof APILicense)[string],
	opts: BuildOptions,
)

Source from the content-addressed store, hash-verified

9
10// Download license from Google Fonts Github repo and save to package
11const generateLicense = async (
12 fontLicense: (typeof APILicense)[string],
13 opts: BuildOptions,
14) => {
15 const licensePath = path.join(opts.dir, 'LICENSE');
16 const copyright = fontLicense.original;
17
18 let txt: string | undefined;
19 switch (fontLicense.license.type.toLowerCase()) {
20 case 'apache license, version 2.0': {
21 txt = apache(copyright);
22 break;
23 }
24 case 'sil open font license, 1.1': {
25 txt = ofl(copyright);
26 break;
27 }
28 case 'ubuntu font license, 1.0': {
29 txt = ufl();
30 break;
31 }
32 default: {
33 throw new Error(`Unknown license type: ${fontLicense.license.type}`);
34 }
35 }
36
37 // Download file and write to package
38 await fs.writeFile(licensePath, txt);
39};
40
41export { generateLicense };

Callers 2

buildFunction · 0.90
license.test.tsFile · 0.90

Calls 3

apacheFunction · 0.90
oflFunction · 0.90
uflFunction · 0.90

Tested by

no test coverage detected