Skip to content

Commit 5febb23

Browse files
committed
feat(website): add next.js marketing site and split library entry points
1 parent 61b9d50 commit 5febb23

23 files changed

Lines changed: 8413 additions & 3 deletions

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
"types": "./dist/index.d.ts",
1111
"require": "./dist/index.js",
1212
"import": "./dist/index.mjs"
13+
},
14+
"./preview": {
15+
"types": "./dist/preview.d.ts",
16+
"require": "./dist/preview.js",
17+
"import": "./dist/preview.mjs"
1318
}
1419
},
1520
"files": [
@@ -77,4 +82,4 @@
7782
"typescript": "^5.3.3",
7883
"vitest": "^1.2.1"
7984
}
80-
}
85+
}

src/preview.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { SocialPreview } from './components/SocialPreview';

tsup.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { defineConfig } from 'tsup';
33
export default defineConfig([
44
{
55
// Library bundle - optimized for browser
6-
entry: ['src/index.ts'],
6+
entry: ['src/index.ts', 'src/preview.ts'],
77
format: ['cjs', 'esm'],
88
dts: true,
9-
splitting: false,
9+
splitting: true,
1010
sourcemap: true,
1111
clean: true,
1212
minify: true,

website/.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts

website/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# react-meta-seo Website
2+
3+
The official marketing and documentation website for `react-meta-seo`.
4+
Built with [Next.js 16](https://nextjs.org), [Tailwind CSS v4](https://tailwindcss.com), and running via "dogfooding" (direct link to parent library).
5+
6+
## Getting Started
7+
8+
1. **Install Dependencies**:
9+
```bash
10+
npm install
11+
```
12+
13+
2. **Run Development Server**:
14+
```bash
15+
npm run dev
16+
```
17+
18+
3. **Build for Production**:
19+
```bash
20+
npm run build
21+
```
22+
23+
## Architecture
24+
25+
- `src/app/page.tsx`: Landing page with feature showcase and interactive demo.
26+
- `src/app/docs/page.tsx`: Documentation viewer that renders the root `DOCUMENTATION.md`.
27+
- `src/lib/docs.ts`: Utility to read markdown from the parent directory.
28+
29+
## Dogfooding
30+
31+
This website installs the library via `npm install file:..`. It serves as a comprehensive integration test for:
32+
- React Server Components (RSC) compatibility
33+
- TypeScript types
34+
- Build artifacts (`preview` vs `main` entry points)

website/eslint.config.mjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { defineConfig, globalIgnores } from "eslint/config";
2+
import nextVitals from "eslint-config-next/core-web-vitals";
3+
import nextTs from "eslint-config-next/typescript";
4+
5+
const eslintConfig = defineConfig([
6+
...nextVitals,
7+
...nextTs,
8+
// Override default ignores of eslint-config-next.
9+
globalIgnores([
10+
// Default ignores of eslint-config-next:
11+
".next/**",
12+
"out/**",
13+
"build/**",
14+
"next-env.d.ts",
15+
]),
16+
]);
17+
18+
export default eslintConfig;

website/lib/docs.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import fs from 'fs';
2+
import path from 'path';
3+
4+
// Path to the root DOCUMENTATION.md
5+
const DOCS_PATH = path.join(process.cwd(), '../DOCUMENTATION.md');
6+
7+
export function getDocumentationContent() {
8+
try {
9+
const fileContent = fs.readFileSync(DOCS_PATH, 'utf8');
10+
return fileContent;
11+
} catch (e) {
12+
console.error('Failed to read DOCUMENTATION.md', e);
13+
return '# Error\n\nCould not load documentation. Please ensure DOCUMENTATION.md exists in the project root.';
14+
}
15+
}

website/next.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { NextConfig } from "next";
2+
3+
const nextConfig: NextConfig = {
4+
/* config options here */
5+
};
6+
7+
export default nextConfig;

0 commit comments

Comments
 (0)