AWS Amplify 公式ドキュメントを日本語化して配信するためのリポジトリです。
このリポジトリは、翻訳済みの差分と生成済み静的ファイルを持つ wrapper です。本家ドキュメントのソースコードは Git submodule として upstream/ に取得します。
.
├── docs/ # 生成済みの静的サイト
├── scripts/ # 翻訳・ビルド補助スクリプト
├── src/ # 日本語化したページ・コンポーネントの差分
└── upstream/ # 本家 aws-amplify/docs の submodule
- Git
- Node.js 20 以上 22 未満
- Corepack / Yarn
- Python 3
upstream は本家リポジトリの前提に合わせて Node.js 20 系を使ってください。
git clone git@github.com:aws-amplify-jp/docs.git
cd docs
git submodule update --init --recursiveHTTPS で clone する場合:
git clone https://github.com/aws-amplify-jp/docs.git
cd docs
git submodule update --init --recursiveupstream/ に本家 aws-amplify/docs のコードが入っていれば取得完了です。
git submodule status --recursive
ls upstreamこのリポジトリには docs/ に生成済みの静的サイトが入っています。
重要: docs/index.html は /docs/_next/... のようなパスでアセットを参照します。そのため docs/ ディレクトリ単体ではなく、リポジトリ root を静的配信して /docs/ にアクセスします。
リポジトリ root でサーバーを起動します。
python3 -m http.server 4173 --bind 127.0.0.1ブラウザで開く URL:
http://127.0.0.1:4173/docs/
ポートが使用中の場合:
lsof -nP -iTCP:4173 -sTCP:LISTEN別ポートで起動する場合:
python3 -m http.server 5173 --bind 127.0.0.1この場合は http://127.0.0.1:5173/docs/ を開きます。
upstream の Next.js アプリをビルドする場合は、先に依存関係を入れます。
corepack enable
npm run submodule:install直接実行する場合:
cd upstream
yarn install翻訳スクリプトは upstream/src/pages の MDX を読み、src/pages に出力します。
.env.example を参考に .env を作成し、Anthropic API key を設定します。
cp .env.example .envANTHROPIC_API_KEY=your-api-key-here翻訳 API の概算費用を確認する場合:
npm run submodule:translate:dryこの dry-run は翻訳ファイルを書き込まず、推定 input/output tokens と Est. cost (Haiku) を出力します。実際の費用は使用モデルやキャッシュ状況で変わるため、あくまで目安として確認してください。
翻訳を実行する場合:
npm run submodule:translate特定ファイルだけ翻訳したい場合:
node --env-file=.env scripts/translate.mjs --file upstream/src/pages/[path]/index.mdxsrc/pages と src/components の差分を upstream に反映し、upstream の Next.js build を実行します。
npm run submodule:buildこのコマンドでは次を行います。
src/pages/をupstream/src/pages/にコピーsrc/components/をupstream/src/components/にコピーupstream/next.config.mjsをローカル配信用に patchupstreamでyarn build
ビルド結果はリポジトリ root の docs/ に出力されます。
本家の最新変更を取り込む場合:
npm run submodule:update更新後は必要に応じて翻訳・ビルドを実行してください。
npm run submodule:translate:dry
npm run submodule:translate
npm run submodule:build指定ポートを別プロセスが使っています。
lsof -nP -iTCP:4173 -sTCP:LISTEN不要なプロセスであれば停止するか、別ポートで起動してください。
docs/ ディレクトリを直接配信している可能性があります。リポジトリ root でサーバーを起動し、/docs/ にアクセスしてください。
python3 -m http.server 4173 --bind 127.0.0.1http://127.0.0.1:4173/docs/
submodule が未取得です。
git submodule update --init --recursiveCorepack を有効化してください。
corepack enable| コマンド | 内容 |
|---|---|
npm run submodule:init |
upstream submodule を取得 |
npm run submodule:update |
upstream を本家の最新に更新 |
npm run submodule:install |
upstream の依存関係を install |
npm run submodule:translate:dry |
翻訳 API の概算費用を確認 |
npm run submodule:translate |
翻訳を実行 |
npm run submodule:build |
日本語差分を反映して静的サイトを build |
npm run serve |
生成済み docs/ を静的配信 |
npm run serve は docs/ ディレクトリを直接配信します。アセットパス確認まで含めたローカル確認では、上記の Python サーバー手順を推奨します。