WIP-5 Bug 921417 - rewrite build/variant.py in javascript