diff --git a/examples/documentation/README.md b/examples/documentation/README.md new file mode 100644 index 0000000..8a9c78c --- /dev/null +++ b/examples/documentation/README.md @@ -0,0 +1,29 @@ +# Rspress website + +## Setup + +Install the dependencies: + +```bash +npm install +``` + +## Get started + +Start the dev server: + +```bash +npm run dev +``` + +Build the website for production: + +```bash +npm run build +``` + +Preview the production build locally: + +```bash +npm run preview +``` diff --git a/examples/documentation/docs/_nav.json b/examples/documentation/docs/_nav.json new file mode 100644 index 0000000..b7abfa9 --- /dev/null +++ b/examples/documentation/docs/_nav.json @@ -0,0 +1,11 @@ +[ + { + "text": "API", + "link": "/api/", + "activeMatch": "/api/" + }, + { + "text": "Document", + "link": "https://rspress.rs/" + } +] diff --git a/examples/documentation/docs/api/_meta.json b/examples/documentation/docs/api/_meta.json new file mode 100644 index 0000000..f0ff0de --- /dev/null +++ b/examples/documentation/docs/api/_meta.json @@ -0,0 +1 @@ +["index", "commands"] diff --git a/examples/documentation/docs/api/commands.mdx b/examples/documentation/docs/api/commands.mdx new file mode 100644 index 0000000..8a8b53d --- /dev/null +++ b/examples/documentation/docs/api/commands.mdx @@ -0,0 +1,7 @@ +# Commands + +## dev + +## build + +## preview diff --git a/examples/documentation/docs/api/index.mdx b/examples/documentation/docs/api/index.mdx new file mode 100644 index 0000000..939b295 --- /dev/null +++ b/examples/documentation/docs/api/index.mdx @@ -0,0 +1,6 @@ +--- +title: API Overview +overview: true +--- + +This is an API Overview page which outlines all the available APIs. diff --git a/examples/documentation/docs/index.md b/examples/documentation/docs/index.md new file mode 100644 index 0000000..c8a5c8c --- /dev/null +++ b/examples/documentation/docs/index.md @@ -0,0 +1,18 @@ +--- +pageType: home + +hero: + name: My Site + text: A cool website! + tagline: This is the tagline + actions: + - theme: brand + text: Quick Start + link: /api/ + - theme: alt + text: GitHub + link: https://github.com/web-infra-dev/rspress + image: + src: https://assets.rspack.rs/rspress/rspress-logo.svg + alt: Logo +--- diff --git a/examples/documentation/package.json b/examples/documentation/package.json new file mode 100644 index 0000000..c213e15 --- /dev/null +++ b/examples/documentation/package.json @@ -0,0 +1,21 @@ +{ + "name": "@examples/documentation", + "private": true, + "type": "module", + "scripts": { + "build": "rs doc build", + "dev": "rs doc", + "lint": "rs lint", + "preview": "rs doc preview" + }, + "dependencies": { + "rstack": "workspace:*" + }, + "devDependencies": { + "@types/node": "catalog:", + "@types/react": "catalog:", + "@types/react-dom": "catalog:", + "react": "catalog:", + "react-dom": "catalog:" + } +} diff --git a/examples/documentation/rstack.config.ts b/examples/documentation/rstack.config.ts new file mode 100644 index 0000000..ac492ef --- /dev/null +++ b/examples/documentation/rstack.config.ts @@ -0,0 +1,17 @@ +import { define } from 'rstack'; +import path from 'node:path'; + +define.doc({ + root: path.join(import.meta.dirname, 'docs'), + title: 'My Site', +}); + +define.lint(async () => { + const { js, ts, reactPlugin, reactHooksPlugin } = await import('rstack/lint'); + return [ + js.configs.recommended, + ts.configs.recommended, + reactPlugin.configs.recommended, + reactHooksPlugin.configs.recommended, + ]; +}); diff --git a/examples/documentation/tsconfig.json b/examples/documentation/tsconfig.json new file mode 100644 index 0000000..559f2a0 --- /dev/null +++ b/examples/documentation/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "lib": ["DOM", "ES2020"], + "jsx": "react-jsx", + "target": "ES2020", + "noEmit": true, + "skipLibCheck": true, + "types": ["rstack/types", "node"], + "useDefineForClassFields": true, + + /* modules */ + "moduleDetection": "force", + "moduleResolution": "bundler", + "verbatimModuleSyntax": true, + "resolveJsonModule": true, + "allowImportingTsExtensions": true, + + /* type checking */ + "noUnusedLocals": true, + "noUnusedParameters": true + }, + "include": ["docs", "rstack.config.ts"], + "mdx": { + "checkMdx": true + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d7a2373..f61e3b4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -161,6 +161,28 @@ importers: specifier: 'catalog:' version: 6.0.3 + examples/documentation: + dependencies: + rstack: + specifier: workspace:* + version: link:../../packages/rstack + devDependencies: + '@types/node': + specifier: 'catalog:' + version: 24.13.2 + '@types/react': + specifier: 'catalog:' + version: 19.2.17 + '@types/react-dom': + specifier: 'catalog:' + version: 19.2.3(@types/react@19.2.17) + react: + specifier: 'catalog:' + version: 19.2.7 + react-dom: + specifier: 'catalog:' + version: 19.2.7(react@19.2.7) + examples/lib-node: devDependencies: '@types/node': @@ -1977,8 +1999,8 @@ snapshots: '@rslib/core@0.23.2(typescript@6.0.3)': dependencies: - '@rsbuild/core': 2.1.4 - rsbuild-plugin-dts: 0.23.2(@rsbuild/core@2.1.4)(typescript@6.0.3) + '@rsbuild/core': 2.1.5 + rsbuild-plugin-dts: 0.23.2(@rsbuild/core@2.1.5)(typescript@6.0.3) optionalDependencies: typescript: 6.0.3 transitivePeerDependencies: @@ -2226,7 +2248,7 @@ snapshots: '@rstest/core@0.11.0(happy-dom@20.10.6)': dependencies: - '@rsbuild/core': 2.1.4 + '@rsbuild/core': 2.1.5 '@types/chai': 5.2.3 optionalDependencies: happy-dom: 20.10.6 @@ -3470,10 +3492,10 @@ snapshots: rfdc@1.4.1: {} - rsbuild-plugin-dts@0.23.2(@rsbuild/core@2.1.4)(typescript@6.0.3): + rsbuild-plugin-dts@0.23.2(@rsbuild/core@2.1.5)(typescript@6.0.3): dependencies: '@ast-grep/napi': 0.37.0 - '@rsbuild/core': 2.1.4 + '@rsbuild/core': 2.1.5 optionalDependencies: typescript: 6.0.3