Getting Started

NectarJS is a SAAS js cross-compiler. You can compile JS for Windows, Linux, Mac, Arduino or STM32 boards.

Install NectarJS

You need NodeJS to use NectarJS : https://nodejs.org/en/download/.

Once done, open a shell and install NectarJS with NPM :

$ npm install -g nectarjs

Verify is NectarJS is well installed :

$ nectar --version

You need a key to use NectarJS. This key is used to encrypt and protect your code while it's compiled (AES256).

Visit http://nectar-lang.com/key/.

Once done, set your key in NectarJS :

nectar --setid MY_ID
nectar --setkey MY_KEY

Compilation

The simplest way to use NectarJS is :

nectar file.js

The output file name will be automatically choosen regarding the target. You can specify another output with :

-o my_app.out

You can select a target for compilation with :

--target [THE TARGET]

You can select a preset regarding what do you want to optimize: speed or size (or none)

nectar --preset speed file.js

The --single argument launch the compilation of the file in argument. If you need to require('') file in your current folder, you need to remove --single to switch to project mode.

NectarJS can run directly your application after compilation if you specify --run. The program will be executed only if the --target match your system.

For more informations about compilation output, use --verbose

For help, use --help

Check syntax

You can only check syntax without compilation with argument --check. Example :

$ nectar --single my_file.js --check

Project management

if --single is not specified, NectarJS will create a project.json file in the project directory.

You can create a project.json file without compilation with : nectar --prepare file.js

To show a project configuration : nectar --project in the project folder or nectar --project /path/to/projet.json

To compile a project, simply call nectar project.json

Coding with your smartphone or tablet

WIP

Available targets

  • wasm -> WebAssembly

  • asm-js -> ASM.js

  • wast -> WebAssembly AST

  • linux-x86-32 -> Linux x86 32 bits

  • linux-x86-64 -> Linux x86 64 bits

  • linux-arm32v7 -> Linux arm 32 v7 bits, compatible with Android and Raspberry

  • win-x86-32 -> Windows x86 32 bits

  • win-x86-64 -> Windows x86 64 bits

  • arduino-uno -> Arduino UNO

  • arduino-mega1280 -> Arduino Mega with Atmega 1280

  • arduino-mega2560 -> Arduino Mega with Atmega 2560

Last updated