"Fossies" - the Fresh Open Source Software Archive

Member "cli-1.1280.1/packages/snyk-fix/src/plugins/python/handlers/pipenv-pipfile/update-dependencies/generate-upgrades.ts" (20 Feb 2024, 691 Bytes) of package /linux/misc/snyk-cli-1.1280.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 import { EntityToFix } from '../../../../../types';
    2 import { standardizePackageName } from '../../../standardize-package-name';
    3 import { validateRequiredData } from '../../validate-required-data';
    4 
    5 export function generateUpgrades(entity: EntityToFix): { upgrades: string[] } {
    6   const { remediation } = validateRequiredData(entity);
    7   const { pin: pins } = remediation;
    8 
    9   const upgrades: string[] = [];
   10   for (const pkgAtVersion of Object.keys(pins)) {
   11     const pin = pins[pkgAtVersion];
   12     const newVersion = pin.upgradeTo.split('@')[1];
   13     const [pkgName] = pkgAtVersion.split('@');
   14     upgrades.push(`${standardizePackageName(pkgName)}==${newVersion}`);
   15   }
   16   return { upgrades };
   17 }