コンテンツへスキップ

手動インストール

このガイドでは、既存のプロジェクトに手動で Lunaria をインストールおよび設定する手順を説明します。

1. @lunariajs/core パッケージの追加

Lunaria は npm レジストリ上の @lunariajs/core パッケージとして公開されています。プロジェクトのルートディレクトリで以下のコマンドを実行して、プロジェクトに追加してください:

ターミナルウィンドウ
npm install @lunariajs/core

次に、package.jsonscripts フィールドに以下の lunaria コマンドを追加してください:

package.json
"scripts": {
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"lunaria:build": "lunaria build",
"lunaria:preview": "lunaria preview",
}

2. lunaria.config.json の作成

Lunaria は lunaria.config.json で構成されます。このファイルは必須であり、Lunaria がリポジトリの構造とトラッキング対象を認識するために必要です。

lunaria.config.json
{
"$schema": "./node_modules/@lunariajs/core/config.schema.json"
}

3. パッケージの設定

初めてのローカライゼーションダッシュボードを生成する前に、lunaria.config.json ファイルの repositorydefaultLocalelocales フィールドを設定する必要があります。

以下の例では、サンプルプロジェクトにおいて英語およびポルトガル語のマークダウン/MDX コンテンツを https://github.com/me/cool-project/ 上でホストしている状況を想定し、Lunaria の設定を行っています:

lunaria.config.json
{
"$schema": "./node_modules/@lunariajs/core/config.schema.json",
"repository": {
"name": "me/cool-docs"
},
"files": [
{
"location": "content/**/*.md",
"pattern": "content/@lang/@path",
"type": "universal"
}
],
"defaultLocale": {
"label": "English",
"lang": "en"
},
"locales": [
{
"label": "Português",
"lang": "pt"
}
]
}

利用可能なすべてのオプションについて詳しく知りたい場合は、構成リファレンスガイド をご確認ください。

4. 次のステップ

成功しました!これでプロジェクトで Lunaria を使い始めることができます!

このガイドを完全に完了した場合、最初のダッシュボードをビルドする に進み、ローカライゼーションダッシュボードの生成方法、ブラウザでの表示方法、および推奨される次のステップを学ぶことができます。