update script generator to support external sources