Skip to content

yaoxiang.toml Format

yaoxiang.toml is the manifest file for YaoXiang projects, declaring project metadata and dependencies.

File Structure

toml
[package]
name = "项目名称"
version = "0.1.0"
description = "项目描述"
authors = ["作者名"]
license = "MIT"

[dependencies]
# 普通依赖

[dev-dependencies]
# 开发依赖

package Section

FieldTypeRequiredDescription
namestringYesProject name, must follow naming conventions (lowercase, digits, hyphens)
versionstringYesSemantic version number, follows semver specification
descriptionstringNoShort project description
authorsarrayNoList of authors
licensestringNoLicense identifier

Example

toml
[package]
name = "my-awesome-app"
version = "1.2.3"
description = "一个很棒的应用"
authors = ["张三 <zhangsan@example.com>"]
license = "MIT"

Dependency Declaration

Simple Version

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

Detailed Configuration

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

# Local path dependency
utils = { version = "0.1.0", path = "./utils" }

# Git dependency with branch
bleeding-edge = { git = "https://github.com/example/edge", branch = "main" }

Dependency Field Reference

FieldTypeDescription
versionstringVersion number or range
gitstringGit repository address
branchstringGit branch name
pathstringLocal relative path

Version Number Syntax

SyntaxDescriptionExample
*Any version"*"
1.0.0Exact version"1.0.0"
>=1.0.0Minimum version">=1.0.0"
<2.0.0Maximum version"<2.0.0"
>=1.0.0, <2.0.0Range version">=1.0.0, <2.0.0"
~1.0.0Compatible version"~1.0.0"
^1.0.0Caret version"^1.0.0"

Complete Example

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"