Skip to content

Using Binary Packages

A binary package is a package that contains a binary export.

Binary packages can be run like a normal program. There are several ways to use binary packages with pesde.

Using a binary package

With pesde x

The pesde x command can be used to run a one-off binary package. This is useful for running a binary package without installing it or outside of a pesde project.

Terminal window
pesde x pesde/hello
# Hello, pesde! (pesde/[email protected], lune)

By installing

Binary packages can be installed using the pesde add and pesde install commands.

This requires a pesde.toml file to be present in the current directory, and will add the binary package to the dependencies section of the file.

Terminal window
pesde add pesde/hello
pesde install

This will add the binary package to your PATH, meaning that it can be run anywhere in a project which has it installed under that alias!

Terminal window
hello
# Hello, pesde! (pesde/[email protected], lune)

Note that they are scoped to the nearest pesde.toml file. However, you can use binaries of the workspace root from member packages.

Making a binary package

To make a binary package you must use a target compatible with binary exports. These currently are lune and luau.

Here is an example of a binary package:

pesde.toml
name = "pesde/hello"
version = "1.0.0"
license = "MIT"
[target]
environment = "lune"
bin = "main.luau"

The bin field specifies the entry point for the binary package. This file will be run when the binary package is executed.

main.luau
print("Hello, pesde!")

Binary packages get access to custom variables provided by pesde. You can find them in the _G table. These are:

  • PESDE_ROOT: The root (where the pesde.toml is located) of where the package is installed. This will be in a temporary directory if the package is run with pesde x.