Updating a 2.7 script that uses frame_current to work with 2.8+
Updated script.
All changes here have been well documented.
Getting the updated mesh has changed.
How do I get a mesh data-block with modifiers and shape keys applied in Blender 2.8?
Scene update has been replaced.
What is the replacement for scene.update()?
Setting the frame is still done the same.  (frame_set is not a member of ViewLayer.)
Linking object to a scene has changed.
link new object to scene with python in 2.8
View layer objects has no link method.
revised script.
import bpy
context = bpy.context
scene = context.scene
dg = context.evaluated_depsgraph_get()

frame_current = scene.frame_current

r = range(scene.frame_start, scene.frame_end + 1)
l = len(str(len(r)))
obs = []

for f in r:
    scene.frame_set(f)
    #dg = context.evaluated_depsgraph_get()
    for ob in scene.objects:
        if ob.type == 'MESH' and ob.name.startswith(&quot;Cube&quot;):
            ev_ob = ob.evaluated_get(dg)
            me = ev_ob.data.copy()
            new_ob = bpy.data.objects.new(&quot;%s_frame%0*i&quot; % (ob.name, l, f), me)
            new_ob.matrix_world = ob.matrix_world.copy()
            obs.append(new_ob)

scene.frame_set(frame_current)
for ob in obs:
    context.collection.objects.link(ob)
context.view_layer.update()

Note haven't tested this thoroughly, re how often to evaluate the depsgraph, uncomment #dg = context.evalua.... to see if result differs when it is evaluated on a per frame basis.