Skip to content

Commit ac2dbfe

Browse files
committed
main 🧊 add new doc
1 parent 5405ce2 commit ac2dbfe

131 files changed

Lines changed: 2512 additions & 650 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/deploy.yaml‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535
node-version: 20
3636
cache: 'pnpm'
3737

38+
- name: Setup Bun
39+
uses: oven-sh/setup-bun@v2
40+
3841
- name: Setup Pages
3942
uses: actions/configure-pages@v4
4043

@@ -44,13 +47,19 @@ jobs:
4447
- name: Build registry
4548
run: pnpm run cli:build:registry
4649

47-
- name: Build with vitepress
48-
run: pnpm run docs:build
50+
- name: Build docs (vitepress)
51+
run: pnpm --dir packages/docs build
52+
53+
- name: Build new docs (next export)
54+
run: pnpm --dir packages/newdocs build
55+
56+
- name: Prepare Pages artifact
57+
run: pnpm --dir packages/docs prepare:pages-artifact
4958

5059
- name: Upload artifact
5160
uses: actions/upload-pages-artifact@v3
5261
with:
53-
path: packages/docs/app/.vitepress/dist
62+
path: site
5463

5564
# Deployment job
5665
deploy:

‎.gitignore‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,6 @@ gatsby-types.d.ts
223223

224224
# Docgen. Generated content
225225
packages/docs/content/docs/hooks/
226-
.source
226+
.source
227+
228+
out

‎SECURITY.md‎

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎packages/core/src/hooks/useBattery/useBattery.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface UseBatteryValue {
2828
}
2929

3030
/** The use battery return type */
31-
export interface UseBatteryStateReturn {
31+
export interface UseBatteryReturn {
3232
/** Whether the battery api is supported*/
3333
supported: boolean;
3434
/** The use battery value type */
@@ -48,7 +48,7 @@ export interface UseBatteryStateReturn {
4848
* @example
4949
* const { supported, loading, charging, chargingTime, dischargingTime, level } = useBattery();
5050
*/
51-
export const useBattery = (): UseBatteryStateReturn => {
51+
export const useBattery = (): UseBatteryReturn => {
5252
const supported =
5353
typeof navigator !== 'undefined' &&
5454
'getBattery' in navigator &&

‎packages/docs/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"scripts": {
2525
"dev": "vitepress dev app",
2626
"build": "vitepress build app",
27+
"prepare:pages-artifact": "node scripts/prepare-pages-artifact.mjs",
2728
"preview": "vitepress preview app",
2829
"lint": "eslint . --fix",
2930
"lint-inspector": "npx @eslint/config-inspector@latest",
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { access, cp, mkdir, readdir, rm, writeFile } from 'node:fs/promises';
2+
import path from 'node:path';
3+
import { fileURLToPath } from 'node:url';
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = path.dirname(__filename);
7+
8+
const docsRoot = path.resolve(__dirname, '..');
9+
const repoRoot = path.resolve(docsRoot, '..', '..');
10+
11+
const docsDistPath = path.join(docsRoot, 'app', '.vitepress', 'dist');
12+
const newDocsOutPath = path.join(repoRoot, 'packages', 'newdocs', 'out');
13+
const newDocsOutWithBasePath = path.join(newDocsOutPath, 'new');
14+
const sitePath = path.join(repoRoot, 'site');
15+
16+
const exists = async (targetPath) => {
17+
try {
18+
await access(targetPath);
19+
return true;
20+
} catch {
21+
return false;
22+
}
23+
};
24+
25+
const copyDirectoryContents = async (sourceDir, targetDir) => {
26+
await mkdir(targetDir, { recursive: true });
27+
28+
const entries = await readdir(sourceDir, { withFileTypes: true });
29+
for (const entry of entries) {
30+
const from = path.join(sourceDir, entry.name);
31+
const to = path.join(targetDir, entry.name);
32+
await cp(from, to, { recursive: true });
33+
}
34+
};
35+
36+
await rm(sitePath, { recursive: true, force: true });
37+
await copyDirectoryContents(docsDistPath, sitePath);
38+
39+
if (await exists(newDocsOutWithBasePath)) {
40+
await copyDirectoryContents(newDocsOutPath, sitePath);
41+
} else {
42+
const siteNewPath = path.join(sitePath, 'new');
43+
await copyDirectoryContents(newDocsOutPath, siteNewPath);
44+
}
45+
46+
await writeFile(path.join(sitePath, '.nojekyll'), '');

‎packages/newdocs/ReactUse Header.html‎

Lines changed: 0 additions & 183 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './layout';

packages/newdocs/app/(docs)/_components/layout/Header/Header.tsx renamed to packages/newdocs/app/(docs)/_components/layout/FunctionHeader/FunctionHeader.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,40 @@ const formatStarsCount = (count: number) => {
1414
return `${Math.round(count / 1000)}${count >= 1000 ? 'k' : ''}`;
1515
};
1616

17-
export const Header = async () => {
17+
export const FunctionHeader = async () => {
1818
const repositoryResponse = await fetches.get<{ stargazers_count: number }>(
1919
'https://api.github.com/repos/siberiacancode/reactuse',
2020
{
21-
next: { revalidate: 86400 }
21+
cache: 'force-cache'
2222
}
2323
);
2424

2525
const formattedCount = formatStarsCount(repositoryResponse.data.stargazers_count);
2626

2727
return (
2828
<header className='bg-background/95 supports-[backdrop-filter]:bg-background/80 sticky top-0 z-50 w-full backdrop-blur'>
29-
<div className='container-wrapper flex h-(--header-height) items-center justify-between gap-3 px-6'>
29+
<div className='container-wrapper flex h-(--header-height) items-center justify-between gap-3 px-8'>
3030
<Burger
3131
className='lg:hidden'
3232
items={[{ href: '/docs/installation', label: 'Get started' }]}
3333
/>
3434

3535
<div className='hidden min-w-0 items-center justify-between gap-3 lg:flex'>
3636
<Link className='inline-flex items-center gap-2' href='/'>
37-
<Image alt='ReactUse' height={14} src='/logo.svg' width={14} />
37+
<Image alt='ReactUse' height={12} src='/logo.svg' width={12} />
3838

39-
<span className='text-foreground text-xl font-semibold tracking-tight'>
39+
<span className='text-foreground text-lg font-semibold tracking-tight'>
4040
{CONFIG.NAME}
4141
</span>
4242
</Link>
4343

4444
<Button asChild className='rounded-full' size='sm' variant='ghost'>
4545
<Link href='/docs/installation'>Docs</Link>
4646
</Button>
47+
48+
<Button asChild className='rounded-full' size='sm' variant='ghost'>
49+
<Link href='/docs/functions'>Functions</Link>
50+
</Button>
4751
</div>
4852

4953
<div className='flex min-w-0 items-center justify-end gap-2'>

packages/newdocs/app/(docs)/_components/layout/Header/components/Burger/Burger.tsx renamed to packages/newdocs/app/(docs)/_components/layout/FunctionHeader/components/Burger/Burger.tsx

File renamed without changes.

0 commit comments

Comments
 (0)