Skip to content

Commit 4b2c1ae

Browse files
authored
Feat/awesome (#195)
1 parent 1c114c8 commit 4b2c1ae

File tree

5 files changed

+74
-15
lines changed

5 files changed

+74
-15
lines changed

astro.config.mjs

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineConfig } from 'astro/config';
22
import react from "@astrojs/react";
33
import starlight from "@astrojs/starlight";
44
import starlightTypeDoc, { typeDocSidebarGroup } from 'starlight-typedoc';
5+
import fs from 'node:fs'
56

67
import sitemap from '@astrojs/sitemap';
78

@@ -47,20 +48,23 @@ export default defineConfig({
4748
'./src/layouts/colorvars.css',
4849
],
4950
plugins: [
50-
// Generate the documentation.
51-
starlightTypeDoc({
52-
entryPoints: ['./fabric.js/fabric.ts'],
53-
tsconfig: './fabric.js/typedoc.config.json',
54-
typeDoc: {
55-
plugin: ['typedoc-plugin-no-inherit'],
56-
readme: 'none',
57-
gitRemote: 'https://github.com/fabricjs/fabric.js/blob',
58-
entryFileName: 'index.md',
59-
includeVersion: true,
60-
sourceLinkExternal: true,
61-
sourceLinkTemplate: 'https://github.com/fabricjs/fabric.js/blob/{gitRevision}/{path}#L{line}',
62-
},
63-
}),
64-
],
51+
// Generate the documentation only if local sources exist.
52+
// This avoids dev crashes when `fabric.js` sources are not checked out.
53+
(fs.existsSync(new URL('./fabric.js/fabric.ts', import.meta.url)) &&
54+
fs.existsSync(new URL('./fabric.js/typedoc.config.json', import.meta.url))) &&
55+
starlightTypeDoc({
56+
entryPoints: ['./fabric.js/fabric.ts'],
57+
tsconfig: './fabric.js/typedoc.config.json',
58+
typeDoc: {
59+
plugin: ['typedoc-plugin-no-inherit'],
60+
readme: 'none',
61+
gitRemote: 'https://github.com/fabricjs/fabric.js/blob',
62+
entryFileName: 'index.md',
63+
includeVersion: true,
64+
sourceLinkExternal: true,
65+
sourceLinkTemplate: 'https://github.com/fabricjs/fabric.js/blob/{gitRevision}/{path}#L{line}',
66+
},
67+
}),
68+
].filter(Boolean),
6569
}), react(), sitemap()],
6670
});

src/components/Header/Header.astro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
Api specs
2626
</a>
2727
</li>
28+
<li>
29+
<a href="/resources">
30+
Resources
31+
</a>
32+
</li>
2833
<li>
2934
<a href="/team">
3035
Team
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
import './resources.css';
3+
const links = [
4+
{
5+
link: 'https://github.com/cs-open/react-fabric',
6+
description:
7+
' - A high-extensibility library with a composite style, built with React',
8+
name: '@cs-open/react-fabric',
9+
},
10+
];
11+
---
12+
13+
<section id="resources">
14+
<h2>Resources</h2>
15+
<ul>
16+
{
17+
links.map((link) => (
18+
<li>
19+
<a href={link.link} target="_blank" class="resource-label">
20+
{link.name}
21+
</a>{' '}
22+
&nbsp;<span class="resource-value">{link.description}</span>
23+
</li>
24+
))
25+
}
26+
</ul>
27+
</section>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#resources {
2+
display: flex;
3+
flex-direction: column;
4+
align-items: center;
5+
justify-items: center;
6+
7+
}
8+
#resources .resource-label{
9+
color: var(--primary-color)
10+
}

src/pages/resources.astro

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
import Layout from '../layouts/Layout.astro';
3+
import ResourcesList from '../components/Resources/Resources.astro';
4+
---
5+
6+
<Layout
7+
title="Fabric.js Javascript Resources"
8+
description="Using fabricjs related projects"
9+
>
10+
<main>
11+
<ResourcesList />
12+
</main>
13+
</Layout>

0 commit comments

Comments
 (0)