Derelict Ripon building to be demolished for townhouses