Skip to content

Commit 6cf05ca

Browse files
committed
main 🧊 add new starter docs
1 parent 52475d8 commit 6cf05ca

11 files changed

Lines changed: 608 additions & 113 deletions

File tree

Lines changed: 90 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
import type { DefaultTheme, MarkdownOptions } from "vitepress";
1+
import type { DefaultTheme, MarkdownOptions } from 'vitepress';
22

3-
import { transformerTwoslash } from "@shikijs/vitepress-twoslash";
4-
import tailwindcss from "@tailwindcss/vite";
5-
import { fileURLToPath } from "node:url";
6-
import { defineConfig } from "vitepress";
3+
import { transformerTwoslash } from '@shikijs/vitepress-twoslash';
4+
import tailwindcss from '@tailwindcss/vite';
5+
import { fileURLToPath } from 'node:url';
6+
import { defineConfig } from 'vitepress';
77

8-
import { getContentItems } from "../../src/utils";
8+
import { getContentItems } from '../../src/utils';
99

1010
export default async () => {
1111
const contentItems = await getContentItems();
1212
const sidebarContentItems = contentItems.reduce<DefaultTheme.SidebarItem[]>(
1313
(categoryItems, contentItem) => {
14-
const category = categoryItems.find(
15-
(group) => group.text === contentItem.category
16-
);
14+
const category = categoryItems.find((group) => group.text === contentItem.category);
1715

1816
if (!category) {
1917
categoryItems.push({
2018
text: contentItem.category,
21-
items: [contentItem],
19+
items: [contentItem]
2220
});
2321
} else {
2422
category.items!.push(contentItem);
@@ -30,53 +28,46 @@ export default async () => {
3028
);
3129

3230
return defineConfig({
33-
base: "/",
34-
title: "reactuse",
31+
base: '/',
32+
title: 'reactuse',
3533
description:
36-
"Improve your react applications with our library 📦 designed for comfort and speed",
34+
'Improve your react applications with our library 📦 designed for comfort and speed',
3735
markdown: {
3836
codeTransformers: [transformerTwoslash()],
39-
languages: ["js", "jsx", "ts", "tsx"],
37+
languages: ['js', 'jsx', 'ts', 'tsx']
4038
} as unknown as MarkdownOptions,
4139
vite: {
4240
plugins: [tailwindcss()],
4341
resolve: {
4442
alias: {
45-
"@siberiacancode/reactuse": fileURLToPath(
46-
new URL("../../../core/src", import.meta.url)
47-
),
48-
"@siberiacancode/docs": fileURLToPath(
49-
new URL("../../src", import.meta.url)
50-
),
51-
"@": fileURLToPath(new URL("../../../core/src", import.meta.url)),
52-
},
53-
},
43+
'@siberiacancode/reactuse': fileURLToPath(new URL('../../../core/src', import.meta.url)),
44+
'@siberiacancode/docs': fileURLToPath(new URL('../../src', import.meta.url)),
45+
'@': fileURLToPath(new URL('../../../core/src', import.meta.url))
46+
}
47+
}
5448
},
5549
transformPageData: (pageData) => {
5650
pageData.frontmatter.head ??= [];
5751
pageData.frontmatter.head.push([
58-
"meta",
52+
'meta',
5953
{
60-
name: "og:image",
54+
name: 'og:image',
6155
content:
62-
"https://repository-images.githubusercontent.com/799880708/0afee0cb-ca48-40a2-9c38-dc5b64ebdf65",
63-
},
56+
'https://repository-images.githubusercontent.com/799880708/0afee0cb-ca48-40a2-9c38-dc5b64ebdf65'
57+
}
6458
]);
6559

66-
if (pageData.relativePath.includes("hooks")) {
60+
if (pageData.relativePath.includes('hooks')) {
6761
pageData.title = pageData.params?.name;
6862
}
6963
},
7064
head: [
65+
['meta', { name: 'algolia-site-verification', content: '60FB6E25551CE504' }],
66+
['link', { rel: 'icon', href: '/favicon.ico' }],
67+
['link', { rel: 'manifest', href: '/manifest.json' }],
7168
[
72-
"meta",
73-
{ name: "algolia-site-verification", content: "60FB6E25551CE504" },
74-
],
75-
["link", { rel: "icon", href: "/favicon.ico" }],
76-
["link", { rel: "manifest", href: "/manifest.json" }],
77-
[
78-
"script",
79-
{ type: "text/javascript" },
69+
'script',
70+
{ type: 'text/javascript' },
8071
`(function(m,e,t,r,i,k,a){
8172
m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
8273
m[i].l=1*new Date();
@@ -91,34 +82,34 @@ export default async () => {
9182
clickmap:true,
9283
trackLinks:true,
9384
accurateTrackBounce:true
94-
});`,
85+
});`
9586
],
9687
[
97-
"noscript",
88+
'noscript',
9889
{},
99-
`<div><img src="https://mc.yandex.ru/watch/102942267" style="position:absolute; left:-9999px;" alt="" /></div>`,
90+
`<div><img src="https://mc.yandex.ru/watch/102942267" style="position:absolute; left:-9999px;" alt="" /></div>`
10091
],
10192

10293
[
103-
"script",
94+
'script',
10495
{},
10596
`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
10697
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
10798
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
10899
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
109-
})(window,document,'script','dataLayer','GTM-5SMCHX9Z');`,
100+
})(window,document,'script','dataLayer','GTM-5SMCHX9Z');`
110101
],
111102

112103
[
113-
"script",
104+
'script',
114105
{
115-
async: "",
116-
src: "https://www.googletagmanager.com/gtag/js?id=G-RRECQP6XBW",
117-
},
106+
async: '',
107+
src: 'https://www.googletagmanager.com/gtag/js?id=G-RRECQP6XBW'
108+
}
118109
],
119110

120111
[
121-
"script",
112+
'script',
122113
{},
123114
`window.dataLayer = window.dataLayer || [];
124115
function gtag(){dataLayer.push(arguments);}
@@ -128,66 +119,75 @@ export default async () => {
128119
client_storage: 'none',
129120
allow_google_signals: false,
130121
allow_ad_personalization_signals: false
131-
});`,
132-
],
122+
});`
123+
]
133124
],
134125
locales: {
135126
root: {
136-
label: "English",
137-
lang: "en",
127+
label: 'English',
128+
lang: 'en',
138129
themeConfig: {
139130
logo: {
140-
src: "/logo.svg",
141-
alt: "reactuse",
131+
src: '/logo.svg',
132+
alt: 'reactuse'
142133
},
143134
footer: {
144-
message: "Released under the MIT License.",
145-
copyright: `Copyright © ${new Date().getFullYear()} siberiacancode`,
135+
message: 'Released under the MIT License.',
136+
copyright: `Copyright © ${new Date().getFullYear()} siberiacancode`
146137
},
147138
editLink: {
148139
pattern: ({ filePath, params }) => {
149-
if (filePath.includes("hooks") && params?.name) {
140+
if (filePath.includes('hooks') && params?.name) {
150141
return `https://github.com/siberiacancode/reactuse/blob/main/packages/core/src/hooks/${params.name}/${params.name}.ts`;
151142
} else {
152143
return `https://github.com/siberiacancode/reactuse/blob/main/packages/docs/app/${filePath}`;
153144
}
154145
},
155-
text: "Suggest changes to this page",
146+
text: 'Suggest changes to this page'
156147
},
157148
nav: [
158-
{ text: "Home", link: "/" },
149+
{ text: 'Home', link: '/' },
159150
{
160-
text: "Functions",
151+
text: 'Functions',
161152
items: [
162-
{ text: "Get Started", link: "/introduction" },
163-
{ text: "Installation", link: "/installation" },
164-
{ text: "Hooks", link: "/functions/hooks/useAsync.html" },
165-
],
166-
},
153+
{ text: 'Get Started', link: '/introduction' },
154+
{ text: 'Installation', link: '/installation' },
155+
{ text: 'Hooks', link: '/functions/hooks/useAsync.html' }
156+
]
157+
}
167158
],
168159
sidebar: [
169160
{
170-
text: "Getting started",
161+
text: 'Getting started',
171162
items: [
172-
{ text: "Introduction", link: "/introduction" },
173-
{ text: "Installation", link: "/installation" },
174-
{ text: "reactuse.json", link: "/reactuse-json" },
175-
{ text: "CLI", link: "/cli" },
176-
{ text: "target", link: "/target" },
177-
{ text: "memoization", link: "/memoization" },
178-
],
163+
{ text: 'Introduction', link: '/introduction' },
164+
{ text: 'Installation', link: '/installation' },
165+
{ text: 'reactuse.json', link: '/reactuse-json' },
166+
{ text: 'CLI', link: '/cli' },
167+
{ text: 'target', link: '/target' },
168+
{ text: 'memoization', link: '/memoization' }
169+
]
179170
},
180171
{
181-
text: "Installation",
172+
text: 'Installation',
182173
items: [
183-
{ text: "Vite", link: "/installation/vite" },
184-
{ text: "Next.js", link: "/installation/nextjs" },
185-
],
174+
{ text: 'Vite', link: '/installation/vite' },
175+
{ text: 'Next.js', link: '/installation/nextjs' },
176+
{ text: 'Astro', link: '/installation/astro' },
177+
{ text: 'React Router', link: '/installation/react-router' },
178+
{
179+
text: 'TanStack Router',
180+
link: '/installation/tanstack-router'
181+
},
182+
{ text: 'TanStack Start', link: '/installation/tanstack' },
183+
{ text: 'Preact', link: '/installation/preact' },
184+
{ text: 'Manual', link: '/installation/manual' }
185+
]
186186
},
187-
...sidebarContentItems,
188-
],
189-
},
190-
},
187+
...sidebarContentItems
188+
]
189+
}
190+
}
191191
// ru: {
192192
// label: 'Русский',
193193
// lang: 'ru',
@@ -204,20 +204,20 @@ export default async () => {
204204
},
205205
themeConfig: {
206206
search: {
207-
provider: "algolia",
207+
provider: 'algolia',
208208
options: {
209-
appId: "62LROXAB1F",
210-
apiKey: "87ab8dd07b4aba02814c082d98e4b8a7",
211-
indexName: "reactuse",
212-
},
209+
appId: '62LROXAB1F',
210+
apiKey: '87ab8dd07b4aba02814c082d98e4b8a7',
211+
indexName: 'reactuse'
212+
}
213213
},
214214
socialLinks: [
215-
{ icon: "github", link: "https://github.com/siberiacancode/reactuse" },
215+
{ icon: 'github', link: 'https://github.com/siberiacancode/reactuse' },
216216
{
217-
icon: "npm",
218-
link: "https://www.npmjs.com/package/@siberiacancode/reactuse",
219-
},
220-
],
221-
},
217+
icon: 'npm',
218+
link: 'https://www.npmjs.com/package/@siberiacancode/reactuse'
219+
}
220+
]
221+
}
222222
});
223223
};

packages/docs/app/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Use the CLI to add hooks to your project with [useverse](https://www.npmjs.com/p
66

77
Use the `init` command to initialize configuration and dependencies for a new project.
88

9-
The `init` command installs dependencies, adds configures [`reactuse.json`](./reactuse-json.md).
9+
The `init` command installs dependencies and creates a [`reactuse.json`](./reactuse-json.md) config file.
1010

1111
```bash
1212
npx useverse@latest init

packages/docs/app/installation.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,26 @@ bun add @siberiacancode/reactuse
3232

3333
How to install dependencies and structure your app with [cli](./cli.md) and [useverse](https://www.npmjs.com/package/useverse).
3434

35-
<div class="flex flex-col gap-4 md:flex-row">
36-
<a href="./installation/vite" class="w-full !no-underline">
35+
<div class="grid md:grid-cols-2 gap-4 grid-cols-1">
36+
<a href="./installation/vite" class="!no-underline">
3737
<Framework framework="vite" />
3838
</a>
39-
<a href="./installation/nextjs" class="w-full !no-underline">
39+
<a href="./installation/nextjs" class="!no-underline">
4040
<Framework framework="next" />
4141
</a>
42+
<a href="./installation/astro" class="!no-underline">
43+
<Framework framework="astro" />
44+
</a>
45+
<a href="./installation/react-router" class="!no-underline">
46+
<Framework framework="react-router" />
47+
</a>
48+
<a href="./installation/tanstack-router" class="!no-underline">
49+
<Framework framework="tanstack-router" />
50+
</a>
51+
<a href="./installation/tanstack" class="!no-underline">
52+
<Framework framework="tanstack" />
53+
</a>
54+
<a href="./installation/manual" class="!no-underline">
55+
<Framework framework="manual" />
56+
</a>
4257
</div>

0 commit comments

Comments
 (0)