diff options
author | Kristóf Marussy <kristof@marussy.com> | 2024-04-08 16:20:58 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2024-04-08 17:52:35 +0200 |
commit | f862867a07fb09085a28bf134eb42276fde26540 (patch) | |
tree | b84f08003f0c143e27c3e3a339ab53f2aa339984 /subprojects/docs/src | |
parent | fix(language): Sonar lint issue (diff) | |
download | refinery-f862867a07fb09085a28bf134eb42276fde26540.tar.gz refinery-f862867a07fb09085a28bf134eb42276fde26540.tar.zst refinery-f862867a07fb09085a28bf134eb42276fde26540.zip |
docs: add Docusaurus website
Also refactor Yarn buildscripts.
Diffstat (limited to 'subprojects/docs/src')
-rw-r--r-- | subprojects/docs/src/css/custom.css | 40 | ||||
-rw-r--r-- | subprojects/docs/src/pages/index.tsx | 19 | ||||
-rw-r--r-- | subprojects/docs/src/plugins/swcMinifyPlugin.ts | 41 |
3 files changed, 100 insertions, 0 deletions
diff --git a/subprojects/docs/src/css/custom.css b/subprojects/docs/src/css/custom.css new file mode 100644 index 00000000..115d7ac9 --- /dev/null +++ b/subprojects/docs/src/css/custom.css | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2024 The Refinery Authors | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | @import '@fontsource-variable/open-sans/wdth.css'; | ||
8 | @import '@fontsource-variable/open-sans/wdth-italic.css'; | ||
9 | @import '@fontsource-variable/jetbrains-mono/wght.css'; | ||
10 | @import '@fontsource-variable/jetbrains-mono/wght-italic.css'; | ||
11 | |||
12 | :root { | ||
13 | --ifm-font-family-base: 'Open Sans Variable', | ||
14 | 'Open Sans', | ||
15 | 'Roboto', | ||
16 | 'Helvetica', | ||
17 | 'Arial', | ||
18 | sans-serif; | ||
19 | --ifm-fony-family-monospace: 'JetBrains Mono Variable', | ||
20 | 'JetBrains Mono', | ||
21 | 'Cascadia Code', | ||
22 | 'Fira Code', | ||
23 | monospace; | ||
24 | --ifm-code-font-size: 95%; | ||
25 | --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); | ||
26 | } | ||
27 | |||
28 | [data-theme='dark'] { | ||
29 | --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); | ||
30 | } | ||
31 | |||
32 | code, | ||
33 | kbd { | ||
34 | font-feature-settings: 'liga', 'calt'; | ||
35 | } | ||
36 | |||
37 | .navbar__title { | ||
38 | font-weight: 500; | ||
39 | font-size: 1.25rem; | ||
40 | } | ||
diff --git a/subprojects/docs/src/pages/index.tsx b/subprojects/docs/src/pages/index.tsx new file mode 100644 index 00000000..256d12ac --- /dev/null +++ b/subprojects/docs/src/pages/index.tsx | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2024 The Refinery Authors | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | import Layout from '@theme/Layout'; | ||
8 | |||
9 | export default function Home() { | ||
10 | return ( | ||
11 | <Layout> | ||
12 | <div className="hero hero--dark"> | ||
13 | <div className="container"> | ||
14 | <h1 className="hero__title">Refinery</h1> | ||
15 | </div> | ||
16 | </div> | ||
17 | </Layout> | ||
18 | ); | ||
19 | } | ||
diff --git a/subprojects/docs/src/plugins/swcMinifyPlugin.ts b/subprojects/docs/src/plugins/swcMinifyPlugin.ts new file mode 100644 index 00000000..ecac654b --- /dev/null +++ b/subprojects/docs/src/plugins/swcMinifyPlugin.ts | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2024 The Refinery Authors | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | import type { Plugin } from '@docusaurus/types'; | ||
8 | import TerserPlugin from 'terser-webpack-plugin'; | ||
9 | |||
10 | /** | ||
11 | * A Docusarus plugin that replaces the built-in Javascript minifier with swc. | ||
12 | * | ||
13 | * See | ||
14 | * https://github.com/facebook/docusaurus/issues/4765#issuecomment-1679863984 | ||
15 | * but we use swc instead of esbuild. | ||
16 | * | ||
17 | * @returns The Docusarus plugin. | ||
18 | */ | ||
19 | export default function swcMinifyPlugin(): Plugin { | ||
20 | return { | ||
21 | name: 'refinery-swc-minify-plugin', | ||
22 | configureWebpack: (config) => ({ | ||
23 | mergeStrategy: { | ||
24 | 'optimization.minimizer': 'replace', | ||
25 | }, | ||
26 | optimization: { | ||
27 | minimizer: | ||
28 | config.optimization?.minimizer?.map((plugin) => { | ||
29 | // `instanceof` seems to be broken, because a different version of | ||
30 | // `TerserPlguin` is coming from Docusaurus than the one we import. | ||
31 | if (plugin?.constructor.name === TerserPlugin.name) { | ||
32 | return new TerserPlugin({ | ||
33 | minify: TerserPlugin.swcMinify, | ||
34 | }); | ||
35 | } | ||
36 | return plugin; | ||
37 | }) ?? [], | ||
38 | }, | ||
39 | }), | ||
40 | }; | ||
41 | } | ||