Home

Awesome

Engify

Build Status Dependency Status devDependency Status

An attempt to write-once-run-anywhere in JavaScript.

What's this?

Browserify transformation that add minimal support for running node.js projects in multiple JavaScript implementations:

Particularly it adds support for non standard:

Right now is just an idea and experiments

The objective is alsbeing able and test other javascript implementations other than just node and the browser. Let's see how well we can "program once" run everywhere in JavaScript works...

Examples

Ultimately this project contains lots of example projects that will compile into a .js file that run on all above implementations.

They not only uses different npm libraries but also browserify tools and languages like es-6 babel, typescript, etc.

Usage

Assuming you have a node.js working project:

npm install engify
browserify -t engify index.js -o output.js
rhino output.js
jsc output.js

Libraries tested

The following are libraries that I were able to use in all implementations:

browserify transformations tested

In general all browserify transformations should work! :) - in my case they all worked:

Objectives

Interesting commands

#run tests - located at spec/ folder
npm test

#run a tool that compiles a project and run it in all the implementations: 
sh test-project.js projects/handlebars-test

#compile sample project test-src: into a bundle
node src/index.js --input test-src/index.js > static/output.js

#run in node
node output.js

#run in Nashorn
jjs output.js

#run in rhino
rhino output.js

#run in v7 [v7](https://github.com/cesanta/v7)
v7 output.js

#compile and run in the abobe in a single command: 
sh test/test1.sh

#execute them all
node static/output.js; rhino static/output.js ; jjs static/output.js ; v7 static/output.js

# measure time:
time node static/output.js; time rhino static/output.js ; time jjs static/output.js ; time v7 static/output.js

Release Tests

On any commit we should make the following commands work:

git clone https://github.com/cancerberoSgx/engify.git
cd engify
npm install

cd test-src
npm install
cd ..    
sh test-project.sh test-src

This last command will build givven test-src/index.js into static/ folder and then run it with all supported engines in the command line.

TODO /Misc