Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion JFrogVSExtension/UI/Panel/Tree/TreeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public async Task LoadAsync(RefreshType refreshType, HashSet<Severity> severitie

// Load projects from output.
Project[] nugetProjects = Util.LoadNugetProjects(returnedText);
Project[] npmProjects = Util.LoadNpmProjects();
Project[] npmProjects = await Util.LoadNpmProjectsAsync();

Projects projects = new Projects
{
Expand Down
10 changes: 5 additions & 5 deletions JFrogVSExtension/Utils/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static Project[] LoadNugetProjects(String output)
return projects.NugetProjects;
}

public static Project[] LoadNpmProjects()
public async static Task<Project[]> LoadNpmProjectsAsync()
{
var npmProjects = new List<Project>();
var packageJsonPaths = Directory.GetFiles(Directory.GetCurrentDirectory(), "package.json", SearchOption.AllDirectories);
Expand All @@ -38,7 +38,7 @@ public static Project[] LoadNpmProjects()
{
continue;
}
var project = LoadNpmProject(packageJsonPath);
var project = await LoadNpmProjectAsync(packageJsonPath);
if (project != null)
{
npmProjects.Add(project);
Expand All @@ -47,15 +47,15 @@ public static Project[] LoadNpmProjects()
return npmProjects.ToArray();
}

private static Project LoadNpmProject(string packageJsonPath)
private async static Task<Project> LoadNpmProjectAsync(string packageJsonPath)
{
try
{
var fileInfo = new FileInfo(packageJsonPath);
// Run npm ls to get the dependencies tree. The /C for the process to quit without waiting for a user's interruption.
var npmProjectTree = GetProcessOutputAsync("cmd.exe", "/C npm ls --json --all --long --package-lock-only", fileInfo.DirectoryName);
var npmProjectTree = await GetProcessOutputAsync("cmd.exe", "/C npm ls --json --all --long --package-lock-only", fileInfo.DirectoryName);

var npmProj = JsonConvert.DeserializeObject<NpmLsNode>(npmProjectTree.Result);
var npmProj = JsonConvert.DeserializeObject<NpmLsNode>(npmProjectTree);

var project = new Project()
{
Expand Down