Create a Package Version Based on a Scratch Org Snapshot
If the dependent package your base package requires is stable, you can reduce the end-to-end package version creation time by creating a scratch org snapshot.
There’s more than one workflow you can follow when creating a package version based on a scratch org snapshot. You can start by creating a scratch org, you can build your own scratch org definition file, or you can choose to use org shape to create a new scratch org. Whichever path you choose, after the scratch org is created, you install all the dependent packages into it, and then take a snapshot of the scratch org.
Sample Workflow
This workflow uses an org shape to create the initial scratch org where you’ll install the stable dependent packages, and then create a scratch org snapshot to create a package version.
Create the org shape.
1sf org create shape --target-org source-org1
Create a scratch org definition file that indicates the shape’s source org.
Create a package version using the org snapshot. This command is specifying the scratch org definition file that contains the snapshot information in it.
1sf package version create --package hc-ext1 --code-coverage --installation-key-bypass --async-validation --definition-file2scratch-def-with-snapshot-id.json