Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
232 changes: 117 additions & 115 deletions apps/website/docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import fs from 'node:fs';
import type { Config } from '@docusaurus/types';
import type typedocPluginFunction from 'docusaurus-plugin-typedoc-api';

import fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import { themes } from 'prism-react-renderer';
import packageJSON from './package.json';

type TypedocPluginOptions = Parameters<typeof typedocPluginFunction>[1];
import packageJSON from './package.json';

export interface CustomFields {
metaTitle?: string;
metaDescription?: string;
metaTitle?: string;
}

type TypedocPluginOptions = Parameters<typeof typedocPluginFunction>[1];

const fileExists = (path: fs.PathLike) => {
try {
fs.accessSync(path, fs.constants.F_OK);
Expand All @@ -35,12 +37,12 @@ const packageList = fs
const path = `packages/${entry}`;
const hasTesting = fileExists(`${projectRoot}/${path}/src/testing.ts`);
return {
path,
package: JSON.parse(fs.readFileSync(`${projectRoot}/packages/${entry}/package.json`, 'utf8')),
entry: {
index: { path: 'src/index.ts', label: undefined as unknown as string },
...(hasTesting ? { testing: { path: 'src/Testing.ts', label: 'Testing utilities' } } : undefined),
index: { label: undefined as unknown as string, path: 'src/index.ts' },
...(hasTesting ? { testing: { label: 'Testing utilities', path: 'src/Testing.ts' } } : undefined),
},
package: JSON.parse(fs.readFileSync(`${projectRoot}/packages/${entry}/package.json`, 'utf8')),
path,
};
})
.filter((_) => _.package.private !== true);
Expand All @@ -50,42 +52,23 @@ const config: Config = (() => {
const tagline = 'A collection of type safe, functional style packages for building great applications and libraries';
const organizationName = 'w5s';
return {
title,
tagline,
favicon: 'img/favicon.ico',

// Set the production url of your site here
// url: 'https://your-docusaurus-test-site.com',
url: `https://${organizationName}.github.io/`,

// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
// baseUrl: '/',
get baseUrl() {
return `/${this.projectName}`;
},
customFields: {
metaDescription: tagline,
metaTitle: 'Build faster, cleaner and safer apps',
} satisfies CustomFields,
favicon: 'img/favicon.ico',

// Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
future: {
v4: true, // Improve compatibility with the upcoming Docusaurus v4
},

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName, // Usually your GitHub org/user name.
projectName: 'std', // Usually your repo name.

onBrokenLinks: 'throw',
markdown: {
mdx1Compat: {
comments: true,
headingIds: true,
},
hooks: {
onBrokenMarkdownLinks: 'warn',
},
},

// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
Expand All @@ -94,26 +77,53 @@ const config: Config = (() => {
locales: ['en', 'fr'],
},

customFields: {
metaTitle: 'Build faster, cleaner and safer apps',
metaDescription: tagline,
} satisfies CustomFields,
markdown: {
hooks: {
onBrokenMarkdownLinks: 'warn',
},
mdx1Compat: {
comments: true,
headingIds: true,
},
},

onBrokenLinks: 'throw',
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName, // Usually your GitHub org/user name.

plugins: [
[
'@apify/docusaurus-plugin-typedoc-api',
{
gitRefName: 'main',
minimal: true,
packages: packageList.map(({ entry, path }) => ({
entry,
path,
})),
projectRoot,
readmes: true,
// debug: true,
tsconfigName: 'tsconfig.json',
} satisfies Partial<TypedocPluginOptions>,
],
],
presets: [
[
'classic',
{
docs: {
sidebarPath: fileURLToPath(new URL('sidebars.js', import.meta.url)),
blog: {
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: `${githubHref}/tree/main/apps/website/`,
},
blog: {
editUrl: `${githubHref}/tree/main/apps/website/blog/`,
showReadingTime: true,
},
docs: {
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: `${githubHref}/tree/main/apps/website/blog/`,
editUrl: `${githubHref}/tree/main/apps/website/`,
sidebarPath: fileURLToPath(new URL('sidebars.js', import.meta.url)),
},
theme: {
customCss: fileURLToPath(new URL('src/css/custom.css', import.meta.url)),
Expand All @@ -122,71 +132,28 @@ const config: Config = (() => {
],
],

projectName: 'std', // Usually your repo name.

tagline,

themeConfig: {
// Replace with your project's social card
image: 'img/w5s_social_cover.png',
metadata: [
{ name: 'keywords', content: 'functional, typescript, javascript, fp, rust, ocaml' },
{ name: 'revisit-after', content: '7 days' },
{ name: 'robots', content: 'archive,follow,imageindex,index,odp,snippet,translate' },
{ name: 'googlebot', content: 'index,follow' },
{ name: 'summary', content: tagline },
{ name: 'target', content: 'all' },
/* cspell:disable-next-line */
{ name: 'google-site-verification', content: 'crTDqUN2i_LENrHWPhxylaLVKPZ8EdHYemMbluuGhIA' },
],
navbar: {
title: 'Standard Library',
logo: {
alt: 'W5S standard library',
src: 'img/logo.svg',
},
items: [
{
label: `v${packageList[0].package.version[0]}`,
position: 'left',
items: packageList.map(({ package: _package }) => ({
label: `v${_package.version} Β· ${_package.name.split('/')[1]}`,
href: `https://www.npmjs.com/package/${_package.name}`,
})),
},
{
type: 'docSidebar',
sidebarId: 'tutorialSidebar',
position: 'left',
label: 'Docs',
},
{
to: 'api',
label: 'API',
position: 'left',
},
// { to: '/blog', label: 'Blog', position: 'left' },
{
href: githubHref,
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
copyright: `Copyright Β© ${new Date().getFullYear()} Julien Polo. Built with Docusaurus.`,
links: [
{
title: 'Docs',
items: [
{
label: 'Tutorial',
to: '/docs/getting-started/Introduction',
},
],
title: 'Docs',
},
{
title: 'Community',
items: [
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/w5s',
label: 'Stack Overflow',
},
// {
// label: 'Discord',
Expand All @@ -197,47 +164,82 @@ const config: Config = (() => {
// href: 'https://twitter.com/docusaurus',
// },
],
title: 'Community',
},
{
title: 'More',
items: [
{
label: 'Blog',
to: '/blog',
},
{
label: 'GitHub',
href: githubHref,
label: 'GitHub',
},
],
title: 'More',
},
],
copyright: `Copyright Β© ${new Date().getFullYear()} Julien Polo. Built with Docusaurus.`,
style: 'dark',
},
// Replace with your project's social card
image: 'img/w5s_social_cover.png',
metadata: [
{ content: 'functional, typescript, javascript, fp, rust, ocaml', name: 'keywords' },
{ content: '7 days', name: 'revisit-after' },
{ content: 'archive,follow,imageindex,index,odp,snippet,translate', name: 'robots' },
{ content: 'index,follow', name: 'googlebot' },
{ content: tagline, name: 'summary' },
{ content: 'all', name: 'target' },
/* cspell:disable-next-line */
{ content: 'crTDqUN2i_LENrHWPhxylaLVKPZ8EdHYemMbluuGhIA', name: 'google-site-verification' },
],
navbar: {
items: [
{
items: packageList.map(({ package: _package }) => ({
href: `https://www.npmjs.com/package/${_package.name}`,
label: `v${_package.version} Β· ${_package.name.split('/')[1]}`,
})),
label: `v${packageList[0].package.version[0]}`,
position: 'left',
},
{
label: 'Docs',
position: 'left',
sidebarId: 'tutorialSidebar',
type: 'docSidebar',
},
{
label: 'API',
position: 'left',
to: 'api',
},
// { to: '/blog', label: 'Blog', position: 'left' },
{
href: githubHref,
label: 'GitHub',
position: 'right',
},
],
logo: {
alt: 'W5S standard library',
src: 'img/logo.svg',
},
title: 'Standard Library',
},
prism: {
theme: lightTheme,
darkTheme,
additionalLanguages: ['bash', 'diff', 'json'],
darkTheme,
theme: lightTheme,
},
} satisfies Preset.ThemeConfig,

plugins: [
[
'@apify/docusaurus-plugin-typedoc-api',
{
projectRoot,
packages: packageList.map(({ path, entry }) => ({
path,
entry,
})),
minimal: true,
readmes: true,
// debug: true,
tsconfigName: 'tsconfig.json',
gitRefName: 'main',
} satisfies Partial<TypedocPluginOptions>,
],
],
title,

// Set the production url of your site here
// url: 'https://your-docusaurus-test-site.com',
url: `https://${organizationName}.github.io/`,
};
})();

Expand Down
8 changes: 4 additions & 4 deletions apps/website/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ export default [
...rootConfig,
{
rules: {
// End
'global-require': 'off',
'import/extensions': 'off',
'ts/no-require-imports': 'off',
/// FIXME: Start
'ts/no-unsafe-assignment': 'off',
'ts/no-var-requires': 'off',
'ts/no-unsafe-member-access': 'off',
// End
'global-require': 'off',
'ts/no-var-requires': 'off',
'unicorn/prefer-module': 'off',
'import/extensions': 'off',
},
},
];
2 changes: 1 addition & 1 deletion apps/website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{ type: 'autogenerated', dirName: '.' }],
tutorialSidebar: [{ dirName: '.', type: 'autogenerated' }],

// But you can create a sidebar manually
/*
Expand Down
7 changes: 4 additions & 3 deletions apps/website/src/components/Def/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import clsx from 'clsx';
import styles from './styles.module.css';
import React from 'react';

import { definitions } from './definitions';
import styles from './styles.module.css';

export interface DefProps extends Omit<React.HTMLProps<HTMLSpanElement>, 'children'> {
abbr: keyof typeof definitions;
Expand All @@ -15,5 +16,5 @@ export interface DefProps extends Omit<React.HTMLProps<HTMLSpanElement>, 'childr
* @param props
*/
export function Def(props: DefProps) {
return <dfn {...props} className={clsx(styles.def, props.className)}><abbr title={definitions[props.abbr]} children={props.abbr}></abbr></dfn>;
return <dfn {...props} className={clsx(styles.def, props.className)}><abbr children={props.abbr} title={definitions[props.abbr]}></abbr></dfn>;
}
Loading
Loading