MCPcopy Index your code
hub / github.com/fontsource/fontsource / buildCustom

Function buildCustom

packages/cli/src/custom/build.ts:19–63  ·  view source on GitHub ↗
(metadata: Metadata, opts?: CustomOptions)

Source from the content-addressed store, hash-verified

17}
18
19export const buildCustom = async (metadata: Metadata, opts?: CustomOptions) => {
20 // Create the directory for the font
21 const dir = opts?.dir ? path.join(opts.dir, metadata.id) : `./${metadata.id}`;
22 fs.ensureDirSync(dir);
23 fs.ensureDirSync(path.join(dir, '/files'));
24
25 // Generate CSS files
26 await packagerCustom(metadata, { dir });
27
28 // Write metadata.scss
29 try {
30 await fs.mkdir(path.join(dir, 'scss'));
31 } catch {
32 // Continue as it may exist
33 }
34 await fs.writeFile(
35 path.join(dir, 'scss/metadata.scss'),
36 sassMetadata(metadata, {}, false),
37 );
38
39 // Write mixins.scss
40 await fs.writeFile(path.join(dir, 'scss/mixins.scss'), sassMixins);
41
42 // Write README.md
43 await fs.writeFile(path.join(dir, 'README.md'), readme(metadata, false));
44
45 // Write metadata.json
46 await fs.writeFile(path.join(dir, 'metadata.json'), stringify(metadata));
47
48 // Write unicode.json
49 await fs.writeFile(path.join(dir, 'unicode.json'), stringify({}));
50
51 // Write CHANGELOG.md
52 await fs.writeFile(path.join(dir, 'CHANGELOG.md'), changelog);
53
54 // Write package.json
55 await packageJson(metadata, {
56 dir,
57 isVariable: false,
58 tmpDir: '',
59 force: false,
60 version: opts?.version,
61 publishHash: opts?.publishHash,
62 });
63};

Callers 2

rebuildFunction · 0.90
createFunction · 0.90

Calls 4

packagerCustomFunction · 0.90
sassMetadataFunction · 0.90
readmeFunction · 0.90
packageJsonFunction · 0.90

Tested by

no test coverage detected