Skip to content

Commit ef44f5d

Browse files
committed
Init by forking from en version
0 parents  commit ef44f5d

299 files changed

Lines changed: 63651 additions & 0 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.

.cursor/Dockerfile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
FROM ubuntu:22.04
2+
3+
# Set non-interactive mode for apt
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
6+
# Install dependencies
7+
RUN apt-get update && apt-get install -y \
8+
curl \
9+
git \
10+
build-essential \
11+
pkg-config \
12+
libssl-dev \
13+
python3 \
14+
unzip \
15+
wget \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
# Install Node.js 20.x
19+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
20+
&& apt-get install -y nodejs \
21+
&& npm install -g npm
22+
23+
# Install pnpm
24+
RUN npm install -g pnpm@8
25+
26+
# Install Deno
27+
RUN curl -fsSL https://deno.land/x/install/install.sh | sh
28+
ENV PATH="/root/.deno/bin:${PATH}"
29+
30+
# Install Rust and required components
31+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.83.0
32+
ENV PATH="/root/.cargo/bin:${PATH}"
33+
RUN rustup target add wasm32-unknown-unknown
34+
35+
# Install wasm-pack
36+
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
37+
38+
# Install wasm-bindgen
39+
RUN cargo install wasm-bindgen-cli --version 0.2.100
40+
41+
# Install wasm-opt
42+
RUN npm install -g wasm-opt
43+
44+
# Install nextest
45+
RUN curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
46+
47+
# Set the working directory
48+
WORKDIR /workspace
49+
50+
# Default command
51+
CMD ["/bin/bash"]

.cursor/environment.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"build": {
3+
"dockerfile": "Dockerfile",
4+
"context": "."
5+
},
6+
"terminals": []
7+
}

.github/workflows/deno_tests.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# This workflow will install Deno then run `deno lint` and `deno test`.
7+
# For more information see: https://github.com/denoland/setup-deno
8+
9+
name: Deno Eval All Code Blocks
10+
11+
on:
12+
push:
13+
branches: ["main"]
14+
pull_request:
15+
branches: ["main"]
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
test:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Setup repo
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Deno
29+
uses: denoland/setup-deno@v1
30+
with:
31+
deno-version: v2.x
32+
33+
- name: Run tests
34+
run: cd deno_scripts && deno run -A run_code_blocks.ts ..

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.next
2+
node_modules
3+
.DS_Store
4+
.vercel

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
enable-pre-post-scripts=true

.storybook/main.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import type { StorybookConfig } from "@storybook/nextjs";
2+
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
3+
4+
const config: StorybookConfig = {
5+
stories: [
6+
"../stories/**/*.mdx",
7+
"../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)",
8+
],
9+
addons: [
10+
"@storybook/addon-links",
11+
"@storybook/addon-essentials",
12+
"@storybook/addon-onboarding",
13+
"@storybook/addon-interactions",
14+
],
15+
framework: {
16+
name: "@storybook/nextjs",
17+
options: {},
18+
},
19+
docs: {
20+
autodocs: "tag",
21+
},
22+
webpackFinal(config) {
23+
config.experiments = { ...config.experiments, asyncWebAssembly: true };
24+
if (!config.resolve) {
25+
config.resolve = {}
26+
}
27+
28+
config.resolve.plugins = [...(config.resolve?.plugins ?? []), new TsconfigPathsPlugin()];
29+
return config;
30+
},
31+
};
32+
export default config;

.storybook/preview.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import type { Preview } from "@storybook/react";
2+
import '@fontsource/poppins/300.css';
3+
import '@fontsource/poppins/400.css';
4+
import '@fontsource/poppins/500.css';
5+
import '@fontsource/poppins/600.css';
6+
import '@fontsource/poppins/700.css';
7+
import '@fontsource/poppins/800.css';
8+
9+
const preview: Preview = {
10+
parameters: {
11+
actions: { argTypesRegex: "^on[A-Z].*" },
12+
controls: {
13+
matchers: {
14+
color: /(background|color)$/i,
15+
date: /Date$/i,
16+
},
17+
},
18+
},
19+
};
20+
21+
export default preview;

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cSpell.words": [
3+
"linebreaks"
4+
],
5+
"deno.enable": false
6+
}

AGENTS.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
- `pages/`: Next.js pages and MDX docs (Nextra). Route files use kebab-case.
5+
- `components/`: Reusable React components (PascalCase filenames).
6+
- `lib/`: Local utilities/helpers imported by pages/components.
7+
- `public/`: Static assets (images, favicons, robots, sitemap output).
8+
- `.storybook/`: Storybook configuration and stories in `stories/`.
9+
- `deno_scripts/`: Deno-based tooling and doc code-block tests.
10+
- `styles/` and `style.css`: Global styles and Tailwind setup.
11+
12+
## Build, Test, and Development Commands
13+
- `pnpm install`: Install dependencies (pnpm is required).
14+
- `pnpm dev`: Run Next.js dev server.
15+
- `pnpm build`: Generate RSS then build Next.js (`gen-rss.js`, `next build`).
16+
- `pnpm start`: Serve the production build.
17+
- `pnpm test`: Execute Deno-powered code-block tests across docs.
18+
- `pnpm storybook` / `pnpm build-storybook`: Run/build Storybook.
19+
20+
## Coding Style & Naming Conventions
21+
- Language: TypeScript + React (function components).
22+
- Indentation: 2 spaces; keep files focused and small.
23+
- Naming: PascalCase for components (`components/CodeBlock.tsx`), camelCase for vars, kebab-case routes (`pages/api/route-name.ts`).
24+
- Styling: TailwindCSS utilities; prefer composable classes over custom CSS.
25+
- Imports: Use module paths relative to file; docs code blocks may import from `loro-crdt` directly.
26+
27+
## Testing Guidelines
28+
- Framework: Deno executes TS code blocks extracted from `.md|.mdx`.
29+
- Run: `pnpm test` (or `cd deno_scripts && deno run -A run_code_blocks.ts ..`).
30+
- Expectations: Use `expect` assertions where relevant in examples.
31+
- Authoring docs: Ensure code blocks are self-contained TS snippets; they should compile and run without external context.
32+
33+
## Commit & Pull Request Guidelines
34+
- Commits: Follow Conventional Commits (e.g., `docs: ...`, `fix: ...`, `feat: ...`, `test: ...`, `ui: ...`).
35+
- PRs: Provide a clear summary, link related issues, include screenshots/gifs for UI/docs changes, and list test steps.
36+
- Checks: Run `pnpm build` and `pnpm test` locally before requesting review.
37+
38+
## Security & Configuration Tips
39+
- Node: Use the version compatible with Next 14; install via nvm.
40+
- Secrets: Do not commit tokens or API keys; prefer env vars if needed.

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Loro Docs
2+
3+
The source code for https://loro.dev/
4+
5+
# Development
6+
7+
```bash
8+
pnpm install
9+
pnpm dev
10+
```

0 commit comments

Comments
 (0)