Skip to the page
Najova

Docs

/

Commands

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.

CommandWhat it does
Run a scriptRuns a script.
Check for mistakesLists mistakes without running anything.
Build a .najb fileCompiles a script into a .najb file.
Build a programMakes a program that starts by itself.
Build a websiteTurns a webNaja site into plain files.
Run a websiteRuns a webNaja site on your computer.
List the built-insPrints every built-in as JSON.
Which Najova you haveShows the version.
Tidy your codeTidies a whole project. Planned.
Run your testsRuns 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.

OptionWhat it does
--safeThe script can only reach files in its own folder, and can't use the web.
--timeShows how long the run took.
--allowLets 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.
hello.naja
$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.

oops.naja
$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.

hello.naja
$print[Hello from a built file]

› naja build hello.naja

Built hello.najb (207 bytes).

› naja run hello.najb

Hello from a built file

Build 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.

index.wnaj
$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 --json

Prints every built-in function with its usage and help, as JSON. Editors use it for hints and checks.

Which Najova you have

naja version

Shows the version of Najova this naja belongs to.

Tidy your code Planned

naja fmt

Will tidy the indents and long lines of a whole project, so every file reads the same way.

Run your tests Planned

naja test

Will run the checks you write for your own code, and say which ones passed.