-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
67 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ dist | |
.pnpm-debug.log | ||
TODO | ||
.env*.local | ||
fonts/* | ||
!fonts/init.mjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// this script is run by the npm postinstall hook to copy the font | ||
// files from the node_modules directory to the public directory | ||
|
||
import fs from "fs"; | ||
import path from "path"; | ||
|
||
// Define the source paths | ||
const fontPaths = [ | ||
"node_modules/@fontsource/inter/files/inter-latin-300-normal.woff", | ||
"node_modules/@fontsource/inter/files/inter-latin-500-normal.woff", | ||
"node_modules/@fontsource/inter/files/inter-latin-600-normal.woff", | ||
"node_modules/@fontsource/roboto-mono/files/roboto-mono-latin-400-normal.woff", | ||
]; | ||
|
||
// Ensure the destination directory exists | ||
const ensureDirectoryExistence = filePath => { | ||
const dirname = path.dirname(filePath); | ||
if (fs.existsSync(dirname)) { | ||
return true; | ||
} | ||
ensureDirectoryExistence(dirname); | ||
fs.mkdirSync(dirname, { recursive: true }); | ||
}; | ||
|
||
// Copy each font file | ||
fontPaths.forEach(src => { | ||
const fileName = path.basename(src); | ||
const dest = path.join("fonts", fileName); | ||
ensureDirectoryExistence(dest); | ||
const exists = fs.existsSync(dest); | ||
if (!exists) { | ||
fs.copyFileSync(src, dest); | ||
console.log(`Copied ${src} to ${dest}`); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters