The Lona Compiler is a CLI tool for generating cross-platform UI code from JSON definitions.
The Lona Compiler is published on npm
as @lona/compiler
.
First, install the compiler with:
npm install --global @lona/compiler
You may also install locally to your current project if you prefer, by removing the --global
.
For each command, you'll choose a code generation format
: swift
, js
, tokens
, or documentation
.
Each format as a specific set of options.
In the case of js
, the --framework
option can have a few values:
reactnative
: React Native (default)reactdom
: React DOMreactsketchapp
: React SketchApp
This will generate the colors, text styles, shadows, custom types, and all components, writing them to output-directory
in the same structure as the input workspace directory.
lona convert [path-to-workspace-directory] --format=js --output=[output-directory]
To build the compiler from source, follow these steps.
This project is written in TypeScript.
From this directory, run:
yarn
Note: If you don't have yarn installed already, you can download it with npm:
npm install --global yarn
The above examples can now be run by replacing lona
with ts-node src/bin.ts
.