I'm in the process of pushing my production org's metadata into a scratch org. For the most part, the migration is very simple but the biggest gotcha is getting around appexchange dependencies. Any flexipage or report could easily be reference fields or components from an existing app exchange app and cause a number of deployment issues to the scratch org.
SFDX has a nice feature that allows you to install packages from the with
sfdx force:package:install -i 04t... -u myScratchOrg
However, tracking down the package Id is very tedious. My current technique is to go to the appExchange, search for the app (which is now a newer version), click the install link and copy the Id from the URL.
Additionally, I could end up installing a dependency that does not match up to my production instance or find that the latest version of the package isn't backward compatible.
Is there an easier way to find these older package Ids? Such as the tooling API or SOQL query?