Add minimum package age check for pypi

This commit is contained in:
Reinier Criel 2026-03-28 10:15:13 -07:00
parent 2c8a1b4972
commit fd6fb456b4
22 changed files with 516 additions and 273 deletions

View file

@ -0,0 +1,18 @@
import { ECOSYSTEM_PY } from "../config/settings.js";
/**
* @param {string} packageName
* @param {string} ecosystem
* @returns {string[]}
*/
export function getEquivalentPackageNames(packageName, ecosystem) {
if (ecosystem !== ECOSYSTEM_PY) {
return [packageName];
}
const hyphenName = packageName.replaceAll(/[_.-]/g, "-");
const underscoreName = packageName.replaceAll(/[._-]/g, "_");
const dotName = packageName.replaceAll(/[_.-]/g, ".");
return [...new Set([packageName, hyphenName, underscoreName, dotName])];
}