naja
naja runs your code, checks it for mistakes, builds it into files you can hand out, and runs your website on your own computer.
Type these in a terminal (Command Prompt or PowerShell on Windows) in the folder with your code. najova works too, as a longer name for naja.
| Command | What it does |
|---|---|
| Run a script | Runs a script. |
| Check for mistakes | Lists mistakes without running anything. |
| Build a .najb file | Compiles a script into a .najb file. |
| Build a program | Makes a program that starts by itself. |
| Build a website | Turns a webNaja site into plain files. |
| Run a website | Runs a webNaja site on your computer. |
| List the built-ins | Prints every built-in as JSON. |
| Which Najova you have | Shows the version. |
| Tidy your code | Tidies a whole project. Planned. |
| Run your tests | Runs your own checks. Planned. |
Run a script
naja run [file] [options] [values...]Runs the script until nothing is left waiting. With no file, naja runs main.naja, index.naja or index.wnaj in this folder. naja r is a shorter way to type it.
| Option | What it does |
|---|---|
--safe | The script can only reach files in its own folder, and can't use the web. |
--time | Shows how long the run took. |
--allow | Lets an extension's helper program run without asking first. |
--lines=<file> | Writes how many times each line ran to a file. |
--trace=<file> | Writes what the script did, line by line with its values, to a file. Najova IDE reads it to show a run. |
values... | Anything after the file's name ends up in $args, as a list of text. |
$let[name;Sam]
$print[Hello, $get[name]!]› naja run hello.naja
Hello, Sam!Check for mistakes
naja check <file> [--json]Reads the whole script and lists its mistakes without running anything. Each one names the file and line, and says what to change. --json gives the same list for editors and other tools.
$prnt[Hello]› naja check oops.naja
oops.naja:1: There is no $prnt. Did you mean $print?Build a .najb file
naja build <file> [-o <file.najb>]Turns a script into a .najb file: compiled code that runs without its source. naja run runs it like any other script.
$print[Hello from a built file]› naja build hello.naja
Built hello.najb (207 bytes).› naja run hello.najb
Hello from a built fileBuild a program
naja build <file> --exe [-o <file.exe>]Makes one program file that starts by itself, so the person you give it to doesn't need Najova.
Build a website
naja build --web [folder] [-o <folder>]Turns a webNaja site into plain HTML, CSS and pictures, for hosts that only send files. Without -o the files go in .naja/web inside the site's folder.
$page[Hello]
$heading[Hello from Najova]
$endpage› naja build --web
Built 1 page and copied 0 files into my-site/.naja/web.Run a website
naja serve [folder] [-port <number>] [-safe] [-noreload]Runs a webNaja site at http://localhost:8080/ so you can open it in your browser. Pages reload by themselves when you save a file; -noreload turns that off. -port picks another number, and -safe keeps pages to their own folder.
List the built-ins
naja functions --jsonPrints every built-in function with its usage and help, as JSON. Editors use it for hints and checks.
Which Najova you have
naja versionShows the version of Najova this naja belongs to.
Tidy your code Planned
naja fmtWill tidy the indents and long lines of a whole project, so every file reads the same way.
Run your tests Planned
naja testWill run the checks you write for your own code, and say which ones passed.