Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Nextra のサポート #13

Merged
merged 7 commits into from
Dec 19, 2023
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
10 changes: 10 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends:
- 'next/core-web-vitals'
plugins:
- '@typescript-eslint'
rules:
'max-params': 'error'
env:
es2021: true
node: true
ignorePatterns: ["src/pages/**/*.mdx"]
34 changes: 15 additions & 19 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# コントリビュートガイド (編集中)
# コントリビュートガイド

## 主な流れ

Expand All @@ -14,25 +14,21 @@
10. `cmd.seichi.click` にデプロイされる
- デプロイは自動で行われます。

## リファレンスの構成

```text
.github /
- CODEOWNERS -- 特定のファイルに対してレビュワーを強制的に指定するファイル (本来外部貢献者が編集する必要はありません。)
- CONTRIBUTING.md -- コントリビュートに関するガイド (本来外部貢献者が編集する必要はありません。)
.docs /
- CNAME -- GitHub Pages で使用するドメインを指定するファイル (本来外部貢献者が編集する必要はありません。)
player / -- プレイヤー関連のコマンドリファレンス
- general-command.md -- プレイヤーが使用できる全てのコマンドリファレンスを記述するファイル (cmd.seichi.click/player-command)
- towny-command.md -- プレイヤーが使用できるTownyのコマンドリファレンスを記述するファイル (cmd.seichi.click/towny-command)
- README.md (cmd.seichi.click)
--- (以下略)
```
## 開発環境の構築

CommandReference は以下の環境で動作します。

## 使用するエディターについて
- Node.js v18.x , v20.x
- pnpm v8.x
- Next.js v14.x

`CommandReference` を編集する際は [Visual Studio Code](https://code.visualstudio.com/), 拡張機能 [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) の使用を推奨します。
```shell
# 依存関係をインストールする
pnpm install

コマンドリファレンスの初めは目次で構成されています。この目次は Visual Studio Code の機能で自動生成されているため新しく目次を追加すると自動で更新されます。(Visual Studio Code を使用せず、Vim などのエディタを使用している際は手動で編集してください。)
# 開発サーバーでの起動
pnpm dev

![コマンドリファレンスの目次](./image/table-of-contents.png)
# ビルド
pnpm build
```
Binary file removed .github/image/table-of-contents.png
Binary file not shown.
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: build

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
node-version: 18
pnpm-version: latest

jobs:
run-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: ${{ env.pnpm-version }}
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- uses: actions/cache@v3
name: Setup Next.js cache
with:
path: |
~/.npm
${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.[jt]s', '**/*.[jt]sx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
run: pnpm i --no-frozen-lockfile

- name: Build
run: pnpm run build
55 changes: 55 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: deploy

on:
push:
branches: ["main"]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 8

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "out"
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
49 changes: 49 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: eslint

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
node-version: 18
pnpm-version: latest

jobs:
run-eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: ${{ env.pnpm-version }}
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm i --no-frozen-lockfile

- name: Run eslint
run: pnpm run lint
49 changes: 49 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: prettier

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
node-version: 18
pnpm-version: latest

jobs:
run-prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: ${{ env.pnpm-version }}
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm i --frozen-lockfile

- name: Run prettier
run: pnpm run check
Loading