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:

bash
npm i -g lecodes-cli        # then: lecodes <command>
npx lecodes-cli <command>   # or without installing

No 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):

packageneeded by
lecodes-headlessrender, test
lecodes-designdesign
lecodes-3d-editorscene, thumbs
lecodes-assetsassets

The standalone build resolves no npm packages, so these commands need the npm install.

Note

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:

bash
lecodes init myapp                    # a LOCAL project: no account, no server
lecodes clone <uuid-or-url> myapp     # a project that lives on le.codes

A 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:

groupcommandspage
Projectinit create clone link status diff pull push publish releases secrets login hubRun a project locally, Work with the platform
Run & testdev web compile render test call drive desktop serve analyticsRun a project locally, Render and test
Editorsdesign scene thumbsEditors and content
Contentassets shaders level lightmap navmeshEditors and content
Native appsapp plugin pnNative apps, Write a native plugin
Maintenanceupdate installbelow

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:

bash
# .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_KEY
  • LECODES_* and CREATOR_* 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 ./relative value 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

bash
lecodes update            # the CLI, the desktop host, the shaders, the types, the shells, the peers
lecodes update --check    # report what is behind, install nothing

One 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