Introducing Imba-R, a global runtime for Imba
For some time now, I've been using imba-shell
to quickly test my Imba code without leaving the terminal. Sometimes, I would compile my code to JavaScript using the imbac
Imba command then use the node
command to execute the compiled code.
Imba already allows you to run your code without compiling it to JavaScript, you can do so by running ./node_modules/.bin/imba
followed by the name of your script
in your terminal.
This means, Imba must be installed as an npm module in your package. But what if you just want to run a single script outside of an actual package? Well, this is where Imba-R comes in.
Getting Started
To get started, make sure you have Imba-Shell >= v0.2.0
installed globally:
$ npm install -g imba-shell # with npm$ yarn global add imba-shell # with yarn
Next, create a new Imba File:
hello.imba
const [name = 'stranger'] = process.argv.slice(2)console.log "Hello {name}"
Finally, run the Imba File you created using the ir
Imba-R alias:
$ ir hello.imba Donald # Hello Donald$ ir hello.imba # Hello stranger
When using
ir
inside a package that already hasimba
installed, Imba-R will attempt to use the installed version of Imba to run your code instead of the globally installed version from Imba-R.
To find out more about the project, head over to Imba Shell's Github Repo.
Note, you can install Imba as a global package if you're don't want use Imba-Shell.