http://browserify.org/
(But maybe there are better things nowadays, don't know)
The cp looks hacky :)