More fixes for www-cnpm builds, and refactoring of file layout