docs/.vitepress/configs/hooks/satoriConfig.ts

a122853b6661902be1a69a57e4761ce2196a7738
wotaku/docs/.vitepress/configs/hooks/satoriConfig.ts history · blame · raw

60 lines · 1770 bytes

 1/**
 2 *  Copyright (c) 2024 taskylizard
 3 *
 4 *  Licensed under the Apache License, Version 2.0 (the "License");
 5 *  you may not use this file except in compliance with the License.
 6 *  You may obtain a copy of the License at
 7 *
 8 *  http://www.apache.org/licenses/LICENSE-2.0
 9 *
10 *  Unless required by applicable law or agreed to in writing, software
11 *  distributed under the License is distributed on an "AS IS" BASIS,
12 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 *  See the License for the specific language governing permissions and
14 *  limitations under the License.
15 */
16import { readFile } from 'node:fs/promises'
17import { dirname, resolve } from 'node:path'
18import { fileURLToPath } from 'node:url'
19import { type SatoriOptions, defineSatoriConfig } from 'x-satori/vue'
20const __dirname = dirname(fileURLToPath(import.meta.url))
21const __fonts = resolve(__dirname, '../fonts')
22
23const fonts: SatoriOptions['fonts'] = [
24  {
25    name: 'Inter',
26    data: await readFile(resolve(__fonts, 'Inter-Regular.otf')),
27    weight: 400,
28    style: 'normal'
29  },
30  {
31    name: 'Inter',
32    data: await readFile(resolve(__fonts, 'Inter-Medium.otf')),
33    weight: 500,
34    style: 'normal'
35  },
36  {
37    name: 'Inter',
38    data: await readFile(resolve(__fonts, 'Inter-SemiBold.otf')),
39    weight: 600,
40    style: 'normal'
41  },
42  {
43    name: 'Inter',
44    data: await readFile(resolve(__fonts, 'Inter-Bold.otf')),
45    weight: 700,
46    style: 'normal'
47  }
48]
49
50export default defineSatoriConfig({
51  width: 1800,
52  height: 900,
53  fonts,
54  props: {
55    title: 'Very Long Title so that I Can See How Shit Looks',
56    description:
57      'Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint consectetur cupidatat.',
58    dir: '/j'
59  }
60})