Skip to content

Commit 5327369

Browse files
chore: Dev containerの更新 (#151)
Signed-off-by: Shunsuke Kimura <[email protected]> Co-authored-by: 3w36zj6 <[email protected]>
1 parent 77be7fd commit 5327369

File tree

7 files changed

+35
-78
lines changed

7 files changed

+35
-78
lines changed

.devcontainer/Dockerfile

Lines changed: 0 additions & 26 deletions
This file was deleted.

.devcontainer/README.md

Lines changed: 0 additions & 35 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "typst-jp-documentation",
3-
"build": {
4-
"dockerfile": "Dockerfile",
5-
"context": ".."
3+
"image": "mcr.microsoft.com/devcontainers/base:bookworm",
4+
"features": {
5+
"ghcr.io/devcontainers-extra/features/mise:1": {}
66
},
7-
"remoteUser": "typst-jp",
8-
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached",
9-
"workspaceFolder": "/workspace",
10-
"postCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
11-
"postStartCommand": "bun install --frozen-lockfile && cargo test --package typst-docs --lib -- tests::test_docs --exact --nocapture && python3 ./gen.py && python3 -m http.server -d dist"
7+
"onCreateCommand": "echo 'eval \"$(mise activate bash)\"' >> ~/.bashrc && mise trust && mise install",
8+
"postStartCommand": "mise run generate && mise run dev",
9+
"remoteEnv": {
10+
"VITE_LISTEN_ALL_ADDRESSES": "true" // See /website/.env.example
11+
}
1212
}

.vscode/tasks.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5-
"label": "generate-docs",
5+
"label": "generate",
66
"type": "shell",
7-
"command": "cargo test --package typst-docs --lib -- tests::test_docs --exact --nocapture && python3 ./gen.py && echo reload or open http://localhost:8000",
7+
"command": "mise run generate",
88
"problemMatcher": [],
99
"group": {
1010
"kind": "build",
@@ -14,19 +14,19 @@
1414
{
1515
"label": "textlint-md",
1616
"type": "shell",
17-
"command": "bun run textlint-md",
17+
"command": "mise run textlint-md",
1818
"problemMatcher": []
1919
},
2020
{
2121
"label": "textlint-md:fix",
2222
"type": "shell",
23-
"command": "bun run textlint-md:fix",
23+
"command": "mise run textlint-md:fix",
2424
"problemMatcher": []
2525
},
2626
{
2727
"label": "textlint-html",
2828
"type": "shell",
29-
"command": "bun run textlint-html",
29+
"command": "mise run textlint-html",
3030
"problemMatcher": []
3131
}
3232
]

CONTRIBUTING.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Typst日本語ドキュメント翻訳プロジェクトにご興味をお持ち
4040

4141
また、当プロジェクトが独自に導入しているRustを除く開発ツールおよびコマンドは[mise](https://mise.jdx.dev/)で一元管理しています。導入していない場合は、[Getting Started | mise-en-place](https://mise.jdx.dev/getting-started.html)に従ってインストールしてください。
4242

43+
Dockerで作業したい方へ向けて、[Dev Containerの環境](#dev-containerを用いた方法)もご用意しております。
44+
4345
#### TL;DR
4446

4547
> [!NOTE]
@@ -123,9 +125,21 @@ mise run preview
123125
mise run generate
124126
```
125127

126-
#### Dev Containerについて
128+
#### Dev Containerによる開発環境のセットアップ
127129

128-
> [!WARNING]
129-
> Dev Containerは現在miseに対応していません。そのため、Dev Containerを使用する場合は、`.mise.toml`を参考に手動で上記の手順を実行してください。
130+
[Docker](https://docs.docker.com/)コンテナー上に上記と同一の環境を構築して作業することも可能です。
131+
以下の操作はDockerがインストール済み、かつDockerデーモンを起動していることが前提となります。
132+
このプロジェクトでは[Dev Container](https://code.visualstudio.com/docs/devcontainers/containers)もご使用いただけます。
133+
Visual Studio Codeにおける操作フロー例は以下の通りです。
134+
135+
1. Ctrl+Shift+Pを押してから`> Dev Containers: Reopen in Container`を実行します。
136+
2. Webサーバーが起動したらブラウザで http://localhost:5173 にアクセスします。
137+
3. 翻訳したファイルの変更を反映させるためにはCtrl+Shift+Bで再ビルドしてください。
138+
4. 体裁を確認したい場合、Ctrl+Shift+Pを押してから`> Tasks: Run task`を実行し以下のいずれかを選択します。
139+
- `textlint-md` : Markdownファイルを翻訳した場合
140+
- `textlint-html` : Rustソースコードを翻訳した場合
141+
5. 自動修正を実施したい場合も同様に以下から選択します。
142+
- `textlint-md:fix` : Markdownファイルを自動修正します。
143+
- Rustコードの自動修正は対応していなため、該当箇所を手動で修正してください。
130144

131-
上記のローカル環境を構築するDockerfileも整備しております。詳細は[.devcontainer/README.md](.devcontainer/README.md)をご参照ください
145+
`> Tasks: Run task`はDocker環境でなく、miseで環境構築した際にも使用できます

website/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_LISTEN_ALL_ADDRESSES=true # 開発用にViteが全てのアドレスでlistenするかどうか

website/vite.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,7 @@ export default defineConfig({
3030
},
3131
},
3232
},
33+
server: {
34+
host: process.env.VITE_LISTEN_ALL_ADDRESSES === 'true'
35+
},
3336
});

0 commit comments

Comments
 (0)