Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: minor enhancements #178

Merged
merged 1 commit into from
Jan 25, 2024
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
5 changes: 1 addition & 4 deletions src/main/scopes/jsx/jsx-scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,7 @@ export class JsxScope extends Scope {
getInstalledVersionPaths(dependencyTree: DependencyTree, pkgName: string) {
// find all versions, sort by shortest paths
const instrumentedInstallPaths = findNestedDeps(dependencyTree, pkgName, () => true).sort(
(a, b) => {
if (a.length === b.length) return 0
return a.length < b.length ? -1 : 1
}
(a, b) => a.length - b.length
)

if (instrumentedInstallPaths.length > 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/scopes/npm/get-dependency-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export async function getDependencyTree(
throw new NoNodeModulesFoundError(cwd, root)
}

// Allow this command to try and obtain results even if it exited with a total or partial
// error
const commandResult = await runCommand(
'npm ls --all --json',
logger,
Expand All @@ -59,8 +61,6 @@ export async function getDependencyTree(
return npmTree
}

// Allow this command to try and obtain results even if it exited with a total or partial
// error
cache.set(cacheKey, getNpmTree())

const data = await (cache.get(cacheKey) as Promise<DependencyTree>)
Expand Down