Resonantly enhanced second- and third-harmonic generation in dielectric nonlinear metasurfaces