Skip to content

Commit

Permalink
refact: make project monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
sailist committed Feb 9, 2025
1 parent f783e31 commit 77b8b72
Show file tree
Hide file tree
Showing 56 changed files with 6,314 additions and 715 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,33 @@ jobs:
cache: pnpm
- name: Setup Pages
uses: actions/configure-pages@v5

- name: Get Commit Info
id: commit
run: |
COMMIT_SHA=$(git rev-parse --short HEAD)
BUILD_DATE=$(git log -1 --format=%cd --date=format:'%Y-%m-%d %H:%M:%S')
echo "{\"version\": \"${COMMIT_SHA}\", \"buildTime\": \"${BUILD_DATE}\"}" > document/docs/version.json
echo "{\"version\": \"${COMMIT_SHA}\", \"buildTime\": \"${BUILD_DATE}\"}" > app/document/docs/version.json
- name: Install Dependencies
run: |
cd document
cd app/document
pnpm install
- name: Build
run: |
cd document
cd app/document
mkdir -p dist
pnpm build
- name: Upload artifact
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: document/dist
path: app/document/dist

deploy:

permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

environment:
name: github-pages
Expand All @@ -67,4 +66,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v4
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useEffect, useRef, useState } from 'react';
// biome-ignore lint/style/useImportType: <explanation>
import React from 'react';
import { RangeEditor } from '../../src/editor';
import { anchorToString } from '../../src/helper';
import { AnchorQuery } from '../../src/query';
import { RangeEditor } from 'common-cursor/editor';
import { anchorToString } from 'common-cursor/helper';
import { AnchorQuery } from 'common-cursor/query';

interface EditableDivProps {
initialContent?: string;
Expand Down
File renamed without changes.
File renamed without changes.
Empty file.
9 changes: 4 additions & 5 deletions document/docs/hello.mdx → app/document/docs/guide/hello.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Hello World!
# Cursor Playground

## Start

import { EditableManually, EditablePlayable } from '../components/playboard';
import { version, buildTime } from "./version.json"
import { EditableManually, EditablePlayable } from '../../components/cursor_board';
import { version, buildTime } from "../version.json"


Write something to build your own docs! 🎁
Expand Down Expand Up @@ -50,3 +48,4 @@ stride="char"
initialContent="在 这里 开始 编辑..."
stride="word"
/>../components/playboard
../components/cursor_board
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion document/package.json → app/document/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
"preview": "rspress preview"
},
"dependencies": {
"common-cursor": "workspace:*",
"rspress": "^1.37.4"
},
"devDependencies": {
"@eslint/js": "^9.12.0",
"@rsbuild/plugin-source-build": "^1.0.2",
"@types/node": "^18.11.17",
"@types/react": "^19.0.2",
"@types/react-dom": "^19.0.2",
Expand All @@ -22,4 +24,4 @@
"prettier": "^3.3.3",
"typescript-eslint": "^8.8.1"
}
}
}
File renamed without changes.
47 changes: 47 additions & 0 deletions app/document/rspress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import * as path from "node:path";
import { defineConfig } from "rspress/config";
import { pluginSourceBuild } from "@rsbuild/plugin-source-build";

const packagesDir = path.resolve(__dirname, "../../packages");

export default defineConfig({
root: path.join(__dirname, "docs"),
title: "My Site",
icon: "/rspress-icon.png",
base: "/common-cursor/",
outDir: "dist", // 改用其他目录名称
route: {
exclude: ["custom.tsx", "components/**/*"],
},
plugins: [pluginSourceBuild()],
logo: {
light: "/rspress-light-logo.png",
dark: "/rspress-dark-logo.png",
},
themeConfig: {
socialLinks: [
{
icon: "github",
mode: "link",
content: "https://github.com/web-infra-dev/rspress",
},
],
},
source: {
include: [
// 编译 Monorepo 的 package 目录下的所有文件
// 建议排除 node_modules
{
and: [packagesDir, { not: /[\\/]node_modules[\\/]/ }],
},
],
},
builderConfig: {
source: {
alias: {
"common-cursor": path.resolve(packagesDir, "common-cursor/src"),
"common-format": path.resolve(packagesDir, "common-format/src"),
},
},
},
});
8 changes: 7 additions & 1 deletion document/tsconfig.json → app/document/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"lib": ["DOM", "ES2020"],
"module": "ESNext",
"jsx": "react-jsx",
"composite": true,
"noEmit": true,
"strict": true,
"skipLibCheck": true,
Expand All @@ -16,5 +17,10 @@
"include": ["docs", "theme", "rspress.config.ts"],
"mdx": {
"checkMdx": true
}
},
"references": [
{
"path": "../../packages"
}
]
}
1 change: 0 additions & 1 deletion document/docs/guide/_meta.json

This file was deleted.

210 changes: 0 additions & 210 deletions document/docs/guide/index.md

This file was deleted.

Loading

0 comments on commit 77b8b72

Please sign in to comment.