Skip to content

Lona/compiler

Repository files navigation

Lona Compiler

Build and Test

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.

Usage

Installation

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.

Commands

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:

Generate workspace

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]

Contributing

To build the compiler from source, follow these steps.

This project is written in TypeScript.

Setup: Install dependencies with yarn

From this directory, run:

yarn

Note: If you don't have yarn installed already, you can download it with npm: npm install --global yarn

Running commands

The above examples can now be run by replacing lona with ts-node src/bin.ts.