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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
# Nextra reads Git history to render each page's last-updated date.
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version-file: 'package.json'
Expand All @@ -25,9 +28,9 @@ jobs:
working-directory: docs/
run: npm ci

- name: Build Stories
- name: Build docs
working-directory: docs/
run: npm run export
run: npm run build

- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.0.0
Expand Down
33 changes: 33 additions & 0 deletions docs/app/[[...mdxPath]]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { generateStaticParamsFor, importPage } from 'nextra/pages';

import { useMDXComponents as getMDXComponents } from '../../mdx-components';

interface PageProps {
params: Promise<{ mdxPath: string[] }>;
}

export const generateStaticParams = generateStaticParamsFor('mdxPath');

export async function generateMetadata(props: PageProps) {
const params = await props.params;
const { metadata } = await importPage(params.mdxPath);
return metadata;
}

const Wrapper = getMDXComponents().wrapper;

export default async function Page(props: PageProps) {
const params = await props.params;
const {
default: MDXContent,
toc,
metadata,
sourceCode,
} = await importPage(params.mdxPath);

return (
<Wrapper metadata={metadata} sourceCode={sourceCode} toc={toc}>
<MDXContent {...props} params={params} />
</Wrapper>
);
}
19 changes: 19 additions & 0 deletions docs/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@import 'nextra-theme-docs/style.css';
@import 'tailwindcss';

@custom-variant dark (&:where(.dark *));

:root {
--card-bg-hover: rgb(27, 30, 37);
--card-border: #ffffff1a;
--x-color-black: #13131988;
}

.nextra-card {
border: 1px solid var(--card-border);
border-radius: 4px;
}

.nextra-card:hover {
background-color: var(--card-bg-hover);
}
82 changes: 82 additions & 0 deletions docs/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import type { Metadata } from 'next';

import { Inter } from 'next/font/google';
import { Layout, Navbar } from 'nextra-theme-docs';
import { Head } from 'nextra/components';
import { getPageMap } from 'nextra/page-map';

import './globals.css';

const title = 'FullstacksJS - Toolbox';
const description =
'A zero-dependency 📦 tree-shakable🌲 collection of missing JavaScript utilities.';
const ogImage = {
url: 'https://toolbox.fullstacksjs.com/thumbnail.png',
alt: title,
};

const repo = 'https://github.com/fullstacksjs/toolbox';
const proposalLink = `${repo}/issues/new?assignees=&labels=proposal&projects=&template=proposal.yml&title=%5BProposal%5D%3A+`;
const inter = Inter({
subsets: ['latin'],
weight: ['400', '700'],
variable: '--default-font-family',
});
export const metadata: Metadata = {
metadataBase: new URL('https://toolbox.fullstacksjs.com'),
title: { default: title, template: '%s - Toolbox' },
description,
manifest: '/site.webmanifest',
icons: {
icon: [
{ url: '/favicon.ico', sizes: 'any' },
{ url: '/favicon.svg', type: 'image/svg+xml' },
],
apple: '/apple-touch-icon.png',
},
openGraph: { title, description, images: ogImage },
twitter: {
card: 'summary_large_image',
title,
description,
images: ogImage,
},
};

const navbar = (
<Navbar
logo={
<div className="flex gap-2 items-center">
<img alt="Logo" className="h-8" src="/logo.svg" />
<span className="font-semibold translate-y-1">Toolbox</span>
</div>
}
projectLink={repo}
/>
);

export default async function RootLayout({
children,
}: {
children: React.ReactNode;
}): Promise<React.JSX.Element> {
return (
<html dir="ltr" lang="en" suppressHydrationWarning>
<Head backgroundColor={{ dark: 'rgb(35,37,46)' }} color={{ hue: 31 }} />
<body className={inter.variable}>
<Layout
editLink={null}
feedback={{ content: 'Suggest a new function', link: proposalLink }}
navbar={navbar}
nextThemes={{ defaultTheme: 'dark', forcedTheme: 'dark' }}
pageMap={await getPageMap()}
sidebar={{ defaultMenuCollapseLevel: 1 }}
darkMode={false}
docsRepositoryBase={`${repo}/blob/main/docs`}
>
{children}
</Layout>
</body>
</html>
);
}
8 changes: 3 additions & 5 deletions docs/components/TOC.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Card, Cards } from 'nextra-theme-docs';
import { Cards } from 'nextra/components';

interface Props {
base: string;
Expand All @@ -9,7 +9,7 @@ export const TOC = ({ base, meta }: Props): React.JSX.Element => {
return (
<Cards>
{Object.entries(meta).map(([key, value]) => (
<Card
<Cards.Card
href={`${base}/${key}`}
key={key}
title={value}
Expand All @@ -29,9 +29,7 @@ export const TOC = ({ base, meta }: Props): React.JSX.Element => {
/>
</svg>
}
>
{' '}
</Card>
/>
))}
</Cards>
);
Expand Down
6 changes: 6 additions & 0 deletions docs/content/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { MetaRecord } from 'nextra';

export default {
'index': 'Introduction',
'getting-started': 'Getting Started',
} satisfies MetaRecord;
16 changes: 16 additions & 0 deletions docs/content/array/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { MetaRecord } from 'nextra';

export default {
'compact': 'compact',
'copy': 'copy',
'ensure-array': 'ensureArray',
'get-random': 'getRandom',
'is-empty': 'isEmpty',
'is-last-index': 'isLastIndex',
'is-null-or-empty-array': 'isNullOrEmptyArray',
'join-path': 'joinPath',
'range': 'range',
'shuffle': 'shuffle',
'to-array': 'toArray',
'uniq': 'uniq',
} satisfies MetaRecord;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions docs/content/array/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
asIndexPage: true
---

# Array

import meta from './_meta';
import { TOC } from '@/components/TOC';

<TOC base="/array" meta={meta} />
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions docs/content/boolean/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { MetaRecord } from 'nextra';

export default {
'random-bool': 'randomBool',
} satisfies MetaRecord;
10 changes: 10 additions & 0 deletions docs/content/boolean/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
asIndexPage: true
---

# Boolean

import meta from './_meta';
import { TOC } from '@/components/TOC';

<TOC base="/boolean" meta={meta} />
7 changes: 7 additions & 0 deletions docs/content/error/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { MetaRecord } from 'nextra';

export default {
'assert': 'assert',
'assert-not-null': 'assertNotNull',
'throw-err': 'throwErr',
} satisfies MetaRecord;
File renamed without changes.
10 changes: 10 additions & 0 deletions docs/content/error/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
asIndexPage: true
---

# Error

import meta from './_meta';
import { TOC } from '@/components/TOC';

<TOC base="/error" meta={meta} />
File renamed without changes.
14 changes: 14 additions & 0 deletions docs/content/function/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { MetaRecord } from 'nextra';

export default {
'call-all': 'callAll',
'compose': 'compose',
'debounce': 'debounce',
'noop': 'noop',
'not': 'not',
'pipe': 'pipe',
'sleep': 'sleep',
'throttle': 'throttle',
'try-or': 'tryOr',
'format-seconds': 'format-seconds',
} satisfies MetaRecord;
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions docs/content/function/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
asIndexPage: true
---

# Function

import meta from './_meta';
import { TOC } from '@/components/TOC';

<TOC base="/function" meta={meta} />
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions docs/content/guard/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { MetaRecord } from 'nextra';

export default {
'is-boolean': 'isBoolean',
'is-empty-object': 'isEmptyObject',
'is-function': 'isFunction',
'is-iterable': 'isIterable',
'is-map': 'isMap',
'is-not-null': 'isNotNull',
'is-null': 'isNull',
'is-object': 'isObject',
'is-plain-object': 'isPlainObject',
'is-promise': 'isPromise',
'is-set': 'isSet',
'is-string': 'isString',
'is-truthy': 'isTruthy',
} satisfies MetaRecord;
12 changes: 12 additions & 0 deletions docs/content/guard/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
asIndexPage: true
---

# Guard

Guard functions

import meta from './_meta';
import { TOC } from '@/components/TOC';

<TOC base="/guard" meta={meta} />
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/pages/index.mdx → docs/content/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ The `@fullstacksjs/toolbox` aims to provide a simple and practical solution to
the lack of essential utilities in JavaScript.

It eliminates the need for code duplication or excessive third-party
dependencies, simplifying the development process. Say goodbye 👋 to dependency
hell 🔥 and enjoy simplicity.
dependencies, simplifying the development process. Say goodbye to dependency
hell and enjoy simplicity.
7 changes: 7 additions & 0 deletions docs/content/node/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { MetaRecord } from 'nextra';

export default {
'get-node-env': 'getNodeEnv',
'is-dev': 'isDev',
'is-prod': 'isProd',
} satisfies MetaRecord;
File renamed without changes.
10 changes: 10 additions & 0 deletions docs/content/node/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
asIndexPage: true
---

# Env

import meta from './_meta';
import { TOC } from '@/components/TOC';

<TOC base="/node" meta={meta} />
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions docs/content/nullable/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { MetaRecord } from 'nextra';

export default {
'bind': 'bind',
'concat-arrays': 'concatArrays',
} satisfies MetaRecord;
File renamed without changes.
10 changes: 10 additions & 0 deletions docs/content/nullable/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
asIndexPage: true
---

# Nullable

import meta from './_meta';
import { TOC } from '@/components/TOC';

<TOC base="/nullable" meta={meta} />
16 changes: 16 additions & 0 deletions docs/content/number/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { MetaRecord } from 'nextra';

export default {
'clamp': 'clamp',
'divide': 'divide',
'inc': 'inc',
'dec': 'dec',
'fallback-number': 'fallbackNumber',
'is-in-range': 'isInRange',
'is-negative': 'isNegative',
'is-positive': 'isPositive',
'mod': 'mod',
'percent': 'percent',
'random-int': 'randomInt',
'to-decimal': 'toDecimal',
} satisfies MetaRecord;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions docs/content/number/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
asIndexPage: true
---

# Number

import meta from './_meta';
import { TOC } from '@/components/TOC';

<TOC base="/number" meta={meta} />
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions docs/content/object/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { MetaRecord } from 'nextra';

export default {
'clone': 'clone',
'merge': 'merge',
'prune-key-when': 'pruneKeyWhen',
'prune-value-when': 'pruneValueWhen',
'replace': 'replace',
} satisfies MetaRecord;
File renamed without changes.
Loading