The lecodes CLI
The browser editor covers the whole loop, but at some point you want your own editor, your own git
and your own tooling. The lecodes command brings a project to your machine: local development
with full IntelliSense, hot reload on a phone, in a browser and in a desktop window, checks that
need no device, native builds for the stores, and one-command sync with the platform.
This section is written for people. Every command and flag is in lecodes --help and
lecodes <command> --help, which are always current.
Install the CLI
The CLI is the npm package lecodes-cli (Node 18 or newer); the command it installs is lecodes:
npm i -g lecodes-cli # then: lecodes <command>
npx lecodes-cli <command> # or without installingNo Node on the machine? Take the standalone build from the Downloads
page: unpack the archive and run ./lecodes install — it copies the bundle to a library folder and
prints how to put lecodes on your PATH (--modify-path does it for you).
Some commands live in separate packages that the CLI installs on first use into
~/.lecodes/peers, after asking (--yes or LECODES_YES=1 answers for you):
| package | needed by |
|---|---|
lecodes-headless | render, test |
lecodes-design | design |
lecodes-3d-editor | scene, thumbs |
lecodes-assets | assets |
The standalone build resolves no npm packages, so these commands need the npm install.
lecodes --version also prints the version of each optional package and where it came from — the first thing to read when a command says something is missing.
Start: two kinds of project
A project root is the folder with app.json or .lecodes/ in it. There are two ways to get one:
lecodes init myapp # a LOCAL project: no account, no server
lecodes clone <uuid-or-url> myapp # a project that lives on le.codesA local project runs, renders, tests and builds without a login
(Run a project locally). It joins the platform when you decide, with
lecodes link (Work with the platform).
Find a command
lecodes --help lists the commands in six groups:
| group | commands | page |
|---|---|---|
| Project | init create clone link status diff pull push publish releases secrets login hub | Run a project locally, Work with the platform |
| Run & test | dev web compile render test call drive desktop serve analytics | Run a project locally, Render and test |
| Editors | design scene thumbs | Editors and content |
| Content | assets shaders level lightmap navmesh | Editors and content |
| Native apps | app plugin pn | Native apps, Write a native plugin |
| Maintenance | update install | below |
A misspelt command suggests the nearest one. A failure is a non-zero exit code with a one-line
message; the result of a command goes to stdout and its progress to stderr, so `lecodes compile >
app.js and lecodes render -o ui.json` are safe to pipe.
Keep settings in the project's .env
A .env file next to app.json holds the CLI's settings and the project's keys. It is loaded by
every lecodes run and never pushed:
# .env
LECODES_DESKTOP_EXE=./tools/lecodes-desktop.exe # a desktop host of your own build
STRIPE_KEY=sk_test_… # a key the server code reads as env.STRIPE_KEYLECODES_*andCREATOR_*names are the CLI's own settings; any other capital name is a key of the app.- A variable already set in the shell wins over the file.
- A
./relativevalue resolves against the file's folder.
Keys reach le.codes with lecodes secrets (Work with the platform).
Pick the entry point
The app starts from main.ts. Without one, the entry is the file that nothing imports. `--entry
<file> on dev, compile, render, test, desktop run` and the builds names it outright —
how one project carries a game and its level editor.
When several files qualify and none is main.ts, render and test stop and name them; dev and
compile warn and go on.
Move everything to the newest versions: lecodes update
lecodes update # the CLI, the desktop host, the shaders, the types, the shells, the peers
lecodes update --check # report what is behind, install nothingOne command, in dependency order: the CLI itself, the desktop host, the shader compiler and the
project's compiled shaders, the editor types in .lecodes/types/, the pins of the ios/ and
android/ shells, then every installed optional package. A tool you pinned to a local build
(LECODES_DESKTOP_EXE) is skipped, not replaced. A step that fails does not stop the rest; the
summary says which one did.
Pages of this section
- Run a project locally —
init,devon a phone, in a browser, in a window;compile;web - Work with the platform —
login,clone,push,publish, releases, keys - Render and test —
render, flow tests withtest, a phone driven from the terminal - Native apps — iOS and Android shells, the desktop build, first-party plugins
- Editors and content — the design board, the scene editor, models, shaders, baking
- Write a native plugin — a capability of your own on iOS, Android and the web
- The plugin contract — everything
contract.d.tscan say - The plugin manifest — everything
lecodes-plugin.jsoncan say - Desktop plugins — a
.dllor.sonext to the app