Dependencies
Import another Balaur project whole into deps/<alias>/: kept on Forge and pinned by project.lock, or a folder on this machine. Its paths read from its own root.
On this page
A dependency is another Balaur project, imported whole into
deps/<alias>/. Its scenes, scripts, textures, fonts and sounds are the
game's to use and not to change.
# project.toml
[dependencies]
ui_kit = { project = "dragos/ui-kit", branch = "main" }
fonts = { project = "ana/fonts", tag = "v2" }
stash = { path = "../stash" }
- The key is the alias: the folder name and the
usepath,[a-z][a-z0-9]*(_[a-z0-9]+)*. Two projects named alike import side by side under two aliases. projectisowner/nameon Forge. Abranchfollows, atagpins, and neither follows the project's default branch.pathis a folder on this machine, served underdeps/<alias>/as it is. No symlink, no copy, no lock.
Adding one
balaur add dragos/ui-kit # alias ui_kit, default branch
balaur add ana/fonts --tag v2
balaur add ../stash --as stash # a folder
balaur fetch # fill deps/ from project.lock
balaur fetch --update # newest commit of each branch or tag
balaur addwrites the entry, comments kept, and fetches it.project.lockrecords each Forge dependency's project id, commit and a sha256 of its files. Commit it.deps/is not committed:balaur newandbalaur addput/deps/in.gitignore.- A fetch whose files do not match the lock is refused and writes nothing.
- Fetched blobs are kept once under the editor's data folder, so every game on one dependency shares one download.
BALAUR_FORGEnames the Forge to ask;BALAUR_FORGE_TOKENis a personal API token for a private project.- From the editor: the Library's On Forge kind adds one with a click; the project manager's On Forge tab opens a copy of one.
Paths
A dependency's files name each other from its own root.
deps/ui_kit/scenes/panel.tomlnamingart/button.pngdrawsdeps/ui_kit/art/button.png, whatever the game keeps atart/.- The game names the same file
deps/ui_kit/art/button.png. - A relative path a dependency's script builds, such as
assets::load("art/hit.png"), reads under its own folder. useinside a dependency stops at its folder, so it never links a game module of the same name. The game reaches one withuse deps::ui_kit::scripts::button;.- The dependency's
application/ignoreand[import.<kind>]defaults cover its own files. Its window, plugins and main scene are the game's to decide.
Read-only
fs.*,assets::saveand a scene save refuse a path underdeps/.- A scene from a dependency is a prefab: place it with
instance = "deps/ui_kit/scenes/panel.toml"and change it throughoverrides. An update reaches the instance and the overrides stay. - Make local in Assets copies a file into the game and points the game's references at the copy. The copy never updates.
- Edit dependency opens a
pathdependency's folder in a second editor, or a Forge one's page. - Move to project moves the game's files into a
pathdependency and points the game atdeps/<alias>/: a shelf for assets kept for later.
Export
- An export pack ships each dependency under
deps/<alias>/, its documents rewritten to the game's spelling. - What nothing names under
deps/is dropped, whatever[export] stripsays. The dependency's own[export] includeglobs keep what its scripts build. deps/credits.jsonlists each dependency's alias, project, commit and[application] license, for a credits screen.
Script API
| Function | Does |
|---|---|
dependency::list() |
Every installed dependency: alias, folder, kind, project, branch, tag, path, rev, license |
dependency::of(path) |
The alias a path lies in, or nil |
dependency::make_local(from, to) |
Make local |
dependency::move_into(paths, alias) |
Move to project |
dependency::add_path(game, alias, path) |
Declare a path dependency and install it |
dependency::install(game) |
Read [dependencies] again and install each |
Not yet
- A dependency with dependencies of its own.
- Native or wasm extensions inside a dependency.
- Dependencies kept on GitHub; a Forge-kept project is the only source today.