Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions docs/__tests__/meta-validation.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { describe, it, expect } from 'vitest'
import { pathToFileURL } from 'url'
import fs from 'fs'
import path from 'path'

const PAGES_DIR = path.join(__dirname, '..', 'pages')

function findMetaFiles(dir: string): string[] {
const results: string[] = []
if (!fs.existsSync(dir)) return results

for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
const fullPath = path.join(dir, entry.name)
if (entry.isDirectory()) {
results.push(...findMetaFiles(fullPath))
} else if (/^_meta\.(js|jsx|ts|tsx)$/.test(entry.name)) {
results.push(fullPath)
}
}
return results
}

async function loadMeta(metaFile: string): Promise<Record<string, unknown>> {
const mod = await import(pathToFileURL(metaFile).href)
return (mod.default ?? mod) as Record<string, unknown>
}

function findMdxFiles(dir: string): string[] {
const results: string[] = []
if (!fs.existsSync(dir)) return results

for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
const fullPath = path.join(dir, entry.name)
if (entry.isDirectory()) {
results.push(...findMdxFiles(fullPath))
} else if (entry.name.endsWith('.mdx')) {
results.push(fullPath)
}
}
return results
}

function metaKeyResolvesToFile(pagesDir: string, key: string): boolean {
const mdxFile = path.join(pagesDir, `${key}.mdx`)
const indexFile = path.join(pagesDir, key, 'index.mdx')
const dirPath = path.join(pagesDir, key)

return (
fs.existsSync(mdxFile) ||
fs.existsSync(indexFile) ||
(fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory())
)
}

function hasTitleFrontmatter(content: string): boolean {
const match = content.match(/^---\s*\n([\s\S]*?)\n---/)
if (!match) return false
return /^title\s*:/m.test(match[1])
}

describe('meta validation', () => {
it('all _meta entries resolve to existing files', async () => {
const metaFiles = findMetaFiles(PAGES_DIR)
expect(metaFiles.length).toBeGreaterThan(0)

for (const metaFile of metaFiles) {
const dir = path.dirname(metaFile)
const meta = await loadMeta(metaFile)

for (const key of Object.keys(meta)) {
expect(
metaKeyResolvesToFile(dir, key),
`_meta key "${key}" in ${path.relative(PAGES_DIR, metaFile)} does not resolve to a file`
).toBe(true)
}
}
})

it('all MDX files have title frontmatter', () => {
const mdxFiles = findMdxFiles(PAGES_DIR)

for (const mdxFile of mdxFiles) {
const content = fs.readFileSync(mdxFile, 'utf-8')
expect(
hasTitleFrontmatter(content),
`${path.relative(PAGES_DIR, mdxFile)} is missing title frontmatter`
).toBe(true)
}
})

it('finds at least 10 MDX pages', () => {
const mdxFiles = findMdxFiles(PAGES_DIR)
expect(mdxFiles.length).toBeGreaterThanOrEqual(10)
})
})
6 changes: 6 additions & 0 deletions docs/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { AppProps } from 'next/app'
import 'nextra-theme-docs/style.css'

export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
}
7 changes: 7 additions & 0 deletions docs/pages/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
index: 'ホーム',
'getting-started': 'はじめに',
'self-hosting': 'セルフホスト',
'api-reference': 'API リファレンス',
contributing: 'コントリビューター',
}
4 changes: 4 additions & 0 deletions docs/pages/api-reference/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
rest: 'REST API',
graphql: 'GraphQL API',
}
15 changes: 15 additions & 0 deletions docs/pages/api-reference/graphql.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: GraphQL API
---

# GraphQL API

open-git は GitHub GraphQL API v4 互換のスキーマを部分的に提供します。

## エンドポイント

```
POST /graphql
```

GraphQL スキーマから自動生成されるリファレンスは今後統合予定です。
15 changes: 15 additions & 0 deletions docs/pages/api-reference/rest.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: REST API
---

# REST API

open-git は GitHub REST API v3 互換のエンドポイントを提供します。

## 認証

Personal Access Token または OAuth トークンを使用して API にアクセスします。詳細は今後追加予定です。

## エンドポイント一覧

OpenAPI 定義から自動生成されるリファレンスは今後統合予定です。
5 changes: 5 additions & 0 deletions docs/pages/contributing/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
index: 'コントリビューターガイド',
license: 'ライセンス',
branding: 'ブランディング',
}
11 changes: 11 additions & 0 deletions docs/pages/contributing/branding.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: ブランディング
---

# ブランディング

open-git の商標・ロゴ使用ガイドラインです。

## ロゴと商標

open-git のロゴおよび商標の使用に関するルールは今後追加予定です。GitHub の商標を侵害する表記・ロゴの使用は禁止されています。
20 changes: 20 additions & 0 deletions docs/pages/contributing/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: コントリビューターガイド
---

# コントリビューターガイド

open-git への貢献にご関心をお寄せいただきありがとうございます。

## はじめに

Issue の報告、Pull Request の提出、ドキュメントの改善など、あらゆる形の貢献を歓迎します。

## ライセンス

本プロジェクトは [LICENSE](/LICENSE) ファイルに記載されたライセンスの下で提供されています。コントリビューションを行う前にライセンス条項をご確認ください。

## 関連リンク

- [ライセンス](/contributing/license)
- [ブランディング](/contributing/branding)
11 changes: 11 additions & 0 deletions docs/pages/contributing/license.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: ライセンス
---

# ライセンス

open-git のライセンス情報です。

## オープンソースライセンス

本プロジェクトのライセンス条項はリポジトリルートの LICENSE ファイルを参照してください。詳細な説明は今後追加予定です。
5 changes: 5 additions & 0 deletions docs/pages/getting-started/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
index: '概要',
installation: 'インストール',
quickstart: 'クイックスタート',
}
12 changes: 12 additions & 0 deletions docs/pages/getting-started/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: はじめに
---

# はじめに

open-git へようこそ。このセクションでは、open-git の概要と最初のセットアップ手順を説明します。

## このセクションの内容

- [インストール](/getting-started/installation) — Docker Compose または Helm を使ったインストール
- [クイックスタート](/getting-started/quickstart) — インストール後の最初の操作
26 changes: 26 additions & 0 deletions docs/pages/getting-started/installation.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: インストール
order: 1
---

# インストール

open-git をセルフホスト環境にインストールする方法を説明します。

## Docker Compose

```bash
# TODO: Docker Compose インストール手順
docker compose up -d
```

Docker Compose を使った最も簡単なインストール方法です。詳細な手順は今後追加予定です。

## Helm

```bash
# TODO: Helm インストール手順
helm install open-git ./charts/open-git
```

Kubernetes 環境では Helm チャートを使用してデプロイできます。詳細な手順は今後追加予定です。
25 changes: 25 additions & 0 deletions docs/pages/getting-started/quickstart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: クイックスタート
order: 2
---

# クイックスタート

インストールが完了したら、以下の手順で open-git を使い始められます。

## 1. 管理者アカウントの作成

```bash
# TODO: 初期管理者アカウント作成コマンド
```

## 2. 最初のリポジトリを作成

Web UI または CLI からリポジトリを作成します。詳細な手順は今後追加予定です。

## 3. リモートを追加して push

```bash
git remote add origin https://your-open-git.example.com/user/repo.git
git push -u origin main
```
14 changes: 14 additions & 0 deletions docs/pages/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: ホーム
description: open-git 公式ドキュメント
---

# open-git ドキュメント

open-git は GitHub 互換のセルフホスト型 Git プラットフォームです。このドキュメントでは、インストールから運用、API リファレンスまでを案内します。

## 次のステップ

- [はじめに](/getting-started) — 概要とクイックスタート
- [インストール](/getting-started/installation) — Docker Compose / Helm によるセットアップ
- [クイックスタート](/getting-started/quickstart) — 最初のリポジトリを作成する
5 changes: 5 additions & 0 deletions docs/pages/self-hosting/_meta.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
index: '概要',
traefik: 'Traefik 設定',
database: 'データベース',
}
15 changes: 15 additions & 0 deletions docs/pages/self-hosting/database.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: データベース
---

# データベース

open-git がサポートするデータベースオプションと設定方法を説明します。

## PostgreSQL (推奨)

本番環境では PostgreSQL の使用を推奨します。接続設定の詳細は今後追加予定です。

## SQLite

小規模なデプロイや開発環境では SQLite も利用できます。設定手順は今後追加予定です。
12 changes: 12 additions & 0 deletions docs/pages/self-hosting/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: セルフホスト概要
---

# セルフホスト概要

open-git を本番環境で運用するための構成ガイドです。

## このセクションの内容

- [Traefik 設定](/self-hosting/traefik) — リバースプロキシと TLS 終端
- [データベース](/self-hosting/database) — PostgreSQL / SQLite の選定と設定
15 changes: 15 additions & 0 deletions docs/pages/self-hosting/traefik.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Traefik 設定
---

# Traefik 設定

Traefik をリバースプロキシとして使用し、open-git への HTTPS アクセスを構成する方法を説明します。

## 基本構成

```yaml
# TODO: Traefik ルーター設定例
```

TLS 証明書の自動取得 (Let's Encrypt) やパスベースルーティングの詳細は今後追加予定です。
2 changes: 2 additions & 0 deletions docs/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Allow: /
Loading