lpm is a package manager for Lua, written in Lua.
It was created due to my frustration with the current status quo of package management in the Lua ecosystem.
- LuaRocks is sorely dated, difficult to manage, and hardly maintained.
- Lux, while promising, is written in Rust and seems to be targeting backwards compatibility with LuaRocks.
A more in-depth comparison can be found below.
- Easy project creation with
lpm newandlpm init - Automatic local package management, avoid conflicting global installs
lpm add --path <package>- Install local dependencies (good for monorepos)lpm add --git <repo>- Install git dependencies (supports monorepos)lpm run- Runs your project's init file and installs dependencieslpm compile- Turn your project into a single executable, easily distributablelpm test- Run project tests with the built-in test framework,lpm-testlpm bundle- Bundle your project into a single lua filelpm x- Execute a project in another location, perfect for CLIslpm tree- View your dependencies at a glance
| OS | Command |
|---|---|
| Linux | curl -fsSL https://raw.githubusercontent.com/codebycruz/lpm/master/install.sh | sh |
| Windows | irm https://raw.githubusercontent.com/codebycruz/lpm/master/install.ps1 | iex |
To upgrade your lpm version, simply run lpm upgrade!
Create a project with dependencies..
lpm new myproject && cd myproject
lpm add hood --git https://github.com/codebycruz/hood
echo "print(require('hood'))" > ./src/init.lua
lpm run
# Output: table: 0x7f53326fd030Or run a repository's code in a single command!
lpm x triangle --git https://github.com/codebycruz/hoodI made this to the best of my ability with limited information about LuaRocks and Lux.
If anyone has any corrections, please do submit a pull request.
| lpm | lux | luarocks | |
|---|---|---|---|
| Written in | Lua | Rust | Teal |
| Project format | JSON | TOML/Lua | Lua |
| Add/remove deps | ✓ | ✓ | ❌ |
| Built-in test runner | ✓ (lpm-test) | ✓ (busted) | ❌ |
| Comes with luajit | ✓ | ❌ | ❌ |
| Lua version manager | ❌ | ✓ | ❌ |
| Compile to executable | ✓ | ❌ | ❌ |
| Git deps | ✓ | ✓ | ❌ |
| Registry deps | ❌ (#4) | ✓ (luarocks) | ✓ (luarocks) |
| Rockspec support | ❌ | ✓ | ✓ |
| Proper Lockfile Support | ❌ | ✓ | ❌ |
| Lua build scripts | build.lua | rockspec | rockspec |