build/lib/dependencies.ts/getYarnProductionDependencies
function getYarnProductionDependencies(cwd: string): Dependency[] {
	const raw = cp.execSync('yarn list --json', { cwd, encoding: 'utf8', env: { ...process.env, NODE_ENV: 'production' }, stdio: [null, null, 'inherit'] });
	const match = /^{"type":"tree".*$/m.exec(raw);

	if (!match || match.length !== 1) {
		throw new Error('Could not parse result of `yarn list --json`');
	}

	const trees = JSON.parse(match[0]).data.trees as Tree[];

	return trees
		.map(tree => asYarnDependency(path.join(cwd, 'node_modules'), tree))
		.filter<Dependency>((dep): dep is Dependency => !!dep);
}