Skip to content

Commit

Permalink
Merge pull request #1295 from ebkr/unfix-deprecations
Browse files Browse the repository at this point in the history
Unfix getDeprecatedPackageMap
  • Loading branch information
anttimaki authored Apr 15, 2024
2 parents 13ec42d + b2fda5c commit 731bdf4
Show file tree
Hide file tree
Showing 2 changed files with 194 additions and 183 deletions.
71 changes: 39 additions & 32 deletions src/utils/Deprecations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,42 +45,49 @@ export class Deprecations {
return true;
}

for (const dependencyNameAndVersion of mod.getLatestVersion().getDependencies()) {
const dependencyName = dependencyNameAndVersion.substring(0, dependencyNameAndVersion.lastIndexOf('-'));
// TODO: it was deemed that just fixing this function would be a
// breaking change. We need to make changes to UI before the fix
// can go live. Once ready, remove the two lines below and
// uncomment the rest.
deprecationMap.set(mod.getFullName(), false);
return false;

if (currentChain.has(dependencyName)) {
continue;
}
const dependency = packageMap.get(dependencyName);
// for (const dependencyNameAndVersion of mod.getLatestVersion().getDependencies()) {
// const dependencyName = dependencyNameAndVersion.substring(0, dependencyNameAndVersion.lastIndexOf('-'));

// Package isn't available on Thunderstore, so we can't tell
// if it's deprecated or not. This will also include deps of
// packages uploaded into wrong community since the
// packageMap contains only packages from this community.
// Based on manual testing with real data, caching these to
// deprecationMap doesn't seem to improve overall performance.
if (dependency === undefined) {
continue;
}
// if (currentChain.has(dependencyName)) {
// continue;
// }
// const dependency = packageMap.get(dependencyName);

// Keep track of the dependency chain currently under
// investigation to avoid infinite recursive loops.
currentChain.add(mod.getFullName());
const dependencyDeprecated = this._populateDeprecatedPackageMapForModChain(
dependency, packageMap, deprecationMap, currentChain
);
currentChain.delete(mod.getFullName());
deprecationMap.set(dependencyName, dependencyDeprecated);
// // Package isn't available on Thunderstore, so we can't tell
// // if it's deprecated or not. This will also include deps of
// // packages uploaded into wrong community since the
// // packageMap contains only packages from this community.
// // Based on manual testing with real data, caching these to
// // deprecationMap doesn't seem to improve overall performance.
// if (dependency === undefined) {
// continue;
// }

// Eject early on the first deprecated dependency for performance.
if (dependencyDeprecated) {
deprecationMap.set(mod.getFullName(), true);
return true;
}
}
// // Keep track of the dependency chain currently under
// // investigation to avoid infinite recursive loops.
// currentChain.add(mod.getFullName());
// const dependencyDeprecated = this._populateDeprecatedPackageMapForModChain(
// dependency, packageMap, deprecationMap, currentChain
// );
// currentChain.delete(mod.getFullName());
// deprecationMap.set(dependencyName, dependencyDeprecated);

// Package is not depreceated by itself nor due to dependencies.
deprecationMap.set(mod.getFullName(), false);
return false;
// // Eject early on the first deprecated dependency for performance.
// if (dependencyDeprecated) {
// deprecationMap.set(mod.getFullName(), true);
// return true;
// }
// }

// // Package is not depreceated by itself nor due to dependencies.
// deprecationMap.set(mod.getFullName(), false);
// return false;
}
}
Loading

0 comments on commit 731bdf4

Please sign in to comment.