generate the right js file