|
| 1 | +# The Manifest Format |
| 2 | + |
| 3 | +The `Scarb.toml` file, present in each package, is called its _manifest_. |
| 4 | +It is written in the [TOML](https://toml.io/) format. |
| 5 | +It contains metadata that is needed to compile the package. |
| 6 | +It has to be placed in the root of your project. |
| 7 | +Use the `scarb manifest-path{:shell}` command to locate the manifest used in current directory. |
| 8 | + |
| 9 | +Every manifest file consists of the following sections: |
| 10 | + |
| 11 | +## `[package]` |
| 12 | + |
| 13 | +The first section in a `Scarb.toml` is `[package]{:toml}`. |
| 14 | + |
| 15 | +```toml copy filename="Scarb.toml" |
| 16 | +[package] |
| 17 | +name = "hello_world" # the name of the package |
| 18 | +version = "0.1.0" # the current version, obeying semver |
| 19 | + |
| 20 | +``` |
| 21 | + |
| 22 | +The only required fields are [`name`](#name) and [`version`](#version). |
| 23 | + |
| 24 | +### `name` |
| 25 | + |
| 26 | +The package name is an identifier used to refer to the package. |
| 27 | +It is used when listed as a dependency in another package, and as the default name of targets. |
| 28 | + |
| 29 | +The name must use only ASCII alphanumeric characters or `_`, and cannot be empty. |
| 30 | +It cannot also start with underscore. |
| 31 | + |
| 32 | +In other words, it must match the following regular expression: |
| 33 | + |
| 34 | +``` |
| 35 | +^[a-zA-Z0-9][a-zA-Z0-9_]+$ |
| 36 | +``` |
| 37 | + |
| 38 | +### `version` |
| 39 | + |
| 40 | +Scarb bakes in the concept of [Semantic Versioning](https://semver.org/), so make sure you follow some basic rules: |
| 41 | + |
| 42 | +1. Before you reach 1.0.0, anything goes, but if you make breaking changes, increment the minor version. |
| 43 | +2. After 1.0.0, only make breaking changes when you increment the major version. |
| 44 | + Do not break the build. |
| 45 | +3. After 1.0.0, don’t add any new public API in patch-level versions. |
| 46 | + Always increment the minor version if you add any new public structs, traits, fields, types, functions, methods, impls or anything else. |
| 47 | +4. Use version numbers with three numeric parts such as 1.0.0 rather than 1.0. |
| 48 | + |
| 49 | +### `authors` |
| 50 | + |
| 51 | +This optional field lists the people or organizations that are considered the "authors" of the package. |
| 52 | +The exact meaning is open to interpretation - it may list the original primary authors, current maintainers, or owners of the package. |
| 53 | +An optional email address may be included within angled brackets at the end of each author entry. |
| 54 | + |
| 55 | +```toml |
| 56 | +[package] |
| 57 | +authors = [ "Software Mansion <[email protected]>", "Starkware"] |
| 58 | +``` |
| 59 | + |
| 60 | +### `description` |
| 61 | + |
| 62 | +The description is a short blurb about the package. |
| 63 | +Package registries or indexers may display it with your package, some registries may even require it. |
| 64 | +This should be plain text (not Markdown). |
| 65 | + |
| 66 | +```toml |
| 67 | +[package] |
| 68 | +description = "A short description of my package." |
| 69 | +``` |
| 70 | + |
| 71 | +### `documentation` |
| 72 | + |
| 73 | +This field specifies a URL to a website hosting the crate's documentation. |
| 74 | + |
| 75 | +```toml |
| 76 | +[package] |
| 77 | +documentation = "https://john.github.io/cairo-package" |
| 78 | +``` |
| 79 | + |
| 80 | +### `readme` |
| 81 | + |
| 82 | +This field should be the path to a file in the package root (relative to this `Scarb.toml`) that contains general information about the package. |
| 83 | + |
| 84 | +```toml |
| 85 | +[package] |
| 86 | +readme = "README.md |
| 87 | +``` |
| 88 | +
|
| 89 | +### `homepage` |
| 90 | +
|
| 91 | +This field should be a URL to a site that is the home page for your package. |
| 92 | +
|
| 93 | +```toml |
| 94 | +[package] |
| 95 | +homepage = "https://example.com/" |
| 96 | +``` |
| 97 | + |
| 98 | +### `repository` |
| 99 | + |
| 100 | +This field should be a URL to the source repository for your package. |
| 101 | + |
| 102 | +```toml |
| 103 | +[package] |
| 104 | +repository = "https://github.com/software-mansion/scarb" |
| 105 | +``` |
| 106 | + |
| 107 | +### `license` and `license-file` |
| 108 | + |
| 109 | +The `license` field contains the name of the software license that the package is released under. |
| 110 | +The `license-file` field contains the path to a file containing the text of the license (relative to this `Scarb.toml`). |
| 111 | + |
| 112 | +Package registries must interpret the `license` field as an [SPDX 2 license expression](https://spdx.github.io/spdx-spec/v2.3/SPDX-license-expressions/). |
| 113 | +The license name must be a known license from the [SPDX license list](https://spdx.org/licenses/). |
| 114 | + |
| 115 | +SPDX license expressions support AND and OR operators to combine multiple licenses. |
| 116 | + |
| 117 | +```toml |
| 118 | +[package] |
| 119 | +license = "MIT OR Apache-2.0" |
| 120 | +``` |
| 121 | + |
| 122 | +Using `OR` indicates the user may choose either license. |
| 123 | +Using `AND` indicates the user must comply with both licenses simultaneously. |
| 124 | +The `WITH` operator indicates a license with a special exception. |
| 125 | +Some examples: |
| 126 | + |
| 127 | +- `MIT OR Apache-2.0` |
| 128 | +- `LGPL-2.1-only AND MIT AND BSD-2-Clause` |
| 129 | +- `GPL-2.0-or-later WITH Bison-exception-2.2` |
| 130 | + |
| 131 | +If a package is using a nonstandard license, then the `license-file` field may be specified instead of the `license` field. |
| 132 | + |
| 133 | +```toml |
| 134 | +[package] |
| 135 | +license-file = "LICENSE.txt" |
| 136 | +``` |
| 137 | + |
| 138 | +### `keywords` |
| 139 | + |
| 140 | +This field is an array of strings that describe your package. |
| 141 | +This can help when searching for the package on a registry, and it is allowed to choose any words that would help someone find this package. |
| 142 | + |
| 143 | +```toml |
| 144 | +[package] |
| 145 | +keywords = ["account", "wallet", "erc-20"] |
| 146 | +``` |
| 147 | + |
| 148 | +It is recommended that keywords are ASCII text, starting with a letter and only containing letters, numbers and `-`. |
| 149 | +Additionally, keywords should have at most 20 characters, and single package should not provide more than 5 keywords. |
| 150 | + |
| 151 | +### `urls` |
| 152 | + |
| 153 | +This field is a map of additional internet links related to this package. |
| 154 | +Keys are human-readable link names, and values are URLs. |
| 155 | + |
| 156 | +```toml |
| 157 | +[package.urls] |
| 158 | +"We can help you build your project" = "https://swmansion.com/services/" |
| 159 | +"We're hiring" = "https://swmansion.com/careers/" |
| 160 | +``` |
| 161 | + |
| 162 | +## `[dependencies]` |
| 163 | + |
| 164 | +See [Specifying Dependencies](./specifying-dependencies) page. |
| 165 | + |
| 166 | +## Target tables: `[lib]` and `[[target]]` |
| 167 | + |
| 168 | +See [Targets](./targets) page. |
0 commit comments