Fix compilation command generation issue

remove spurious --next for final command.
generate commands arguments as an array like so: ['-main', 'Main', '-js', 'output/main.js']