runtime.star¶
Set language versions in version files: .nvmrc, .python-version, .tool-versions and friends.
| Function | What it does |
|---|---|
version |
Reads the version a repo pins for a runtime. |
set_version |
Sets a runtime's version in every version file the repo already has. |
version¶
Reads the version a repo pins for a runtime.
Dedicated files such as .nvmrc are read before .tool-versions.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
runtime |
One of node, python, ruby, go, java, terraform, elixir, erlang or rust. |
Returns: The version as written, or None when nothing pins it.
Example
set_version¶
Sets a runtime's version in every version file the repo already has.
A newer version already pinned is kept, and so are aliases such as lts/*.
Updates the dedicated files (.nvmrc and .node-version for node,
.python-version for python, and so on) and the runtime's line in
.tool-versions. A repo that pins the runtime nowhere is left alone unless
create is set.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
runtime |
One of node, python, ruby, go, java, terraform, elixir, erlang or rust. |
version |
The version to pin, such as 22 or 3.12.7. |
create |
A file to write, such as .nvmrc, when nothing pins the runtime yet. |
Returns: The list of paths that changed.
Example
Used in: elixir-phoenix, node-version, python-version