copy dist dir to tmp directory when running with --cordova, some refactorings
honor --cordova in config flag too