Skip to content

yaoxiang.toml フォーマット

yaoxiang.toml はYaoXiangプロジェクトのマニフェストファイルであり、プロジェクトメタデータと依存関係を宣言します。

ファイル構造

toml
[package]
name = "プロジェクト名"
version = "0.1.0"
description = "プロジェクト説明"
authors = ["著者名"]
license = "MIT"

[dependencies]
# 通常依存関係

[dev-dependencies]
# 開発依存関係

package 部分

フィールドタイプ必須説明
namestringプロジェクト名、命名規則に準拠(小文字、数字、ハイフン)
versionstringセマンティックバージョニング、semver仕様に準拠
descriptionstringいいえプロジェクト簡略説明
authorsarrayいいえ著者リスト
licensestringいいえライセンス識別子

toml
[package]
name = "my-awesome-app"
version = "1.2.3"
description = "素晴らしいアプリケーション"
authors = ["三人 <zhangsan@example.com>"]
license = "MIT"

依存関係の宣言

シンプルバージョン

toml
[dependencies]
http = "1.0.0"
json = "*"

詳細設定

toml
[dependencies]
# Git 依存関係
http = { version = "1.0.0", git = "https://github.com/example/http" }

# ローカルパス依存関係
utils = { version = "0.1.0", path = "./utils" }

# ブランチ付き Git 依存関係
bleeding-edge = { git = "https://github.com/example/edge", branch = "main" }

依存関係フィールドの説明

フィールドタイプ説明
versionstringバージョン番号
gitstringGitリポジトリ
branchstringGitブランチ
pathstringローカルパス

バージョン番号の構文

構文説明
*任意バージョン"*"
1.0.0正確バージョン"1.0.0"
>=1.0.0最低バージョン">=1.0.0"
<2.0.0最高バージョン"<2.0.0"
>=1.0.0, <2.0.0範囲バージョン">=1.0.0, <2.0.0"
~1.0.0互換バージョン"~1.0.0"
^1.0.0caret バージョン"^1.0.0"

完全な例

toml
[package]
name = "web-server"
version = "0.1.0"
description = "シンプルなWebサーバー"
authors = ["開発者 <dev@example.com>"]
license = "MIT"

[dependencies]
http = "1.0.0"
json = "2.0.0"
router = { version = "0.5.0", path = "./router" }

[dev-dependencies]
test-utils = "1.0.0"
benchmark = "0.1.0"