|
1 | | -import fs from "node:fs/promises"; |
2 | | -import path from "node:path"; |
| 1 | +// DANGER: This file is ignored because it requires the "webfont" package, which has |
| 2 | +// been compromised to some extent through https://www.aikido.dev/blog/npm-debug-and-chalk-packages-compromised. |
| 3 | +// Ideally, we will replace this with a safer alternative in the future, or restore when the package is fixed. |
3 | 4 |
|
4 | | -import { webfont } from "webfont"; |
| 5 | +// import fs from "node:fs/promises"; |
| 6 | +// import path from "node:path"; |
5 | 7 |
|
6 | | -const svgsDir = path.resolve(`${import.meta.dirname}/../resources/icons`); |
7 | | -const svgs = await fs |
8 | | - .readdir(svgsDir) |
9 | | - .then((files) => files.filter((file) => file.endsWith(".svg"))) |
10 | | - .then((files) => files.map((file) => `${svgsDir}/${file}`)); |
| 8 | +// import { webfont } from "webfont"; |
11 | 9 |
|
12 | | -const dest = `${import.meta.dirname}/../resources/fonts/localstack.woff`; |
| 10 | +// const svgsDir = path.resolve(`${import.meta.dirname}/../resources/icons`); |
| 11 | +// const svgs = await fs |
| 12 | +// .readdir(svgsDir) |
| 13 | +// .then((files) => files.filter((file) => file.endsWith(".svg"))) |
| 14 | +// .then((files) => files.map((file) => `${svgsDir}/${file}`)); |
13 | 15 |
|
14 | | -async function generateFont() { |
15 | | - try { |
16 | | - const result = await webfont({ |
17 | | - files: svgs, |
18 | | - formats: ["woff"], |
19 | | - startUnicode: 0xe000, |
20 | | - normalize: true, |
21 | | - sort: false, |
22 | | - }); |
23 | | - await fs.mkdir(path.dirname(dest), { recursive: true }); |
24 | | - await fs.writeFile(dest, result.woff, "binary"); |
25 | | - console.log(`Font created at ${path.relative(process.cwd(), dest)}`); |
26 | | - } catch (error) { |
27 | | - console.error("Font creation failed.", error); |
28 | | - } |
29 | | -} |
| 16 | +// const dest = `${import.meta.dirname}/../resources/fonts/localstack.woff`; |
30 | 17 |
|
31 | | -await generateFont(); |
| 18 | +// async function generateFont() { |
| 19 | +// try { |
| 20 | +// const result = await webfont({ |
| 21 | +// files: svgs, |
| 22 | +// formats: ["woff"], |
| 23 | +// startUnicode: 0xe000, |
| 24 | +// normalize: true, |
| 25 | +// sort: false, |
| 26 | +// }); |
| 27 | +// await fs.mkdir(path.dirname(dest), { recursive: true }); |
| 28 | +// await fs.writeFile(dest, result.woff, "binary"); |
| 29 | +// console.log(`Font created at ${path.relative(process.cwd(), dest)}`); |
| 30 | +// } catch (error) { |
| 31 | +// console.error("Font creation failed.", error); |
| 32 | +// } |
| 33 | +// } |
| 34 | + |
| 35 | +// await generateFont(); |
0 commit comments