extensions/npm/src/tasks.ts/detectNpmScriptsForFolder
export async function detectNpmScriptsForFolder(context: ExtensionContext, folder: Uri): Promise<IFolderTaskItem[]> {

	const folderTasks: IFolderTaskItem[] = [];

	try {
		if (excludeRegex.test(Utils.basename(folder))) {
			return folderTasks;
		}
		const relativePattern = new RelativePattern(folder.fsPath, '**/package.json');
		const paths = await workspace.findFiles(relativePattern, '**/node_modules/**');

		const visitedPackageJsonFiles: Set<string> = new Set();
		for (const path of paths) {
			if (!visitedPackageJsonFiles.has(path.fsPath)) {
				const tasks = await provideNpmScriptsForFolder(context, path, true);
				visitedPackageJsonFiles.add(path.fsPath);
				folderTasks.push(...tasks.map(t => ({ label: t.task.name, task: t.task })));
			}
		}
		return folderTasks;
	} catch (error) {
		return Promise.reject(error);
	}
}