mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-22 09:13:18 +03:00
332cd3b380
This pr is trying to split `web` and `electron` entries from `core`. It allows more platform-related optimization to be addressed in each entry. We should remove all browser/electron only codes from `core` eventually, this is the very first step for that.
30 lines
776 B
JavaScript
30 lines
776 B
JavaScript
import { writeFile } from 'node:fs/promises';
|
|
import { join } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
import { CanvasTextFonts } from '@blocksuite/blocks/dist/surface-block/consts.js';
|
|
|
|
const fontPath = join(
|
|
fileURLToPath(import.meta.url),
|
|
'..',
|
|
'..',
|
|
'packages',
|
|
'frontend',
|
|
'web',
|
|
'dist',
|
|
'assets'
|
|
);
|
|
|
|
await Promise.all(
|
|
CanvasTextFonts.map(async ({ url }) => {
|
|
const buffer = await fetch(url).then(res =>
|
|
res.arrayBuffer().then(res => Buffer.from(res))
|
|
);
|
|
const filename = url.split('/').pop();
|
|
const distPath = join(fontPath, filename);
|
|
await writeFile(distPath, buffer);
|
|
console.info(`Downloaded ${distPath} successfully`);
|
|
})
|
|
);
|