renovate 39.77.0 → 39.79.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/config/presets/internal/group.js +2 -1
- package/dist/config/presets/internal/group.js.map +1 -1
- package/dist/config/types.d.ts +2 -0
- package/dist/config/types.js.map +1 -1
- package/dist/modules/datasource/go/releases-goproxy.js +9 -1
- package/dist/modules/datasource/go/releases-goproxy.js.map +1 -1
- package/dist/modules/datasource/orb/index.d.ts +2 -1
- package/dist/modules/datasource/orb/index.js +4 -2
- package/dist/modules/datasource/orb/index.js.map +1 -1
- package/dist/modules/manager/npm/post-update/index.js +1 -1
- package/dist/modules/manager/npm/post-update/index.js.map +1 -1
- package/dist/modules/versioning/api.js +2 -0
- package/dist/modules/versioning/api.js.map +1 -1
- package/dist/modules/versioning/devbox/index.d.ts +7 -0
- package/dist/modules/versioning/devbox/index.js +65 -0
- package/dist/modules/versioning/devbox/index.js.map +1 -0
- package/dist/workers/global/config/parse/env.js +1 -1
- package/dist/workers/global/config/parse/env.js.map +1 -1
- package/dist/workers/repository/init/vulnerability.js +3 -3
- package/dist/workers/repository/init/vulnerability.js.map +1 -1
- package/dist/workers/repository/onboarding/branch/index.js +1 -1
- package/dist/workers/repository/onboarding/branch/index.js.map +1 -1
- package/dist/workers/repository/process/extract-update.js +1 -1
- package/dist/workers/repository/process/extract-update.js.map +1 -1
- package/package.json +7 -7
- package/renovate-schema.json +1 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lib/modules/manager/npm/post-update/index.ts"],"names":[],"mappings":";;AA+CA,sDAoEC;AAED,gDAsGC;AAED,4DA6BC;AAwDD,4CAkDC;AAED,gDAqRC;;AA3nBD,uBAAuB;AACvB,kEAAkC;AAClC,kEAAkC;AAClC,0DAA0B;AAC1B,+CAA4C;AAC5C,sFAAiF;AACjF,mDAA+D;AAC/D,4CAK6B;AAC7B,8CAA8D;AAE9D,+EAAyD;AACzD,kDAA6D;AAC7D,8CAA2D;AAC3D,gDAA8D;AAC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uCAAiB,CACzB,KAAK,CACH,8EAA8E,CAC/E,EACD,mBAAa,CAAC,EAAE,CACjB,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;YACD,cAAc,CAAC,IAAI,CAAC;gBAClB,QAAQ,EAAE,cAAc;gBACxB,wEAAwE;gBACxE,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM;aACjC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,eAAe,GAAG,MAAM,IAAA,aAAO,EACnC,cAAc,EACd,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CACnE,CAAC;YACF,IAAI,GAAG,CAAC,QAAQ,KAAK,eAAe,EAAE,CAAC;gBACrC,eAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACN,eAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;gBAC9C,gBAAgB,CAAC,IAAI,CAAC;oBACpB,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,cAAc;oBACpB,mCAAmC;oBACnC,QAAQ,EAAE,GAAG,CAAC,QAAS;iBACxB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,MAAM,IAAA,yBAAiB,EAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC;AAC9C,CAAC","sourcesContent":["// TODO: types (#22198)\nimport is from '@sindresorhus/is';\nimport deepmerge from 'deepmerge';\nimport upath from 'upath';\nimport { logger } from '../../../../logger';\nimport { ExternalHostError } from '../../../../types/errors/external-host-error';\nimport { getChildProcessEnv } from '../../../../util/exec/env';\nimport {\n ensureCacheDir,\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../../util/fs';\nimport { getFile, getRepoStatus } from '../../../../util/git';\nimport type { FileChange } from '../../../../util/git/types';\nimport * as hostRules from '../../../../util/host-rules';\nimport { newlineRegex, regEx } from '../../../../util/regex';\nimport { ensureTrailingSlash } from '../../../../util/url';\nimport { dump, parseSingleYaml } from '../../../../util/yaml';\nimport { NpmDatasource } from '../../../datasource/npm';\nimport { scm } from '../../../platform/scm';\nimport type { PackageFile, PostUpdateConfig, Upgrade } from '../../types';\nimport { getZeroInstallPaths } from '../extract/yarn';\nimport type { NpmManagerData } from '../types';\nimport {\n composeLockFile,\n getNpmrcContent,\n parseLockFile,\n resetNpmrcContent,\n updateNpmrcContent,\n} from '../utils';\nimport * as npm from './npm';\nimport * as pnpm from './pnpm';\nimport { processHostRules } from './rules';\nimport type {\n AdditionalPackageFiles,\n ArtifactError,\n DetermineLockFileDirsResult,\n WriteExistingFilesResult,\n YarnRcYmlFile,\n} from './types';\nimport * as yarn from './yarn';\n\n// Strips empty values, deduplicates, and returns the directories from filenames\nconst getDirs = (arr: (string | null | undefined)[]): string[] =>\n Array.from(new Set(arr.filter(is.string)));\n\nexport function determineLockFileDirs(\n config: PostUpdateConfig,\n packageFiles: AdditionalPackageFiles,\n): DetermineLockFileDirsResult {\n const npmLockDirs: (string | undefined)[] = [];\n const yarnLockDirs: (string | undefined)[] = [];\n const pnpmShrinkwrapDirs: (string | undefined)[] = [];\n\n for (const upgrade of config.upgrades) {\n if (\n upgrade.updateType === 'lockFileMaintenance' ||\n upgrade.isRemediation === true ||\n upgrade.isLockfileUpdate === true\n ) {\n yarnLockDirs.push(upgrade.managerData?.yarnLock);\n npmLockDirs.push(upgrade.managerData?.npmLock);\n pnpmShrinkwrapDirs.push(upgrade.managerData?.pnpmShrinkwrap);\n }\n }\n\n if (\n config.upgrades.every(\n (upgrade: Upgrade) =>\n upgrade.updateType === 'lockFileMaintenance' ||\n upgrade.isLockfileUpdate,\n )\n ) {\n return {\n yarnLockDirs: getDirs(yarnLockDirs),\n npmLockDirs: getDirs(npmLockDirs),\n pnpmShrinkwrapDirs: getDirs(pnpmShrinkwrapDirs),\n };\n }\n\n function getPackageFile(\n fileName: string,\n ): Partial<PackageFile<NpmManagerData>> {\n logger.trace('Looking for packageFile: ' + fileName);\n\n for (const packageFile of packageFiles.npm!) {\n if (packageFile.packageFile === fileName) {\n logger.trace({ packageFile }, 'Found packageFile');\n return packageFile;\n }\n logger.trace('No match');\n }\n return {};\n }\n\n // TODO #22198\n for (const p of config.updatedPackageFiles!) {\n logger.trace(`Checking ${String(p.path)} for lock files`);\n const packageFile = getPackageFile(p.path);\n // istanbul ignore if\n if (!packageFile.managerData) {\n continue;\n }\n // push full lock file names and convert them later\n yarnLockDirs.push(packageFile.managerData.yarnLock);\n npmLockDirs.push(packageFile.managerData.npmLock);\n pnpmShrinkwrapDirs.push(packageFile.managerData.pnpmShrinkwrap);\n }\n\n return {\n yarnLockDirs: getDirs(yarnLockDirs),\n npmLockDirs: getDirs(npmLockDirs),\n pnpmShrinkwrapDirs: getDirs(pnpmShrinkwrapDirs),\n };\n}\n\nexport async function writeExistingFiles(\n config: PostUpdateConfig,\n packageFiles: AdditionalPackageFiles,\n): Promise<void> {\n if (!packageFiles.npm) {\n return;\n }\n const npmFiles = packageFiles.npm;\n logger.debug(\n { packageFiles: npmFiles.map((n) => n.packageFile) },\n 'Writing package.json files',\n );\n for (const packageFile of npmFiles) {\n // istanbul ignore if\n if (!packageFile.managerData) {\n continue;\n }\n // TODO #22198\n const basedir = upath.dirname(packageFile.packageFile!);\n const npmrc = packageFile.npmrc;\n const npmrcFilename = upath.join(basedir, '.npmrc');\n if (is.string(npmrc)) {\n try {\n await writeLocalFile(npmrcFilename, npmrc.replace(/\\n?$/, '\\n'));\n } catch (err) /* istanbul ignore next */ {\n logger.warn({ npmrcFilename, err }, 'Error writing .npmrc');\n }\n }\n const npmLock = packageFile.managerData.npmLock;\n if (npmLock) {\n const npmLockPath = npmLock;\n logger.debug(`Writing ${npmLock}`);\n let existingNpmLock: string;\n try {\n existingNpmLock = (await getFile(npmLock)) ?? '';\n } catch (err) /* istanbul ignore next */ {\n logger.warn({ err }, 'Error reading npm lock file');\n existingNpmLock = '';\n }\n const { detectedIndent, lockFileParsed: npmLockParsed } =\n parseLockFile(existingNpmLock);\n if (npmLockParsed) {\n const packageNames =\n 'packages' in npmLockParsed\n ? Object.keys(npmLockParsed.packages)\n : [];\n const widens: string[] = [];\n let lockFileChanged = false;\n for (const upgrade of config.upgrades) {\n if (upgrade.lockFiles && !upgrade.lockFiles.includes(npmLock)) {\n continue;\n }\n if (!upgrade.managerData) {\n continue;\n }\n if (\n upgrade.rangeStrategy === 'widen' &&\n upgrade.managerData.npmLock === npmLock\n ) {\n // TODO #22198\n widens.push(upgrade.depName!);\n }\n const { depName } = upgrade;\n for (const packageName of packageNames) {\n if (\n 'packages' in npmLockParsed &&\n (packageName === `node_modules/${depName}` ||\n packageName.startsWith(`node_modules/${depName}/`))\n ) {\n logger.trace({ packageName }, 'Massaging out package name');\n lockFileChanged = true;\n delete npmLockParsed.packages[packageName];\n }\n }\n }\n if (widens.length) {\n logger.debug(\n `Removing ${String(widens)} from ${npmLock} to force an update`,\n );\n lockFileChanged = true;\n try {\n if ('dependencies' in npmLockParsed && npmLockParsed.dependencies) {\n widens.forEach((depName) => {\n // TODO #22198\n delete npmLockParsed.dependencies![depName];\n });\n }\n } catch /* istanbul ignore next */ {\n logger.warn(\n { npmLock },\n 'Error massaging package-lock.json for widen',\n );\n }\n }\n if (lockFileChanged) {\n logger.debug('Massaging npm lock file before writing to disk');\n existingNpmLock = composeLockFile(npmLockParsed, detectedIndent);\n }\n await writeLocalFile(npmLockPath, existingNpmLock);\n }\n }\n }\n}\n\nexport async function writeUpdatedPackageFiles(\n config: PostUpdateConfig,\n): Promise<void> {\n logger.trace({ config }, 'writeUpdatedPackageFiles');\n logger.debug('Writing any updated package files');\n if (!config.updatedPackageFiles) {\n logger.debug('No files found');\n return;\n }\n const supportedLockFiles = ['package-lock.json', 'yarn.lock'];\n for (const packageFile of config.updatedPackageFiles) {\n if (packageFile.type !== 'addition') {\n continue;\n }\n if (\n supportedLockFiles.some((fileName) => packageFile.path.endsWith(fileName))\n ) {\n logger.debug(`Writing lock file: ${packageFile.path}`);\n // TODO #22198\n\n await writeLocalFile(packageFile.path, packageFile.contents!);\n continue;\n }\n if (!packageFile.path.endsWith('package.json')) {\n continue;\n }\n logger.debug(`Writing ${packageFile.path}`);\n await writeLocalFile(packageFile.path, packageFile.contents!);\n }\n}\n\n// istanbul ignore next\nasync function updateYarnOffline(\n lockFileDir: string,\n updatedArtifacts: FileChange[],\n): Promise<void> {\n try {\n const resolvedPaths: string[] = [];\n const yarnrcYml = await getFile(upath.join(lockFileDir, '.yarnrc.yml'));\n const yarnrc = await getFile(upath.join(lockFileDir, '.yarnrc'));\n\n // As .yarnrc.yml overrides .yarnrc in Yarn 1 (https://git.io/JUcco)\n // both files may exist, so check for .yarnrc.yml first\n if (yarnrcYml) {\n // Yarn 2 (offline cache and zero-installs)\n const paths = getZeroInstallPaths(yarnrcYml);\n resolvedPaths.push(...paths.map((p) => upath.join(lockFileDir, p)));\n } else if (yarnrc) {\n // Yarn 1 (offline mirror)\n const mirrorLine = yarnrc\n .split(newlineRegex)\n .find((line) => line.startsWith('yarn-offline-mirror '));\n if (mirrorLine) {\n const mirrorPath = ensureTrailingSlash(\n mirrorLine.split(' ')[1].replace(regEx(/\"/g), ''),\n );\n resolvedPaths.push(upath.join(lockFileDir, mirrorPath));\n }\n }\n logger.debug({ resolvedPaths }, 'updateYarnOffline resolvedPaths');\n\n if (resolvedPaths.length) {\n const status = await getRepoStatus();\n for (const f of status.modified.concat(status.not_added)) {\n if (resolvedPaths.some((p) => f.startsWith(p))) {\n updatedArtifacts.push({\n type: 'addition',\n path: f,\n contents: await readLocalFile(f),\n });\n }\n }\n for (const f of status.deleted || []) {\n if (resolvedPaths.some((p) => f.startsWith(p))) {\n updatedArtifacts.push({ type: 'deletion', path: f });\n }\n }\n }\n } catch (err) {\n logger.error({ err }, 'Error updating yarn offline packages');\n }\n}\n\n// TODO: move to ./yarn.ts\n// exported for testing\nexport async function updateYarnBinary(\n lockFileDir: string,\n updatedArtifacts: FileChange[],\n existingYarnrcYmlContent: string | undefined | null,\n): Promise<string | undefined | null> {\n let yarnrcYml = existingYarnrcYmlContent;\n try {\n const yarnrcYmlFilename = upath.join(lockFileDir, '.yarnrc.yml');\n yarnrcYml ||= (await getFile(yarnrcYmlFilename)) ?? undefined;\n const newYarnrcYml = await readLocalFile(yarnrcYmlFilename, 'utf8');\n if (!is.string(yarnrcYml) || !is.string(newYarnrcYml)) {\n return existingYarnrcYmlContent;\n }\n\n // TODO: use schema (#9610)\n const oldYarnPath = parseSingleYaml<YarnRcYmlFile>(yarnrcYml)?.yarnPath;\n const newYarnPath = parseSingleYaml<YarnRcYmlFile>(newYarnrcYml)?.yarnPath;\n if (\n !is.nonEmptyStringAndNotWhitespace(oldYarnPath) ||\n !is.nonEmptyStringAndNotWhitespace(newYarnPath)\n ) {\n return existingYarnrcYmlContent;\n }\n\n const oldYarnFullPath = upath.join(lockFileDir, oldYarnPath);\n const newYarnFullPath = upath.join(lockFileDir, newYarnPath);\n logger.debug({ oldYarnPath, newYarnPath }, 'Found updated Yarn binary');\n\n yarnrcYml = yarnrcYml.replace(oldYarnPath, newYarnPath);\n updatedArtifacts.push(\n {\n type: 'addition',\n path: yarnrcYmlFilename,\n contents: yarnrcYml,\n },\n {\n type: 'deletion',\n path: oldYarnFullPath,\n },\n {\n type: 'addition',\n path: newYarnFullPath,\n contents: await readLocalFile(newYarnFullPath, 'utf8'),\n isExecutable: true,\n },\n );\n } catch (err) /* istanbul ignore next */ {\n logger.error({ err }, 'Error updating Yarn binary');\n }\n return existingYarnrcYmlContent && yarnrcYml;\n}\n\nexport async function getAdditionalFiles(\n config: PostUpdateConfig<NpmManagerData>,\n packageFiles: AdditionalPackageFiles,\n): Promise<WriteExistingFilesResult> {\n logger.trace({ config }, 'getAdditionalFiles');\n const artifactErrors: ArtifactError[] = [];\n const updatedArtifacts: FileChange[] = [];\n if (!packageFiles.npm?.length) {\n return { artifactErrors, updatedArtifacts };\n }\n if (!config.updateLockFiles) {\n logger.debug('Skipping lock file generation');\n return { artifactErrors, updatedArtifacts };\n }\n if (\n config.reuseExistingBranch &&\n !config.updatedPackageFiles?.length &&\n config.upgrades?.every((upgrade) => upgrade.isLockfileUpdate)\n ) {\n logger.debug('Existing branch contains all necessary lock file updates');\n return { artifactErrors, updatedArtifacts };\n }\n logger.debug('Getting updated lock files');\n if (\n config.updateType === 'lockFileMaintenance' &&\n config.reuseExistingBranch &&\n (await scm.branchExists(config.branchName))\n ) {\n logger.debug('Skipping lockFileMaintenance update');\n return { artifactErrors, updatedArtifacts };\n }\n const dirs = determineLockFileDirs(config, packageFiles);\n logger.trace({ dirs }, 'lock file dirs');\n await writeExistingFiles(config, packageFiles);\n await writeUpdatedPackageFiles(config);\n\n const { additionalNpmrcContent, additionalYarnRcYml } = processHostRules();\n\n const env = {\n ...getChildProcessEnv(),\n NPM_CONFIG_CACHE: await ensureCacheDir('npm'),\n YARN_CACHE_FOLDER: await ensureCacheDir('yarn'),\n YARN_GLOBAL_FOLDER: await ensureCacheDir('berry'),\n npm_config_store: await ensureCacheDir('pnpm'),\n NODE_ENV: 'dev',\n };\n\n let token: string | undefined;\n try {\n ({ token } = hostRules.find({\n hostType: 'github',\n url: 'https://api.github.com/',\n }));\n token = token ? /* istanbul ignore next */ `${token}@` : token;\n } catch (err) /* istanbul ignore next */ {\n logger.warn({ err }, 'Error getting token for packageFile');\n }\n const tokenRe = regEx(`${token ?? ''}`, 'g', false);\n for (const npmLock of dirs.npmLockDirs) {\n const lockFileDir = upath.dirname(npmLock);\n const npmrcContent = await getNpmrcContent(lockFileDir);\n await updateNpmrcContent(lockFileDir, npmrcContent, additionalNpmrcContent);\n const fileName = upath.basename(npmLock);\n logger.debug(`Generating ${fileName} for ${lockFileDir}`);\n const upgrades = config.upgrades.filter(\n (upgrade) => upgrade.managerData?.npmLock === npmLock,\n );\n const res = await npm.generateLockFile(\n lockFileDir,\n env,\n fileName,\n config,\n upgrades,\n );\n if (res.error) {\n // istanbul ignore if\n if (res.stderr?.includes('No matching version found for')) {\n for (const upgrade of config.upgrades) {\n if (\n res.stderr.includes(\n `No matching version found for ${upgrade.depName}`,\n )\n ) {\n logger.debug(\n { dependency: upgrade.depName, type: 'npm' },\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n const err = new Error(\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n throw new ExternalHostError(err, NpmDatasource.id);\n }\n }\n }\n artifactErrors.push({\n lockFile: npmLock,\n stderr: res.stderr,\n });\n } else if (res.lockFile) {\n const existingContent = await getFile(\n npmLock,\n config.reuseExistingBranch ? config.branchName : config.baseBranch,\n );\n if (res.lockFile === existingContent) {\n logger.debug(`${npmLock} hasn't changed`);\n } else {\n logger.debug(`${npmLock} needs updating`);\n updatedArtifacts.push({\n type: 'addition',\n path: npmLock,\n // TODO: can this be undefined? (#22198)\n\n contents: res.lockFile.replace(tokenRe, ''),\n });\n }\n }\n await resetNpmrcContent(lockFileDir, npmrcContent);\n }\n\n for (const yarnLock of dirs.yarnLockDirs) {\n const lockFileDir = upath.dirname(yarnLock);\n const npmrcContent = await getNpmrcContent(lockFileDir);\n await updateNpmrcContent(lockFileDir, npmrcContent, additionalNpmrcContent);\n let yarnRcYmlFilename: string | undefined;\n let existingYarnrcYmlContent: string | undefined | null;\n if (additionalYarnRcYml) {\n yarnRcYmlFilename = getSiblingFileName(yarnLock, '.yarnrc.yml');\n existingYarnrcYmlContent = await readLocalFile(yarnRcYmlFilename, 'utf8');\n if (existingYarnrcYmlContent) {\n try {\n // TODO: use schema (#9610)\n const existingYarnrRcYml = parseSingleYaml<Record<string, unknown>>(\n existingYarnrcYmlContent,\n );\n\n const updatedYarnYrcYml = deepmerge(\n existingYarnrRcYml,\n yarn.fuzzyMatchAdditionalYarnrcYml(\n additionalYarnRcYml,\n existingYarnrRcYml,\n ),\n );\n\n await writeLocalFile(yarnRcYmlFilename, dump(updatedYarnYrcYml));\n logger.debug('Added authentication to .yarnrc.yml');\n } catch (err) {\n logger.warn({ err }, 'Error appending .yarnrc.yml content');\n }\n }\n }\n logger.debug(`Generating yarn.lock for ${lockFileDir}`);\n const lockFileName = upath.join(lockFileDir, 'yarn.lock');\n const upgrades = config.upgrades.filter(\n (upgrade) => upgrade.managerData?.yarnLock === yarnLock,\n );\n const res = await yarn.generateLockFile(lockFileDir, env, config, upgrades);\n if (res.error) {\n // istanbul ignore if\n if (res.stderr?.includes(`Couldn't find any versions for`)) {\n for (const upgrade of config.upgrades) {\n /* eslint-disable no-useless-escape */\n if (\n res.stderr.includes(\n `Couldn't find any versions for \\\\\\\"${upgrade.depName}\\\\\\\"`,\n )\n ) {\n logger.debug(\n { dependency: upgrade.depName, type: 'yarn' },\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n throw new ExternalHostError(\n new Error(\n 'lock file failed for the dependency being updated - skipping branch creation',\n ),\n NpmDatasource.id,\n );\n }\n /* eslint-enable no-useless-escape */\n }\n }\n artifactErrors.push({\n lockFile: yarnLock,\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n stderr: res.stderr || res.stdout,\n });\n } else {\n const existingContent = await getFile(\n lockFileName,\n config.reuseExistingBranch ? config.branchName : config.baseBranch,\n );\n if (res.lockFile === existingContent) {\n logger.debug(\"yarn.lock hasn't changed\");\n } else {\n logger.debug('yarn.lock needs updating');\n updatedArtifacts.push({\n type: 'addition',\n path: lockFileName,\n // TODO #22198\n contents: res.lockFile!,\n });\n await updateYarnOffline(lockFileDir, updatedArtifacts);\n }\n\n // istanbul ignore if: already tested seperately, needs additional test?\n if (upgrades.some(yarn.isYarnUpdate)) {\n existingYarnrcYmlContent = await updateYarnBinary(\n lockFileDir,\n updatedArtifacts,\n existingYarnrcYmlContent,\n );\n }\n }\n await resetNpmrcContent(lockFileDir, npmrcContent);\n // istanbul ignore if: needs test\n if (existingYarnrcYmlContent) {\n // TODO #22198\n await writeLocalFile(yarnRcYmlFilename!, existingYarnrcYmlContent);\n }\n }\n\n for (const pnpmShrinkwrap of dirs.pnpmShrinkwrapDirs) {\n const lockFileDir = upath.dirname(pnpmShrinkwrap);\n const npmrcContent = await getNpmrcContent(lockFileDir);\n await updateNpmrcContent(lockFileDir, npmrcContent, additionalNpmrcContent);\n logger.debug(`Generating pnpm-lock.yaml for ${lockFileDir}`);\n const upgrades = config.upgrades.filter(\n (upgrade) => upgrade.managerData?.pnpmShrinkwrap === pnpmShrinkwrap,\n );\n const res = await pnpm.generateLockFile(lockFileDir, env, config, upgrades);\n if (res.error) {\n // istanbul ignore if\n if (res.stdout?.includes(`No compatible version found:`)) {\n for (const upgrade of config.upgrades) {\n if (\n res.stdout.includes(\n `No compatible version found: ${upgrade.depName}`,\n )\n ) {\n logger.debug(\n { dependency: upgrade.depName, type: 'pnpm' },\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n throw new ExternalHostError(\n Error(\n 'lock file failed for the dependency being updated - skipping branch creation',\n ),\n NpmDatasource.id,\n );\n }\n }\n }\n artifactErrors.push({\n lockFile: pnpmShrinkwrap,\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n stderr: res.stderr || res.stdout,\n });\n } else {\n const existingContent = await getFile(\n pnpmShrinkwrap,\n config.reuseExistingBranch ? config.branchName : config.baseBranch,\n );\n if (res.lockFile === existingContent) {\n logger.debug(\"pnpm-lock.yaml hasn't changed\");\n } else {\n logger.debug('pnpm-lock.yaml needs updating');\n updatedArtifacts.push({\n type: 'addition',\n path: pnpmShrinkwrap,\n // TODO: can be undefined? (#22198)\n contents: res.lockFile!,\n });\n }\n }\n await resetNpmrcContent(lockFileDir, npmrcContent);\n }\n\n return { artifactErrors, updatedArtifacts };\n}\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lib/modules/manager/npm/post-update/index.ts"],"names":[],"mappings":";;AA+CA,sDAoEC;AAED,gDAsGC;AAED,4DA6BC;AAwDD,4CAk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\nimport upath from 'upath';\nimport { logger } from '../../../../logger';\nimport { ExternalHostError } from '../../../../types/errors/external-host-error';\nimport { getChildProcessEnv } from '../../../../util/exec/env';\nimport {\n ensureCacheDir,\n getSiblingFileName,\n readLocalFile,\n writeLocalFile,\n} from '../../../../util/fs';\nimport { getFile, getRepoStatus } from '../../../../util/git';\nimport type { FileChange } from '../../../../util/git/types';\nimport * as hostRules from '../../../../util/host-rules';\nimport { newlineRegex, regEx } from '../../../../util/regex';\nimport { ensureTrailingSlash } from '../../../../util/url';\nimport { dump, parseSingleYaml } from '../../../../util/yaml';\nimport { NpmDatasource } from '../../../datasource/npm';\nimport { scm } from '../../../platform/scm';\nimport type { PackageFile, PostUpdateConfig, Upgrade } from '../../types';\nimport { getZeroInstallPaths } from '../extract/yarn';\nimport type { NpmManagerData } from '../types';\nimport {\n composeLockFile,\n getNpmrcContent,\n parseLockFile,\n resetNpmrcContent,\n updateNpmrcContent,\n} from '../utils';\nimport * as npm from './npm';\nimport * as pnpm from './pnpm';\nimport { processHostRules } from './rules';\nimport type {\n AdditionalPackageFiles,\n ArtifactError,\n DetermineLockFileDirsResult,\n WriteExistingFilesResult,\n YarnRcYmlFile,\n} from './types';\nimport * as yarn from './yarn';\n\n// Strips empty values, deduplicates, and returns the directories from filenames\nconst getDirs = (arr: (string | null | undefined)[]): string[] =>\n Array.from(new Set(arr.filter(is.string)));\n\nexport function determineLockFileDirs(\n config: PostUpdateConfig,\n packageFiles: AdditionalPackageFiles,\n): DetermineLockFileDirsResult {\n const npmLockDirs: (string | undefined)[] = [];\n const yarnLockDirs: (string | undefined)[] = [];\n const pnpmShrinkwrapDirs: (string | undefined)[] = [];\n\n for (const upgrade of config.upgrades) {\n if (\n upgrade.updateType === 'lockFileMaintenance' ||\n upgrade.isRemediation === true ||\n upgrade.isLockfileUpdate === true\n ) {\n yarnLockDirs.push(upgrade.managerData?.yarnLock);\n npmLockDirs.push(upgrade.managerData?.npmLock);\n pnpmShrinkwrapDirs.push(upgrade.managerData?.pnpmShrinkwrap);\n }\n }\n\n if (\n config.upgrades.every(\n (upgrade: Upgrade) =>\n upgrade.updateType === 'lockFileMaintenance' ||\n upgrade.isLockfileUpdate,\n )\n ) {\n return {\n yarnLockDirs: getDirs(yarnLockDirs),\n npmLockDirs: getDirs(npmLockDirs),\n pnpmShrinkwrapDirs: getDirs(pnpmShrinkwrapDirs),\n };\n }\n\n function getPackageFile(\n fileName: string,\n ): Partial<PackageFile<NpmManagerData>> {\n logger.trace('Looking for packageFile: ' + fileName);\n\n for (const packageFile of packageFiles.npm!) {\n if (packageFile.packageFile === fileName) {\n logger.trace({ packageFile }, 'Found packageFile');\n return packageFile;\n }\n logger.trace('No match');\n }\n return {};\n }\n\n // TODO #22198\n for (const p of config.updatedPackageFiles!) {\n logger.trace(`Checking ${String(p.path)} for lock files`);\n const packageFile = getPackageFile(p.path);\n // istanbul ignore if\n if (!packageFile.managerData) {\n continue;\n }\n // push full lock file names and convert them later\n yarnLockDirs.push(packageFile.managerData.yarnLock);\n npmLockDirs.push(packageFile.managerData.npmLock);\n pnpmShrinkwrapDirs.push(packageFile.managerData.pnpmShrinkwrap);\n }\n\n return {\n yarnLockDirs: getDirs(yarnLockDirs),\n npmLockDirs: getDirs(npmLockDirs),\n pnpmShrinkwrapDirs: getDirs(pnpmShrinkwrapDirs),\n };\n}\n\nexport async function writeExistingFiles(\n config: PostUpdateConfig,\n packageFiles: AdditionalPackageFiles,\n): Promise<void> {\n if (!packageFiles.npm) {\n return;\n }\n const npmFiles = packageFiles.npm;\n logger.debug(\n { packageFiles: npmFiles.map((n) => n.packageFile) },\n 'Writing package.json files',\n );\n for (const packageFile of npmFiles) {\n // istanbul ignore if\n if (!packageFile.managerData) {\n continue;\n }\n // TODO #22198\n const basedir = upath.dirname(packageFile.packageFile!);\n const npmrc = packageFile.npmrc;\n const npmrcFilename = upath.join(basedir, '.npmrc');\n if (is.string(npmrc)) {\n try {\n await writeLocalFile(npmrcFilename, npmrc.replace(/\\n?$/, '\\n'));\n } catch (err) /* istanbul ignore next */ {\n logger.warn({ npmrcFilename, err }, 'Error writing .npmrc');\n }\n }\n const npmLock = packageFile.managerData.npmLock;\n if (npmLock) {\n const npmLockPath = npmLock;\n logger.debug(`Writing ${npmLock}`);\n let existingNpmLock: string;\n try {\n existingNpmLock = (await getFile(npmLock)) ?? '';\n } catch (err) /* istanbul ignore next */ {\n logger.warn({ err }, 'Error reading npm lock file');\n existingNpmLock = '';\n }\n const { detectedIndent, lockFileParsed: npmLockParsed } =\n parseLockFile(existingNpmLock);\n if (npmLockParsed) {\n const packageNames =\n 'packages' in npmLockParsed\n ? Object.keys(npmLockParsed.packages)\n : [];\n const widens: string[] = [];\n let lockFileChanged = false;\n for (const upgrade of config.upgrades) {\n if (upgrade.lockFiles && !upgrade.lockFiles.includes(npmLock)) {\n continue;\n }\n if (!upgrade.managerData) {\n continue;\n }\n if (\n upgrade.rangeStrategy === 'widen' &&\n upgrade.managerData.npmLock === npmLock\n ) {\n // TODO #22198\n widens.push(upgrade.depName!);\n }\n const { depName } = upgrade;\n for (const packageName of packageNames) {\n if (\n 'packages' in npmLockParsed &&\n (packageName === `node_modules/${depName}` ||\n packageName.startsWith(`node_modules/${depName}/`))\n ) {\n logger.trace({ packageName }, 'Massaging out package name');\n lockFileChanged = true;\n delete npmLockParsed.packages[packageName];\n }\n }\n }\n if (widens.length) {\n logger.debug(\n `Removing ${String(widens)} from ${npmLock} to force an update`,\n );\n lockFileChanged = true;\n try {\n if ('dependencies' in npmLockParsed && npmLockParsed.dependencies) {\n widens.forEach((depName) => {\n // TODO #22198\n delete npmLockParsed.dependencies![depName];\n });\n }\n } catch /* istanbul ignore next */ {\n logger.warn(\n { npmLock },\n 'Error massaging package-lock.json for widen',\n );\n }\n }\n if (lockFileChanged) {\n logger.debug('Massaging npm lock file before writing to disk');\n existingNpmLock = composeLockFile(npmLockParsed, detectedIndent);\n }\n await writeLocalFile(npmLockPath, existingNpmLock);\n }\n }\n }\n}\n\nexport async function writeUpdatedPackageFiles(\n config: PostUpdateConfig,\n): Promise<void> {\n logger.trace({ config }, 'writeUpdatedPackageFiles');\n logger.debug('Writing any updated package files');\n if (!config.updatedPackageFiles) {\n logger.debug('No files found');\n return;\n }\n const supportedLockFiles = ['package-lock.json', 'yarn.lock'];\n for (const packageFile of config.updatedPackageFiles) {\n if (packageFile.type !== 'addition') {\n continue;\n }\n if (\n supportedLockFiles.some((fileName) => packageFile.path.endsWith(fileName))\n ) {\n logger.debug(`Writing lock file: ${packageFile.path}`);\n // TODO #22198\n\n await writeLocalFile(packageFile.path, packageFile.contents!);\n continue;\n }\n if (!packageFile.path.endsWith('package.json')) {\n continue;\n }\n logger.debug(`Writing ${packageFile.path}`);\n await writeLocalFile(packageFile.path, packageFile.contents!);\n }\n}\n\n// istanbul ignore next\nasync function updateYarnOffline(\n lockFileDir: string,\n updatedArtifacts: FileChange[],\n): Promise<void> {\n try {\n const resolvedPaths: string[] = [];\n const yarnrcYml = await getFile(upath.join(lockFileDir, '.yarnrc.yml'));\n const yarnrc = await getFile(upath.join(lockFileDir, '.yarnrc'));\n\n // As .yarnrc.yml overrides .yarnrc in Yarn 1 (https://git.io/JUcco)\n // both files may exist, so check for .yarnrc.yml first\n if (yarnrcYml) {\n // Yarn 2 (offline cache and zero-installs)\n const paths = getZeroInstallPaths(yarnrcYml);\n resolvedPaths.push(...paths.map((p) => upath.join(lockFileDir, p)));\n } else if (yarnrc) {\n // Yarn 1 (offline mirror)\n const mirrorLine = yarnrc\n .split(newlineRegex)\n .find((line) => line.startsWith('yarn-offline-mirror '));\n if (mirrorLine) {\n const mirrorPath = ensureTrailingSlash(\n mirrorLine.split(' ')[1].replace(regEx(/\"/g), ''),\n );\n resolvedPaths.push(upath.join(lockFileDir, mirrorPath));\n }\n }\n logger.debug({ resolvedPaths }, 'updateYarnOffline resolvedPaths');\n\n if (resolvedPaths.length) {\n const status = await getRepoStatus();\n for (const f of status.modified.concat(status.not_added)) {\n if (resolvedPaths.some((p) => f.startsWith(p))) {\n updatedArtifacts.push({\n type: 'addition',\n path: f,\n contents: await readLocalFile(f),\n });\n }\n }\n for (const f of status.deleted || []) {\n if (resolvedPaths.some((p) => f.startsWith(p))) {\n updatedArtifacts.push({ type: 'deletion', path: f });\n }\n }\n }\n } catch (err) {\n logger.error({ err }, 'Error updating yarn offline packages');\n }\n}\n\n// TODO: move to ./yarn.ts\n// exported for testing\nexport async function updateYarnBinary(\n lockFileDir: string,\n updatedArtifacts: FileChange[],\n existingYarnrcYmlContent: string | undefined | null,\n): Promise<string | undefined | null> {\n let yarnrcYml = existingYarnrcYmlContent;\n try {\n const yarnrcYmlFilename = upath.join(lockFileDir, '.yarnrc.yml');\n yarnrcYml ??= (await getFile(yarnrcYmlFilename)) ?? undefined;\n const newYarnrcYml = await readLocalFile(yarnrcYmlFilename, 'utf8');\n if (!is.string(yarnrcYml) || !is.string(newYarnrcYml)) {\n return existingYarnrcYmlContent;\n }\n\n // TODO: use schema (#9610)\n const oldYarnPath = parseSingleYaml<YarnRcYmlFile>(yarnrcYml)?.yarnPath;\n const newYarnPath = parseSingleYaml<YarnRcYmlFile>(newYarnrcYml)?.yarnPath;\n if (\n !is.nonEmptyStringAndNotWhitespace(oldYarnPath) ||\n !is.nonEmptyStringAndNotWhitespace(newYarnPath)\n ) {\n return existingYarnrcYmlContent;\n }\n\n const oldYarnFullPath = upath.join(lockFileDir, oldYarnPath);\n const newYarnFullPath = upath.join(lockFileDir, newYarnPath);\n logger.debug({ oldYarnPath, newYarnPath }, 'Found updated Yarn binary');\n\n yarnrcYml = yarnrcYml.replace(oldYarnPath, newYarnPath);\n updatedArtifacts.push(\n {\n type: 'addition',\n path: yarnrcYmlFilename,\n contents: yarnrcYml,\n },\n {\n type: 'deletion',\n path: oldYarnFullPath,\n },\n {\n type: 'addition',\n path: newYarnFullPath,\n contents: await readLocalFile(newYarnFullPath, 'utf8'),\n isExecutable: true,\n },\n );\n } catch (err) /* istanbul ignore next */ {\n logger.error({ err }, 'Error updating Yarn binary');\n }\n return existingYarnrcYmlContent && yarnrcYml;\n}\n\nexport async function getAdditionalFiles(\n config: PostUpdateConfig<NpmManagerData>,\n packageFiles: AdditionalPackageFiles,\n): Promise<WriteExistingFilesResult> {\n logger.trace({ config }, 'getAdditionalFiles');\n const artifactErrors: ArtifactError[] = [];\n const updatedArtifacts: FileChange[] = [];\n if (!packageFiles.npm?.length) {\n return { artifactErrors, updatedArtifacts };\n }\n if (!config.updateLockFiles) {\n logger.debug('Skipping lock file generation');\n return { artifactErrors, updatedArtifacts };\n }\n if (\n config.reuseExistingBranch &&\n !config.updatedPackageFiles?.length &&\n config.upgrades?.every((upgrade) => upgrade.isLockfileUpdate)\n ) {\n logger.debug('Existing branch contains all necessary lock file updates');\n return { artifactErrors, updatedArtifacts };\n }\n logger.debug('Getting updated lock files');\n if (\n config.updateType === 'lockFileMaintenance' &&\n config.reuseExistingBranch &&\n (await scm.branchExists(config.branchName))\n ) {\n logger.debug('Skipping lockFileMaintenance update');\n return { artifactErrors, updatedArtifacts };\n }\n const dirs = determineLockFileDirs(config, packageFiles);\n logger.trace({ dirs }, 'lock file dirs');\n await writeExistingFiles(config, packageFiles);\n await writeUpdatedPackageFiles(config);\n\n const { additionalNpmrcContent, additionalYarnRcYml } = processHostRules();\n\n const env = {\n ...getChildProcessEnv(),\n NPM_CONFIG_CACHE: await ensureCacheDir('npm'),\n YARN_CACHE_FOLDER: await ensureCacheDir('yarn'),\n YARN_GLOBAL_FOLDER: await ensureCacheDir('berry'),\n npm_config_store: await ensureCacheDir('pnpm'),\n NODE_ENV: 'dev',\n };\n\n let token: string | undefined;\n try {\n ({ token } = hostRules.find({\n hostType: 'github',\n url: 'https://api.github.com/',\n }));\n token = token ? /* istanbul ignore next */ `${token}@` : token;\n } catch (err) /* istanbul ignore next */ {\n logger.warn({ err }, 'Error getting token for packageFile');\n }\n const tokenRe = regEx(`${token ?? ''}`, 'g', false);\n for (const npmLock of dirs.npmLockDirs) {\n const lockFileDir = upath.dirname(npmLock);\n const npmrcContent = await getNpmrcContent(lockFileDir);\n await updateNpmrcContent(lockFileDir, npmrcContent, additionalNpmrcContent);\n const fileName = upath.basename(npmLock);\n logger.debug(`Generating ${fileName} for ${lockFileDir}`);\n const upgrades = config.upgrades.filter(\n (upgrade) => upgrade.managerData?.npmLock === npmLock,\n );\n const res = await npm.generateLockFile(\n lockFileDir,\n env,\n fileName,\n config,\n upgrades,\n );\n if (res.error) {\n // istanbul ignore if\n if (res.stderr?.includes('No matching version found for')) {\n for (const upgrade of config.upgrades) {\n if (\n res.stderr.includes(\n `No matching version found for ${upgrade.depName}`,\n )\n ) {\n logger.debug(\n { dependency: upgrade.depName, type: 'npm' },\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n const err = new Error(\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n throw new ExternalHostError(err, NpmDatasource.id);\n }\n }\n }\n artifactErrors.push({\n lockFile: npmLock,\n stderr: res.stderr,\n });\n } else if (res.lockFile) {\n const existingContent = await getFile(\n npmLock,\n config.reuseExistingBranch ? config.branchName : config.baseBranch,\n );\n if (res.lockFile === existingContent) {\n logger.debug(`${npmLock} hasn't changed`);\n } else {\n logger.debug(`${npmLock} needs updating`);\n updatedArtifacts.push({\n type: 'addition',\n path: npmLock,\n // TODO: can this be undefined? (#22198)\n\n contents: res.lockFile.replace(tokenRe, ''),\n });\n }\n }\n await resetNpmrcContent(lockFileDir, npmrcContent);\n }\n\n for (const yarnLock of dirs.yarnLockDirs) {\n const lockFileDir = upath.dirname(yarnLock);\n const npmrcContent = await getNpmrcContent(lockFileDir);\n await updateNpmrcContent(lockFileDir, npmrcContent, additionalNpmrcContent);\n let yarnRcYmlFilename: string | undefined;\n let existingYarnrcYmlContent: string | undefined | null;\n if (additionalYarnRcYml) {\n yarnRcYmlFilename = getSiblingFileName(yarnLock, '.yarnrc.yml');\n existingYarnrcYmlContent = await readLocalFile(yarnRcYmlFilename, 'utf8');\n if (existingYarnrcYmlContent) {\n try {\n // TODO: use schema (#9610)\n const existingYarnrRcYml = parseSingleYaml<Record<string, unknown>>(\n existingYarnrcYmlContent,\n );\n\n const updatedYarnYrcYml = deepmerge(\n existingYarnrRcYml,\n yarn.fuzzyMatchAdditionalYarnrcYml(\n additionalYarnRcYml,\n existingYarnrRcYml,\n ),\n );\n\n await writeLocalFile(yarnRcYmlFilename, dump(updatedYarnYrcYml));\n logger.debug('Added authentication to .yarnrc.yml');\n } catch (err) {\n logger.warn({ err }, 'Error appending .yarnrc.yml content');\n }\n }\n }\n logger.debug(`Generating yarn.lock for ${lockFileDir}`);\n const lockFileName = upath.join(lockFileDir, 'yarn.lock');\n const upgrades = config.upgrades.filter(\n (upgrade) => upgrade.managerData?.yarnLock === yarnLock,\n );\n const res = await yarn.generateLockFile(lockFileDir, env, config, upgrades);\n if (res.error) {\n // istanbul ignore if\n if (res.stderr?.includes(`Couldn't find any versions for`)) {\n for (const upgrade of config.upgrades) {\n /* eslint-disable no-useless-escape */\n if (\n res.stderr.includes(\n `Couldn't find any versions for \\\\\\\"${upgrade.depName}\\\\\\\"`,\n )\n ) {\n logger.debug(\n { dependency: upgrade.depName, type: 'yarn' },\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n throw new ExternalHostError(\n new Error(\n 'lock file failed for the dependency being updated - skipping branch creation',\n ),\n NpmDatasource.id,\n );\n }\n /* eslint-enable no-useless-escape */\n }\n }\n artifactErrors.push({\n lockFile: yarnLock,\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n stderr: res.stderr || res.stdout,\n });\n } else {\n const existingContent = await getFile(\n lockFileName,\n config.reuseExistingBranch ? config.branchName : config.baseBranch,\n );\n if (res.lockFile === existingContent) {\n logger.debug(\"yarn.lock hasn't changed\");\n } else {\n logger.debug('yarn.lock needs updating');\n updatedArtifacts.push({\n type: 'addition',\n path: lockFileName,\n // TODO #22198\n contents: res.lockFile!,\n });\n await updateYarnOffline(lockFileDir, updatedArtifacts);\n }\n\n // istanbul ignore if: already tested seperately, needs additional test?\n if (upgrades.some(yarn.isYarnUpdate)) {\n existingYarnrcYmlContent = await updateYarnBinary(\n lockFileDir,\n updatedArtifacts,\n existingYarnrcYmlContent,\n );\n }\n }\n await resetNpmrcContent(lockFileDir, npmrcContent);\n // istanbul ignore if: needs test\n if (existingYarnrcYmlContent) {\n // TODO #22198\n await writeLocalFile(yarnRcYmlFilename!, existingYarnrcYmlContent);\n }\n }\n\n for (const pnpmShrinkwrap of dirs.pnpmShrinkwrapDirs) {\n const lockFileDir = upath.dirname(pnpmShrinkwrap);\n const npmrcContent = await getNpmrcContent(lockFileDir);\n await updateNpmrcContent(lockFileDir, npmrcContent, additionalNpmrcContent);\n logger.debug(`Generating pnpm-lock.yaml for ${lockFileDir}`);\n const upgrades = config.upgrades.filter(\n (upgrade) => upgrade.managerData?.pnpmShrinkwrap === pnpmShrinkwrap,\n );\n const res = await pnpm.generateLockFile(lockFileDir, env, config, upgrades);\n if (res.error) {\n // istanbul ignore if\n if (res.stdout?.includes(`No compatible version found:`)) {\n for (const upgrade of config.upgrades) {\n if (\n res.stdout.includes(\n `No compatible version found: ${upgrade.depName}`,\n )\n ) {\n logger.debug(\n { dependency: upgrade.depName, type: 'pnpm' },\n 'lock file failed for the dependency being updated - skipping branch creation',\n );\n throw new ExternalHostError(\n Error(\n 'lock file failed for the dependency being updated - skipping branch creation',\n ),\n NpmDatasource.id,\n );\n }\n }\n }\n artifactErrors.push({\n lockFile: pnpmShrinkwrap,\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n stderr: res.stderr || res.stdout,\n });\n } else {\n const existingContent = await getFile(\n pnpmShrinkwrap,\n config.reuseExistingBranch ? config.branchName : config.baseBranch,\n );\n if (res.lockFile === existingContent) {\n logger.debug(\"pnpm-lock.yaml hasn't changed\");\n } else {\n logger.debug('pnpm-lock.yaml needs updating');\n updatedArtifacts.push({\n type: 'addition',\n path: pnpmShrinkwrap,\n // TODO: can be undefined? (#22198)\n contents: res.lockFile!,\n });\n }\n }\n await resetNpmrcContent(lockFileDir, npmrcContent);\n }\n\n return { artifactErrors, updatedArtifacts };\n}\n"]}
|
@@ -9,6 +9,7 @@ const composer = tslib_1.__importStar(require("./composer"));
|
|
9
9
|
const conan = tslib_1.__importStar(require("./conan"));
|
10
10
|
const deb = tslib_1.__importStar(require("./deb"));
|
11
11
|
const debian = tslib_1.__importStar(require("./debian"));
|
12
|
+
const devbox = tslib_1.__importStar(require("./devbox"));
|
12
13
|
const docker = tslib_1.__importStar(require("./docker"));
|
13
14
|
const git = tslib_1.__importStar(require("./git"));
|
14
15
|
const glasskube = tslib_1.__importStar(require("./glasskube"));
|
@@ -52,6 +53,7 @@ api.set(composer.id, composer.api);
|
|
52
53
|
api.set(conan.id, conan.api);
|
53
54
|
api.set(deb.id, deb.api);
|
54
55
|
api.set(debian.id, debian.api);
|
56
|
+
api.set(devbox.id, devbox.api);
|
55
57
|
api.set(docker.id, docker.api);
|
56
58
|
api.set(git.id, git.api);
|
57
59
|
api.set(glasskube.id, glasskube.api);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../lib/modules/versioning/api.ts"],"names":[],"mappings":";;;AAAA,gFAA0D;AAC1D,uEAAiD;AACjD,oEAA8C;AAC9C,uDAAiC;AACjC,6DAAuC;AACvC,uDAAiC;AACjC,mDAA6B;AAC7B,yDAAmC;AACnC,yDAAmC;AACnC,mDAA6B;AAC7B,+DAAyC;AACzC,2EAAqD;AACrD,yDAAmC;AACnC,+DAAyC;AACzC,qDAA+B;AAC/B,yDAAmC;AACnC,mDAA6B;AAC7B,mDAA6B;AAC7B,wEAAkD;AAClD,uDAAiC;AACjC,uDAAiC;AACjC,2DAAqC;AACrC,qDAA+B;AAC/B,mDAA6B;AAC7B,uDAAiC;AACjC,yDAAmC;AACnC,qDAA+B;AAC/B,yDAAmC;AACnC,mDAA6B;AAC7B,yDAAmC;AACnC,yDAAmC;AACnC,uDAAiC;AACjC,mDAA6B;AAC7B,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onMachineImage from './aws-machine-image';\nimport * as azureRestApi from './azure-rest-api';\nimport * as bazelModule from './bazel-module';\nimport * as cargo from './cargo';\nimport * as composer from './composer';\nimport * as conan from './conan';\nimport * as deb from './deb';\nimport * as debian from './debian';\nimport * as docker from './docker';\nimport * as git from './git';\nimport * as glasskube from './glasskube';\nimport * as goModDirective from './go-mod-directive';\nimport * as gradle from './gradle';\nimport * as hashicorp from './hashicorp';\nimport * as helm from './helm';\nimport * as hermit from './hermit';\nimport * as hex from './hex';\nimport * as ivy from './ivy';\nimport * as kubernetesApi from './kubernetes-api';\nimport * as loose from './loose';\nimport * as maven from './maven';\nimport * as nixpkgs from './nixpkgs';\nimport * as node from './node';\nimport * as npm from './npm';\nimport * as nuget from './nuget';\nimport * as pep440 from './pep440';\nimport * as perl from './perl';\nimport * as poetry from './poetry';\nimport * as pvp from './pvp';\nimport * as python from './python';\nimport * as redhat from './redhat';\nimport * as regex from './regex';\nimport * as rez from './rez';\nimport * as rpm from './rpm';\nimport * as ruby from './ruby';\nimport * as sameMajor from './same-major';\nimport * as semver from './semver';\nimport * as semverCoerced from './semver-coerced';\nimport * as swift from './swift';\nimport type { VersioningApi, VersioningApiConstructor } from './types';\nimport * as ubuntu from './ubuntu';\nimport * as unity3d from './unity3d';\n\nconst api = new Map<string, VersioningApi | VersioningApiConstructor>();\nexport default api;\n\napi.set(amazonMachineImage.id, amazonMachineImage.api);\napi.set(azureRestApi.id, azureRestApi.api);\napi.set(bazelModule.id, bazelModule.api);\napi.set(cargo.id, cargo.api);\napi.set(composer.id, composer.api);\napi.set(conan.id, conan.api);\napi.set(deb.id, deb.api);\napi.set(debian.id, debian.api);\napi.set(docker.id, docker.api);\napi.set(git.id, git.api);\napi.set(glasskube.id, glasskube.api);\napi.set(goModDirective.id, goModDirective.api);\napi.set(gradle.id, gradle.api);\napi.set(hashicorp.id, hashicorp.api);\napi.set(helm.id, helm.api);\napi.set(hermit.id, hermit.api);\napi.set(hex.id, hex.api);\napi.set(ivy.id, ivy.api);\napi.set(kubernetesApi.id, kubernetesApi.api);\napi.set(loose.id, loose.api);\napi.set(maven.id, maven.api);\napi.set(nixpkgs.id, nixpkgs.api);\napi.set(node.id, node.api);\napi.set(npm.id, npm.api);\napi.set(nuget.id, nuget.api);\napi.set(pep440.id, pep440.api);\napi.set(perl.id, perl.api);\napi.set(poetry.id, poetry.api);\napi.set(pvp.id, pvp.api);\napi.set(python.id, python.api);\napi.set(redhat.id, redhat.api);\napi.set(regex.id, regex.api);\napi.set(rez.id, rez.api);\napi.set(rpm.id, rpm.api);\napi.set(ruby.id, ruby.api);\napi.set(sameMajor.id, sameMajor.api);\napi.set(semver.id, semver.api);\napi.set(semverCoerced.id, semverCoerced.api);\napi.set(swift.id, swift.api);\napi.set(ubuntu.id, ubuntu.api);\napi.set(unity3d.id, unity3d.api);\n"]}
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../lib/modules/versioning/api.ts"],"names":[],"mappings":";;;AAAA,gFAA0D;AAC1D,uEAAiD;AACjD,oEAA8C;AAC9C,uDAAiC;AACjC,6DAAuC;AACvC,uDAAiC;AACjC,mDAA6B;AAC7B,yDAAmC;AACnC,yDAAmC;AACnC,yDAAmC;AACnC,mDAA6B;AAC7B,+DAAyC;AACzC,2EAAqD;AACrD,yDAAmC;AACnC,+DAAyC;AACzC,qDAA+B;AAC/B,yDAAmC;AACnC,mDAA6B;AAC7B,mDAA6B;AAC7B,wEAAkD;AAClD,uDAAiC;AACjC,uDAAiC;AACjC,2DAAqC;AACrC,qDAA+B;AAC/B,mDAA6B;AAC7B,uDAAiC;AACjC,yDAAmC;AACnC,qDAA+B;AAC/B,yDAAmC;AACnC,mDAA6B;AAC7B,yDAAmC;AACnC,yDAAmC;AACnC,uDAAiC;AACjC,mDAA6B;AAC7B,mDAA6B;AAC7B,qDAA+B;AAC/B,gEAA0C;AAC1C,yDAAmC;AACnC,wEAAkD;AAClD,uDAAiC;AAEjC,yDAAmC;AACnC,2DAAqC;AAEr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i from './azure-rest-api';\nimport * as bazelModule from './bazel-module';\nimport * as cargo from './cargo';\nimport * as composer from './composer';\nimport * as conan from './conan';\nimport * as deb from './deb';\nimport * as debian from './debian';\nimport * as devbox from './devbox';\nimport * as docker from './docker';\nimport * as git from './git';\nimport * as glasskube from './glasskube';\nimport * as goModDirective from './go-mod-directive';\nimport * as gradle from './gradle';\nimport * as hashicorp from './hashicorp';\nimport * as helm from './helm';\nimport * as hermit from './hermit';\nimport * as hex from './hex';\nimport * as ivy from './ivy';\nimport * as kubernetesApi from './kubernetes-api';\nimport * as loose from './loose';\nimport * as maven from './maven';\nimport * as nixpkgs from './nixpkgs';\nimport * as node from './node';\nimport * as npm from './npm';\nimport * as nuget from './nuget';\nimport * as pep440 from './pep440';\nimport * as perl from './perl';\nimport * as poetry from './poetry';\nimport * as pvp from './pvp';\nimport * as python from './python';\nimport * as redhat from './redhat';\nimport * as regex from './regex';\nimport * as rez from './rez';\nimport * as rpm from './rpm';\nimport * as ruby from './ruby';\nimport * as sameMajor from './same-major';\nimport * as semver from './semver';\nimport * as semverCoerced from './semver-coerced';\nimport * as swift from './swift';\nimport type { VersioningApi, VersioningApiConstructor } from './types';\nimport * as ubuntu from './ubuntu';\nimport * as unity3d from './unity3d';\n\nconst api = new Map<string, VersioningApi | VersioningApiConstructor>();\nexport default api;\n\napi.set(amazonMachineImage.id, amazonMachineImage.api);\napi.set(azureRestApi.id, azureRestApi.api);\napi.set(bazelModule.id, bazelModule.api);\napi.set(cargo.id, cargo.api);\napi.set(composer.id, composer.api);\napi.set(conan.id, conan.api);\napi.set(deb.id, deb.api);\napi.set(debian.id, debian.api);\napi.set(devbox.id, devbox.api);\napi.set(docker.id, docker.api);\napi.set(git.id, git.api);\napi.set(glasskube.id, glasskube.api);\napi.set(goModDirective.id, goModDirective.api);\napi.set(gradle.id, gradle.api);\napi.set(hashicorp.id, hashicorp.api);\napi.set(helm.id, helm.api);\napi.set(hermit.id, hermit.api);\napi.set(hex.id, hex.api);\napi.set(ivy.id, ivy.api);\napi.set(kubernetesApi.id, kubernetesApi.api);\napi.set(loose.id, loose.api);\napi.set(maven.id, maven.api);\napi.set(nixpkgs.id, nixpkgs.api);\napi.set(node.id, node.api);\napi.set(npm.id, npm.api);\napi.set(nuget.id, nuget.api);\napi.set(pep440.id, pep440.api);\napi.set(perl.id, perl.api);\napi.set(poetry.id, poetry.api);\napi.set(pvp.id, pvp.api);\napi.set(python.id, python.api);\napi.set(redhat.id, redhat.api);\napi.set(regex.id, regex.api);\napi.set(rez.id, rez.api);\napi.set(rpm.id, rpm.api);\napi.set(ruby.id, ruby.api);\napi.set(sameMajor.id, sameMajor.api);\napi.set(semver.id, semver.api);\napi.set(semverCoerced.id, semverCoerced.api);\napi.set(swift.id, swift.api);\napi.set(ubuntu.id, ubuntu.api);\napi.set(unity3d.id, unity3d.api);\n"]}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { VersioningApi } from '../types';
|
2
|
+
export declare const id = "devbox";
|
3
|
+
export declare const displayName = "devbox";
|
4
|
+
export declare const urls: never[];
|
5
|
+
export declare const supportsRanges = false;
|
6
|
+
export declare const api: VersioningApi;
|
7
|
+
export default api;
|
@@ -0,0 +1,65 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.api = exports.supportsRanges = exports.urls = exports.displayName = exports.id = void 0;
|
4
|
+
const regex_1 = require("../../../util/regex");
|
5
|
+
const generic_1 = require("../generic");
|
6
|
+
exports.id = 'devbox';
|
7
|
+
exports.displayName = 'devbox';
|
8
|
+
exports.urls = [];
|
9
|
+
exports.supportsRanges = false;
|
10
|
+
const validPattern = (0, regex_1.regEx)(/^((\d|[1-9]\d*)(\.(\d|[1-9]\d*)){0,2})$/);
|
11
|
+
const versionPattern = (0, regex_1.regEx)(/^((\d|[1-9]\d*)(\.(\d|[1-9]\d*)){2})$/);
|
12
|
+
class DevboxVersioningApi extends generic_1.GenericVersioningApi {
|
13
|
+
_parse(version) {
|
14
|
+
const matches = validPattern.exec(version);
|
15
|
+
if (!matches) {
|
16
|
+
return null;
|
17
|
+
}
|
18
|
+
const release = matches[0].split('.').map(Number);
|
19
|
+
return { release };
|
20
|
+
}
|
21
|
+
isValid(version) {
|
22
|
+
if (version === 'latest') {
|
23
|
+
return true;
|
24
|
+
}
|
25
|
+
return this._parse(version) !== null;
|
26
|
+
}
|
27
|
+
isVersion(version) {
|
28
|
+
if (version === 'latest') {
|
29
|
+
return false;
|
30
|
+
}
|
31
|
+
const matches = versionPattern.exec(version);
|
32
|
+
return !!matches;
|
33
|
+
}
|
34
|
+
matches(version, range) {
|
35
|
+
return this.isVersion(version) && this.equals(version, range);
|
36
|
+
}
|
37
|
+
_compare(version, other) {
|
38
|
+
const parsed1 = this._parse(version);
|
39
|
+
const parsed2 = this._parse(other);
|
40
|
+
// Treat "latest" as * and always return equal
|
41
|
+
if (other === 'latest' && parsed1) {
|
42
|
+
return 0;
|
43
|
+
}
|
44
|
+
// If either version is invalid, return unequal
|
45
|
+
if (!(parsed1 && parsed2)) {
|
46
|
+
return 1;
|
47
|
+
}
|
48
|
+
// support variable length compare
|
49
|
+
const length = Math.max(parsed1.release.length, parsed2.release.length);
|
50
|
+
for (let i = 0; i < length; i += 1) {
|
51
|
+
// 2.1 and 2.1.0 are equivalent
|
52
|
+
const part1 = parsed1.release[i];
|
53
|
+
const part2 = parsed2.release[i];
|
54
|
+
// if part1 or part2 is undefined, we should treat them as equal
|
55
|
+
// e.g. 1.0.0 === 1.0
|
56
|
+
if (part1 !== undefined && part2 !== undefined && part1 !== part2) {
|
57
|
+
return part1 - part2;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
return 0;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
exports.api = new DevboxVersioningApi();
|
64
|
+
exports.default = exports.api;
|
65
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/modules/versio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C,CAAC;IAChE,CAAC;IAEkB,QAAQ,CAAC,OAAe,EAAE,KAAa;QACxD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEnC,8CAA8C;QAC9C,IAAI,KAAK,KAAK,QAAQ,IAAI,OAAO,EAAE,CAAC;YAClC,OAAO,CAAC,CAAC;QACX,CAAC;QAED,+CAA+C;QAC/C,IAAI,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,EAAE,CAAC;YAC1B,OAAO,CAAC,CAAC;QACX,CAAC;QACD,kCAAkC;QAClC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACxE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YACnC,+BAA+B;YAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACjC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACjC,gEAAgE;YAChE,qBAAqB;YACrB,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;gBAClE,OAAO,KAAK,GAAG,KAAK,CAAC;YACvB,CAAC;QACH,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AAEY,QAAA,GAAG,GAAkB,IAAI,mBAAmB,EAAE,CAAC;AAE5D,kBAAe,WAAG,CAAC","sourcesContent":["import { regEx } from '../../../util/regex';\nimport type { GenericVersion } from '../generic';\nimport { GenericVersioningApi } from '../generic';\nimport type { VersioningApi } from '../types';\n\nexport const id = 'devbox';\nexport const displayName = 'devbox';\nexport const urls = [];\nexport const supportsRanges = false;\n\nconst validPattern = regEx(/^((\\d|[1-9]\\d*)(\\.(\\d|[1-9]\\d*)){0,2})$/);\nconst versionPattern = regEx(/^((\\d|[1-9]\\d*)(\\.(\\d|[1-9]\\d*)){2})$/);\n\nclass DevboxVersioningApi extends GenericVersioningApi {\n protected _parse(version: string): GenericVersion | null {\n const matches = validPattern.exec(version);\n if (!matches) {\n return null;\n }\n const release = matches[0].split('.').map(Number);\n return { release };\n }\n\n override isValid(version: string): boolean {\n if (version === 'latest') {\n return true;\n }\n return this._parse(version) !== null;\n }\n\n override isVersion(version: string): boolean {\n if (version === 'latest') {\n return false;\n }\n const matches = versionPattern.exec(version);\n return !!matches;\n }\n\n override matches(version: string, range: string): boolean {\n return this.isVersion(version) && this.equals(version, range);\n }\n\n protected override _compare(version: string, other: string): number {\n const parsed1 = this._parse(version);\n const parsed2 = this._parse(other);\n\n // Treat \"latest\" as * and always return equal\n if (other === 'latest' && parsed1) {\n return 0;\n }\n\n // If either version is invalid, return unequal\n if (!(parsed1 && parsed2)) {\n return 1;\n }\n // support variable length compare\n const length = Math.max(parsed1.release.length, parsed2.release.length);\n for (let i = 0; i < length; i += 1) {\n // 2.1 and 2.1.0 are equivalent\n const part1 = parsed1.release[i];\n const part2 = parsed2.release[i];\n // if part1 or part2 is undefined, we should treat them as equal\n // e.g. 1.0.0 === 1.0\n if (part1 !== undefined && part2 !== undefined && part1 !== part2) {\n return part1 - part2;\n }\n }\n return 0;\n }\n}\n\nexport const api: VersioningApi = new DevboxVersioningApi();\n\nexport default api;\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../../../lib/workers/global/config/parse/env.ts"],"names":[],"mappings":";;AA0BA,gCASC;AAmFD,8BA4HC;;AAlPD,kEAAkC;AAClC,0DAA0B;AAC1B,wDAAwD;AAExD,+CAA4C;AAC5C,2CAAwC;AAExC,iCAAkD;AAElD,SAAS,iBAAiB,CACxB,GAAsB,E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CAAC;wBACrC,IAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAY,KAAK,MAAM,EAAE,CAAC;4BAC/C,eAAM,CAAC,IAAI,CACT,gEAAgE,CACjE,CAAC;4BACF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;wBAClC,CAAC;6BAAM,IAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAY,KAAK,OAAO,EAAE,CAAC;4BACvD,eAAM,CAAC,IAAI,CACT,iEAAiE,CAClE,CAAC;4BACF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC;wBACnC,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,GAAG,CAAC,gBAAgB,EAAE,CAAC;QACzB,eAAM,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACpE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;YACpB,QAAQ,EAAE,QAAQ;YAClB,SAAS,EAAE,YAAY;YACvB,KAAK,EAAE,GAAG,CAAC,gBAAgB;SAC5B,CAAC,CAAC;IACL,CAAC;IAED,0EAA0E;IAC1E,MAAM,cAAc,GAAG;QACrB,iBAAiB;QACjB,oBAAoB;QACpB,oBAAoB;QACpB,iBAAiB;QACjB,cAAc;QACd,iBAAiB;QACjB,cAAc;QACd,eAAe;QACf,YAAY;KACb,CAAC;IAEF,cAAc,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAEjD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport JSON5 from 'json5';\nimport { getOptions } from '../../../../config/options';\nimport type { AllConfig } from '../../../../config/types';\nimport { logger } from '../../../../logger';\nimport { coersions } from './coersions';\nimport type { ParseConfigOptions } from './types';\nimport { migrateAndValidateConfig } from './util';\n\nfunction normalizePrefixes(\n env: NodeJS.ProcessEnv,\n prefix: string | undefined,\n): NodeJS.ProcessEnv {\n const result = { ...env };\n if (prefix) {\n for (const [key, val] of Object.entries(result)) {\n if (key.startsWith(prefix)) {\n const newKey = key.replace(prefix, 'RENOVATE_');\n result[newKey] = val;\n delete result[key];\n }\n }\n }\n return result;\n}\n\nexport function getEnvName(option: ParseConfigOptions): string {\n if (option.env === false) {\n return '';\n }\n if (option.env) {\n return option.env;\n }\n const nameWithUnderscores = option.name.replace(/([A-Z])/g, '_$1');\n return `RENOVATE_${nameWithUnderscores.toUpperCase()}`;\n}\n\nconst renameKeys = {\n aliases: 'registryAliases',\n azureAutoComplete: 'platformAutomerge', // migrate: azureAutoComplete\n gitLabAutomerge: 'platformAutomerge', // migrate: gitLabAutomerge\n mergeConfidenceApiBaseUrl: 'mergeConfidenceEndpoint',\n mergeConfidenceSupportedDatasources: 'mergeConfidenceDatasources',\n};\n\nfunction renameEnvKeys(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {\n const result = { ...env };\n for (const [from, to] of Object.entries(renameKeys)) {\n const fromKey = getEnvName({ name: from });\n const toKey = getEnvName({ name: to });\n if (env[fromKey]) {\n result[toKey] = env[fromKey];\n delete result[fromKey];\n }\n }\n return result;\n}\n\nconst migratedKeysWithValues = [\n {\n oldName: 'recreateClosed',\n newName: 'recreateWhen',\n from: 'true',\n to: 'always',\n },\n {\n oldName: 'recreateClosed',\n newName: 'recreateWhen',\n from: 'false',\n to: 'auto',\n },\n];\n\nfunction massageEnvKeyValues(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {\n const result = { ...env };\n for (const { oldName, newName, from, to } of migratedKeysWithValues) {\n const key = getEnvName({ name: oldName });\n if (env[key] !== undefined) {\n if (result[key] === from) {\n delete result[key];\n result[getEnvName({ name: newName })] = to;\n }\n }\n }\n return result;\n}\n\n// these experimental env vars have been converted into self-hosted config options\nconst convertedExperimentalEnvVars = [\n 'RENOVATE_X_AUTODISCOVER_REPO_SORT',\n 'RENOVATE_X_AUTODISCOVER_REPO_ORDER',\n 'RENOVATE_X_DOCKER_MAX_PAGES',\n 'RENOVATE_X_DELETE_CONFIG_FILE',\n 'RENOVATE_X_S3_ENDPOINT',\n 'RENOVATE_X_S3_PATH_STYLE',\n 'RENOVATE_X_MERGE_CONFIDENCE_API_BASE_URL',\n 'RENOVATE_X_MERGE_CONFIDENCE_SUPPORTED_DATASOURCES',\n];\n\n/**\n * Massages the experimental env vars which have been converted to config options\n *\n * e.g. RENOVATE_X_AUTODISCOVER_REPO_SORT -> RENOVATE_AUTODISCOVER_REPO_SORT\n */\nfunction massageConvertedExperimentalVars(\n env: NodeJS.ProcessEnv,\n): NodeJS.ProcessEnv {\n const result = { ...env };\n for (const key of convertedExperimentalEnvVars) {\n if (env[key] !== undefined) {\n const newKey = key.replace('RENOVATE_X_', 'RENOVATE_');\n result[newKey] = env[key];\n delete result[key];\n }\n }\n return result;\n}\n\nexport async function getConfig(\n inputEnv: NodeJS.ProcessEnv,\n): Promise<AllConfig> {\n let env = inputEnv;\n env = normalizePrefixes(inputEnv, inputEnv.ENV_PREFIX);\n env = massageConvertedExperimentalVars(env);\n env = renameEnvKeys(env);\n // massage the values of migrated configuration keys\n env = massageEnvKeyValues(env);\n\n const options = getOptions();\n\n let config: AllConfig = {};\n\n if (env.RENOVATE_CONFIG) {\n try {\n config = JSON5.parse(env.RENOVATE_CONFIG);\n logger.debug({ config }, 'Detected config in env RENOVATE_CONFIG');\n\n config = await migrateAndValidateConfig(config, 'RENOVATE_CONFIG');\n } catch (err) {\n logger.fatal({ err }, 'Could not parse RENOVATE_CONFIG');\n process.exit(1);\n }\n }\n\n config.hostRules ||= [];\n\n options.forEach((option) => {\n if (option.env !== false) {\n const envName = getEnvName(option);\n const envVal = env[envName];\n if (envVal) {\n if (option.type === 'array' && option.subType === 'object') {\n try {\n const parsed = JSON5.parse(envVal);\n if (is.array(parsed)) {\n config[option.name] = parsed;\n } else {\n logger.debug(\n { val: envVal, envName },\n 'Could not parse object array',\n );\n }\n } catch {\n logger.debug(\n { val: envVal, envName },\n 'Could not parse environment variable',\n );\n }\n } else {\n const coerce = coersions[option.type];\n config[option.name] = coerce(envVal);\n if (option.name === 'dryRun') {\n if ((config[option.name] as string) === 'true') {\n logger.warn(\n 'env config dryRun property has been changed to full',\n );\n config[option.name] = 'full';\n } else if ((config[option.name] as string) === 'false') {\n logger.warn(\n 'env config dryRun property has been changed to null',\n );\n delete config[option.name];\n } else if ((config[option.name] as string) === 'null') {\n delete config[option.name];\n }\n }\n if (option.name === 'requireConfig') {\n if ((config[option.name] as string) === 'true') {\n logger.warn(\n 'env config requireConfig property has been changed to required',\n );\n config[option.name] = 'required';\n } else if ((config[option.name] as string) === 'false') {\n logger.warn(\n 'env config requireConfig property has been changed to optional',\n );\n config[option.name] = 'optional';\n }\n }\n if (option.name === 'platformCommit') {\n if ((config[option.name] as string) === 'true') {\n logger.warn(\n 'env config platformCommit property has been changed to enabled',\n );\n config[option.name] = 'enabled';\n } else if ((config[option.name] as string) === 'false') {\n logger.warn(\n 'env config platformCommit property has been changed to disabled',\n );\n config[option.name] = 'disabled';\n }\n }\n }\n }\n }\n });\n\n if (env.GITHUB_COM_TOKEN) {\n logger.debug(`Converting GITHUB_COM_TOKEN into a global host rule`);\n config.hostRules.push({\n hostType: 'github',\n matchHost: 'github.com',\n token: env.GITHUB_COM_TOKEN,\n });\n }\n\n // These env vars are deprecated and deleted to make sure they're not used\n const unsupportedEnv = [\n 'BITBUCKET_TOKEN',\n 'BITBUCKET_USERNAME',\n 'BITBUCKET_PASSWORD',\n 'GITHUB_ENDPOINT',\n 'GITHUB_TOKEN',\n 'GITLAB_ENDPOINT',\n 'GITLAB_TOKEN',\n 'VSTS_ENDPOINT',\n 'VSTS_TOKEN',\n ];\n\n unsupportedEnv.forEach((val) => delete env[val]);\n\n return config;\n}\n"]}
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../../../lib/workers/global/config/parse/env.ts"],"names":[],"mappings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json5';\nimport { getOptions } from '../../../../config/options';\nimport type { AllConfig } from '../../../../config/types';\nimport { logger } from '../../../../logger';\nimport { coersions } from './coersions';\nimport type { ParseConfigOptions } from './types';\nimport { migrateAndValidateConfig } from './util';\n\nfunction normalizePrefixes(\n env: NodeJS.ProcessEnv,\n prefix: string | undefined,\n): NodeJS.ProcessEnv {\n const result = { ...env };\n if (prefix) {\n for (const [key, val] of Object.entries(result)) {\n if (key.startsWith(prefix)) {\n const newKey = key.replace(prefix, 'RENOVATE_');\n result[newKey] = val;\n delete result[key];\n }\n }\n }\n return result;\n}\n\nexport function getEnvName(option: ParseConfigOptions): string {\n if (option.env === false) {\n return '';\n }\n if (option.env) {\n return option.env;\n }\n const nameWithUnderscores = option.name.replace(/([A-Z])/g, '_$1');\n return `RENOVATE_${nameWithUnderscores.toUpperCase()}`;\n}\n\nconst renameKeys = {\n aliases: 'registryAliases',\n azureAutoComplete: 'platformAutomerge', // migrate: azureAutoComplete\n gitLabAutomerge: 'platformAutomerge', // migrate: gitLabAutomerge\n mergeConfidenceApiBaseUrl: 'mergeConfidenceEndpoint',\n mergeConfidenceSupportedDatasources: 'mergeConfidenceDatasources',\n};\n\nfunction renameEnvKeys(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {\n const result = { ...env };\n for (const [from, to] of Object.entries(renameKeys)) {\n const fromKey = getEnvName({ name: from });\n const toKey = getEnvName({ name: to });\n if (env[fromKey]) {\n result[toKey] = env[fromKey];\n delete result[fromKey];\n }\n }\n return result;\n}\n\nconst migratedKeysWithValues = [\n {\n oldName: 'recreateClosed',\n newName: 'recreateWhen',\n from: 'true',\n to: 'always',\n },\n {\n oldName: 'recreateClosed',\n newName: 'recreateWhen',\n from: 'false',\n to: 'auto',\n },\n];\n\nfunction massageEnvKeyValues(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {\n const result = { ...env };\n for (const { oldName, newName, from, to } of migratedKeysWithValues) {\n const key = getEnvName({ name: oldName });\n if (env[key] !== undefined) {\n if (result[key] === from) {\n delete result[key];\n result[getEnvName({ name: newName })] = to;\n }\n }\n }\n return result;\n}\n\n// these experimental env vars have been converted into self-hosted config options\nconst convertedExperimentalEnvVars = [\n 'RENOVATE_X_AUTODISCOVER_REPO_SORT',\n 'RENOVATE_X_AUTODISCOVER_REPO_ORDER',\n 'RENOVATE_X_DOCKER_MAX_PAGES',\n 'RENOVATE_X_DELETE_CONFIG_FILE',\n 'RENOVATE_X_S3_ENDPOINT',\n 'RENOVATE_X_S3_PATH_STYLE',\n 'RENOVATE_X_MERGE_CONFIDENCE_API_BASE_URL',\n 'RENOVATE_X_MERGE_CONFIDENCE_SUPPORTED_DATASOURCES',\n];\n\n/**\n * Massages the experimental env vars which have been converted to config options\n *\n * e.g. RENOVATE_X_AUTODISCOVER_REPO_SORT -> RENOVATE_AUTODISCOVER_REPO_SORT\n */\nfunction massageConvertedExperimentalVars(\n env: NodeJS.ProcessEnv,\n): NodeJS.ProcessEnv {\n const result = { ...env };\n for (const key of convertedExperimentalEnvVars) {\n if (env[key] !== undefined) {\n const newKey = key.replace('RENOVATE_X_', 'RENOVATE_');\n result[newKey] = env[key];\n delete result[key];\n }\n }\n return result;\n}\n\nexport async function getConfig(\n inputEnv: NodeJS.ProcessEnv,\n): Promise<AllConfig> {\n let env = inputEnv;\n env = normalizePrefixes(inputEnv, inputEnv.ENV_PREFIX);\n env = massageConvertedExperimentalVars(env);\n env = renameEnvKeys(env);\n // massage the values of migrated configuration keys\n env = massageEnvKeyValues(env);\n\n const options = getOptions();\n\n let config: AllConfig = {};\n\n if (env.RENOVATE_CONFIG) {\n try {\n config = JSON5.parse(env.RENOVATE_CONFIG);\n logger.debug({ config }, 'Detected config in env RENOVATE_CONFIG');\n\n config = await migrateAndValidateConfig(config, 'RENOVATE_CONFIG');\n } catch (err) {\n logger.fatal({ err }, 'Could not parse RENOVATE_CONFIG');\n process.exit(1);\n }\n }\n\n config.hostRules ??= [];\n\n options.forEach((option) => {\n if (option.env !== false) {\n const envName = getEnvName(option);\n const envVal = env[envName];\n if (envVal) {\n if (option.type === 'array' && option.subType === 'object') {\n try {\n const parsed = JSON5.parse(envVal);\n if (is.array(parsed)) {\n config[option.name] = parsed;\n } else {\n logger.debug(\n { val: envVal, envName },\n 'Could not parse object array',\n );\n }\n } catch {\n logger.debug(\n { val: envVal, envName },\n 'Could not parse environment variable',\n );\n }\n } else {\n const coerce = coersions[option.type];\n config[option.name] = coerce(envVal);\n if (option.name === 'dryRun') {\n if ((config[option.name] as string) === 'true') {\n logger.warn(\n 'env config dryRun property has been changed to full',\n );\n config[option.name] = 'full';\n } else if ((config[option.name] as string) === 'false') {\n logger.warn(\n 'env config dryRun property has been changed to null',\n );\n delete config[option.name];\n } else if ((config[option.name] as string) === 'null') {\n delete config[option.name];\n }\n }\n if (option.name === 'requireConfig') {\n if ((config[option.name] as string) === 'true') {\n logger.warn(\n 'env config requireConfig property has been changed to required',\n );\n config[option.name] = 'required';\n } else if ((config[option.name] as string) === 'false') {\n logger.warn(\n 'env config requireConfig property has been changed to optional',\n );\n config[option.name] = 'optional';\n }\n }\n if (option.name === 'platformCommit') {\n if ((config[option.name] as string) === 'true') {\n logger.warn(\n 'env config platformCommit property has been changed to enabled',\n );\n config[option.name] = 'enabled';\n } else if ((config[option.name] as string) === 'false') {\n logger.warn(\n 'env config platformCommit property has been changed to disabled',\n );\n config[option.name] = 'disabled';\n }\n }\n }\n }\n }\n });\n\n if (env.GITHUB_COM_TOKEN) {\n logger.debug(`Converting GITHUB_COM_TOKEN into a global host rule`);\n config.hostRules.push({\n hostType: 'github',\n matchHost: 'github.com',\n token: env.GITHUB_COM_TOKEN,\n });\n }\n\n // These env vars are deprecated and deleted to make sure they're not used\n const unsupportedEnv = [\n 'BITBUCKET_TOKEN',\n 'BITBUCKET_USERNAME',\n 'BITBUCKET_PASSWORD',\n 'GITHUB_ENDPOINT',\n 'GITHUB_TOKEN',\n 'GITLAB_ENDPOINT',\n 'GITLAB_TOKEN',\n 'VSTS_ENDPOINT',\n 'VSTS_TOKEN',\n ];\n\n unsupportedEnv.forEach((val) => delete env[val]);\n\n return config;\n}\n"]}
|
@@ -83,9 +83,9 @@ async function detectVulnerabilityAlerts(input) {
|
|
83
83
|
const fileType = fileName.split('/').pop();
|
84
84
|
const firstPatchedVersion = alert.security_vulnerability.first_patched_version.identifier;
|
85
85
|
const advisory = alert.security_advisory;
|
86
|
-
combinedAlerts[fileName]
|
87
|
-
combinedAlerts[fileName][datasource]
|
88
|
-
combinedAlerts[fileName][datasource][depName]
|
86
|
+
combinedAlerts[fileName] ??= {};
|
87
|
+
combinedAlerts[fileName][datasource] ??= {};
|
88
|
+
combinedAlerts[fileName][datasource][depName] ??= {
|
89
89
|
advisories: [],
|
90
90
|
};
|
91
91
|
const alertDetails = combinedAlerts[fileName][datasource][depName];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"vulnerability.js","sourceRoot":"","sources":["../../../../lib/workers/repository/init/vulnerability.ts"],"names":[],"mappings":";;AAyCA,kEAUC;AAGD,8DA8JC;;AAnND,sEAA4E;AAC5E,4CAAyC;AACzC,6DAAoE;AACpE,uDAA8D;AAC9D,6DAAoE;AACpE,yDAAgE;AAChE,6DAAoE;AACpE,qEAA4E;AAC5E,2DAAkE;AAClE,mEAA0E;AAC1E,wDAAqD;AACrD,mFAA6D;AAC7D,iGAA2E;AAC3E,2FAAqE;AACrE,uFAAiE;AACjE,6FAAuE;AACvE,yFAAmE;AACnE,6FAAuE;AAEvE,qDAA0D;AAqB1D,SAAgB,2BAA2B,CACzC,YAAoB,EACpB,UAAkB;IAElB,IAAI,UAAU,KAAK,uBAAe,CAAC,EAAE,IAAI,UAAU,KAAK,uBAAe,CAAC,EAAE,EAAE,CAAC;QAC3E,OAAO,IAAI,YAAY,IAAI,CAAC;IAC9B,CAAC;IAED,0CAA0C;IAC1C,OAAO,MAAM,YAAY,EAAE,CAAC;AAC9B,CAAC;AAED,kDAAkD;AAC3C,KAAK,UAAU,yBAAyB,CAC7C,KA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O,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBACxC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;gBACjB,IAAI,SAAS,GAAgB;oBAC3B,gBAAgB,EAAE,CAAC,UAAU,CAAC;oBAC9B,iBAAiB,EAAE,CAAC,OAAO,CAAC;oBAC5B,cAAc;iBACf,CAAC;gBAEF,IAAI,mBAAmB,GAAG,KAAK,GAAG,CAAC,mBAAmB,EAAE,CAAC;gBACzD,IACE,UAAU,KAAK,uBAAe,CAAC,EAAE;oBACjC,UAAU,KAAK,uBAAe,CAAC,EAAE,EACjC,CAAC;oBACD,mBAAmB,GAAG,KAAK,GAAG,CAAC,mBAAmB,GAAG,CAAC;gBACxD,CAAC;gBAED,qCAAqC;gBACrC,SAAS,GAAG;oBACV,GAAG,SAAS;oBACZ,mBAAmB;oBACnB,uBAAuB,EAAE,GAAG,CAAC,mBAAmB;oBAChD,WAAW;oBACX,oBAAoB,EAAE,IAAI;oBAC1B,KAAK,EAAE;wBACL,GAAG,MAAM,CAAC,mBAAmB;qBAC9B;iBACF,CAAC;gBACF,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;IACH,CAAC;IACD,eAAM,CAAC,KAAK,CAAC,EAAE,iBAAiB,EAAE,EAAE,qBAAqB,CAAC,CAAC;IAC3D,MAAM,CAAC,YAAY,GAAG,CAAC,MAAM,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC5E,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { PackageRule, RenovateConfig } from '../../../config/types';\nimport { NO_VULNERABILITY_ALERTS } from '../../../constants/error-messages';\nimport { logger } from '../../../logger';\nimport { CrateDatasource } from '../../../modules/datasource/crate';\nimport { GoDatasource } from '../../../modules/datasource/go';\nimport { MavenDatasource } from '../../../modules/datasource/maven';\nimport { NpmDatasource } from '../../../modules/datasource/npm';\nimport { NugetDatasource } from '../../../modules/datasource/nuget';\nimport { PackagistDatasource } from '../../../modules/datasource/packagist';\nimport { PypiDatasource } from '../../../modules/datasource/pypi';\nimport { RubygemsDatasource } from '../../../modules/datasource/rubygems';\nimport { platform } from '../../../modules/platform';\nimport * as allVersioning from '../../../modules/versioning';\nimport * as composerVersioning from '../../../modules/versioning/composer';\nimport * as mavenVersioning from '../../../modules/versioning/maven';\nimport * as npmVersioning from '../../../modules/versioning/npm';\nimport * as pep440Versioning from '../../../modules/versioning/pep440';\nimport * as rubyVersioning from '../../../modules/versioning/ruby';\nimport * as semverVersioning from '../../../modules/versioning/semver';\nimport type { SecurityAdvisory } from '../../../types';\nimport { sanitizeMarkdown } from '../../../util/markdown';\n\ntype Datasource = string;\ntype DependencyName = string;\ntype FileName = string;\n\ntype CombinedAlert = Record<\n FileName,\n Record<\n Datasource,\n Record<\n DependencyName,\n {\n advisories: SecurityAdvisory[];\n fileType?: string;\n firstPatchedVersion?: string;\n }\n >\n >\n>;\n\nexport function getFixedVersionByDatasource(\n fixedVersion: string,\n datasource: string,\n): string {\n if (datasource === MavenDatasource.id || datasource === NugetDatasource.id) {\n return `[${fixedVersion},)`;\n }\n\n // crates.io, Go, Hex, npm, RubyGems, PyPI\n return `>= ${fixedVersion}`;\n}\n\n// TODO can return `null` and `undefined` (#22198)\nexport async function detectVulnerabilityAlerts(\n input: RenovateConfig,\n): Promise<RenovateConfig> {\n if (!input?.vulnerabilityAlerts) {\n return input;\n }\n if (input.vulnerabilityAlerts.enabled === false) {\n logger.debug('Vulnerability alerts are disabled');\n return input;\n }\n const alerts = await platform.getVulnerabilityAlerts?.();\n if (!alerts?.length) {\n logger.debug('No vulnerability alerts found');\n if (input.vulnerabilityAlertsOnly) {\n throw new Error(NO_VULNERABILITY_ALERTS);\n }\n return input;\n }\n const config = { ...input };\n const versionings: Record<string, string> = {\n 'github-tags': semverVersioning.id,\n go: semverVersioning.id,\n packagist: composerVersioning.id,\n maven: mavenVersioning.id,\n npm: npmVersioning.id,\n nuget: semverVersioning.id,\n pypi: pep440Versioning.id,\n rubygems: rubyVersioning.id,\n };\n const combinedAlerts: CombinedAlert = {};\n for (const alert of alerts) {\n try {\n if (alert.dismissed_reason) {\n continue;\n }\n if (!alert.security_vulnerability?.first_patched_version) {\n logger.debug(\n { alert },\n 'Vulnerability alert has no firstPatchedVersion - skipping',\n );\n continue;\n }\n const datasourceMapping: Record<string, string> = {\n composer: PackagistDatasource.id,\n go: GoDatasource.id,\n maven: MavenDatasource.id,\n npm: NpmDatasource.id,\n nuget: NugetDatasource.id,\n pip: PypiDatasource.id,\n rubygems: RubygemsDatasource.id,\n rust: CrateDatasource.id,\n };\n const datasource =\n datasourceMapping[alert.security_vulnerability.package.ecosystem];\n const depName = alert.security_vulnerability.package.name;\n const fileName = alert.dependency.manifest_path;\n const fileType = fileName.split('/').pop();\n const firstPatchedVersion =\n alert.security_vulnerability.first_patched_version.identifier;\n const advisory = alert.security_advisory;\n\n combinedAlerts[fileName] ||= {};\n combinedAlerts[fileName][datasource] ||= {};\n combinedAlerts[fileName][datasource][depName] ||= {\n advisories: [],\n };\n const alertDetails = combinedAlerts[fileName][datasource][depName];\n alertDetails.advisories.push(advisory);\n const versioningApi = allVersioning.get(versionings[datasource]);\n if (versioningApi.isVersion(firstPatchedVersion)) {\n if (\n !alertDetails.firstPatchedVersion ||\n versioningApi.isGreaterThan(\n firstPatchedVersion,\n alertDetails.firstPatchedVersion,\n )\n ) {\n alertDetails.firstPatchedVersion = firstPatchedVersion;\n }\n } else {\n logger.debug('Invalid firstPatchedVersion: ' + firstPatchedVersion);\n }\n alertDetails.fileType = fileType;\n } catch (err) {\n logger.warn({ err }, 'Error parsing vulnerability alert');\n }\n }\n const alertPackageRules: PackageRule[] = [];\n config.remediations = {} as never;\n for (const [fileName, files] of Object.entries(combinedAlerts)) {\n for (const [datasource, dependencies] of Object.entries(files)) {\n for (const [depName, val] of Object.entries(dependencies)) {\n let prBodyNotes: string[] = [];\n try {\n prBodyNotes = ['### GitHub Vulnerability Alerts'].concat(\n val.advisories.map((advisory) => {\n const identifiers = advisory.identifiers;\n const description = advisory.description;\n let content = '#### ';\n let heading: string;\n if (identifiers.some((id) => id.type === 'CVE')) {\n heading = identifiers\n .filter((id) => id.type === 'CVE')\n .map((id) => id.value)\n .join(' / ');\n } else {\n heading = identifiers.map((id) => id.value).join(' / ');\n }\n if (advisory.references?.length) {\n heading = `[${heading}](${advisory.references[0].url})`;\n }\n content += heading;\n content += '\\n\\n';\n\n content += sanitizeMarkdown(description);\n return content;\n }),\n );\n } catch (err) /* istanbul ignore next */ {\n logger.warn({ err }, 'Error generating vulnerability PR notes');\n }\n // TODO: types (#22198)\n const matchFileNames =\n datasource === GoDatasource.id\n ? [fileName.replace('go.sum', 'go.mod')]\n : [fileName];\n let matchRule: PackageRule = {\n matchDatasources: [datasource],\n matchPackageNames: [depName],\n matchFileNames,\n };\n\n let matchCurrentVersion = `< ${val.firstPatchedVersion}`;\n if (\n datasource === MavenDatasource.id ||\n datasource === NugetDatasource.id\n ) {\n matchCurrentVersion = `(,${val.firstPatchedVersion})`;\n }\n\n // Remediate only direct dependencies\n matchRule = {\n ...matchRule,\n matchCurrentVersion,\n vulnerabilityFixVersion: val.firstPatchedVersion,\n prBodyNotes,\n isVulnerabilityAlert: true,\n force: {\n ...config.vulnerabilityAlerts,\n },\n };\n alertPackageRules.push(matchRule);\n }\n }\n }\n logger.debug({ alertPackageRules }, 'alert package rules');\n config.packageRules = (config.packageRules ?? []).concat(alertPackageRules);\n return config;\n}\n"]}
|
1
|
+
{"version":3,"file":"vulnerability.js","sourceRoot":"","sources":["../../../../lib/workers/repository/init/vulnerability.ts"],"names":[],"mappings":";;AAyCA,kEAUC;AAGD,8DA8JC;;AAnND,sEAA4E;AAC5E,4CAAyC;AACzC,6DAAoE;AACpE,uDAA8D;AAC9D,6DAAoE;AACpE,yDAAgE;AAChE,6DAAoE;AACpE,qEAA4E;AAC5E,2DAAkE;AAClE,mEAA0E;AAC1E,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AAiB,EAAE,EAAE,qBAAqB,CAAC,CAAC;IAC3D,MAAM,CAAC,YAAY,GAAG,CAAC,MAAM,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC5E,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { PackageRule, RenovateConfig } from '../../../config/types';\nimport { NO_VULNERABILITY_ALERTS } from '../../../constants/error-messages';\nimport { logger } from '../../../logger';\nimport { CrateDatasource } from '../../../modules/datasource/crate';\nimport { GoDatasource } from '../../../modules/datasource/go';\nimport { MavenDatasource } from '../../../modules/datasource/maven';\nimport { NpmDatasource } from '../../../modules/datasource/npm';\nimport { NugetDatasource } from '../../../modules/datasource/nuget';\nimport { PackagistDatasource } from '../../../modules/datasource/packagist';\nimport { PypiDatasource } from '../../../modules/datasource/pypi';\nimport { RubygemsDatasource } from '../../../modules/datasource/rubygems';\nimport { platform } from '../../../modules/platform';\nimport * as allVersioning from '../../../modules/versioning';\nimport * as composerVersioning from '../../../modules/versioning/composer';\nimport * as mavenVersioning from '../../../modules/versioning/maven';\nimport * as npmVersioning from '../../../modules/versioning/npm';\nimport * as pep440Versioning from '../../../modules/versioning/pep440';\nimport * as rubyVersioning from '../../../modules/versioning/ruby';\nimport * as semverVersioning from '../../../modules/versioning/semver';\nimport type { SecurityAdvisory } from '../../../types';\nimport { sanitizeMarkdown } from '../../../util/markdown';\n\ntype Datasource = string;\ntype DependencyName = string;\ntype FileName = string;\n\ntype CombinedAlert = Record<\n FileName,\n Record<\n Datasource,\n Record<\n DependencyName,\n {\n advisories: SecurityAdvisory[];\n fileType?: string;\n firstPatchedVersion?: string;\n }\n >\n >\n>;\n\nexport function getFixedVersionByDatasource(\n fixedVersion: string,\n datasource: string,\n): string {\n if (datasource === MavenDatasource.id || datasource === NugetDatasource.id) {\n return `[${fixedVersion},)`;\n }\n\n // crates.io, Go, Hex, npm, RubyGems, PyPI\n return `>= ${fixedVersion}`;\n}\n\n// TODO can return `null` and `undefined` (#22198)\nexport async function detectVulnerabilityAlerts(\n input: RenovateConfig,\n): Promise<RenovateConfig> {\n if (!input?.vulnerabilityAlerts) {\n return input;\n }\n if (input.vulnerabilityAlerts.enabled === false) {\n logger.debug('Vulnerability alerts are disabled');\n return input;\n }\n const alerts = await platform.getVulnerabilityAlerts?.();\n if (!alerts?.length) {\n logger.debug('No vulnerability alerts found');\n if (input.vulnerabilityAlertsOnly) {\n throw new Error(NO_VULNERABILITY_ALERTS);\n }\n return input;\n }\n const config = { ...input };\n const versionings: Record<string, string> = {\n 'github-tags': semverVersioning.id,\n go: semverVersioning.id,\n packagist: composerVersioning.id,\n maven: mavenVersioning.id,\n npm: npmVersioning.id,\n nuget: semverVersioning.id,\n pypi: pep440Versioning.id,\n rubygems: rubyVersioning.id,\n };\n const combinedAlerts: CombinedAlert = {};\n for (const alert of alerts) {\n try {\n if (alert.dismissed_reason) {\n continue;\n }\n if (!alert.security_vulnerability?.first_patched_version) {\n logger.debug(\n { alert },\n 'Vulnerability alert has no firstPatchedVersion - skipping',\n );\n continue;\n }\n const datasourceMapping: Record<string, string> = {\n composer: PackagistDatasource.id,\n go: GoDatasource.id,\n maven: MavenDatasource.id,\n npm: NpmDatasource.id,\n nuget: NugetDatasource.id,\n pip: PypiDatasource.id,\n rubygems: RubygemsDatasource.id,\n rust: CrateDatasource.id,\n };\n const datasource =\n datasourceMapping[alert.security_vulnerability.package.ecosystem];\n const depName = alert.security_vulnerability.package.name;\n const fileName = alert.dependency.manifest_path;\n const fileType = fileName.split('/').pop();\n const firstPatchedVersion =\n alert.security_vulnerability.first_patched_version.identifier;\n const advisory = alert.security_advisory;\n\n combinedAlerts[fileName] ??= {};\n combinedAlerts[fileName][datasource] ??= {};\n combinedAlerts[fileName][datasource][depName] ??= {\n advisories: [],\n };\n const alertDetails = combinedAlerts[fileName][datasource][depName];\n alertDetails.advisories.push(advisory);\n const versioningApi = allVersioning.get(versionings[datasource]);\n if (versioningApi.isVersion(firstPatchedVersion)) {\n if (\n !alertDetails.firstPatchedVersion ||\n versioningApi.isGreaterThan(\n firstPatchedVersion,\n alertDetails.firstPatchedVersion,\n )\n ) {\n alertDetails.firstPatchedVersion = firstPatchedVersion;\n }\n } else {\n logger.debug('Invalid firstPatchedVersion: ' + firstPatchedVersion);\n }\n alertDetails.fileType = fileType;\n } catch (err) {\n logger.warn({ err }, 'Error parsing vulnerability alert');\n }\n }\n const alertPackageRules: PackageRule[] = [];\n config.remediations = {} as never;\n for (const [fileName, files] of Object.entries(combinedAlerts)) {\n for (const [datasource, dependencies] of Object.entries(files)) {\n for (const [depName, val] of Object.entries(dependencies)) {\n let prBodyNotes: string[] = [];\n try {\n prBodyNotes = ['### GitHub Vulnerability Alerts'].concat(\n val.advisories.map((advisory) => {\n const identifiers = advisory.identifiers;\n const description = advisory.description;\n let content = '#### ';\n let heading: string;\n if (identifiers.some((id) => id.type === 'CVE')) {\n heading = identifiers\n .filter((id) => id.type === 'CVE')\n .map((id) => id.value)\n .join(' / ');\n } else {\n heading = identifiers.map((id) => id.value).join(' / ');\n }\n if (advisory.references?.length) {\n heading = `[${heading}](${advisory.references[0].url})`;\n }\n content += heading;\n content += '\\n\\n';\n\n content += sanitizeMarkdown(description);\n return content;\n }),\n );\n } catch (err) /* istanbul ignore next */ {\n logger.warn({ err }, 'Error generating vulnerability PR notes');\n }\n // TODO: types (#22198)\n const matchFileNames =\n datasource === GoDatasource.id\n ? [fileName.replace('go.sum', 'go.mod')]\n : [fileName];\n let matchRule: PackageRule = {\n matchDatasources: [datasource],\n matchPackageNames: [depName],\n matchFileNames,\n };\n\n let matchCurrentVersion = `< ${val.firstPatchedVersion}`;\n if (\n datasource === MavenDatasource.id ||\n datasource === NugetDatasource.id\n ) {\n matchCurrentVersion = `(,${val.firstPatchedVersion})`;\n }\n\n // Remediate only direct dependencies\n matchRule = {\n ...matchRule,\n matchCurrentVersion,\n vulnerabilityFixVersion: val.firstPatchedVersion,\n prBodyNotes,\n isVulnerabilityAlert: true,\n force: {\n ...config.vulnerabilityAlerts,\n },\n };\n alertPackageRules.push(matchRule);\n }\n }\n }\n logger.debug({ alertPackageRules }, 'alert package rules');\n config.packageRules = (config.packageRules ?? []).concat(alertPackageRules);\n return config;\n}\n"]}
|
@@ -123,7 +123,7 @@ function handleOnboardingManualRebase(onboardingPr) {
|
|
123
123
|
}
|
124
124
|
function invalidateExtractCache(baseBranch) {
|
125
125
|
const cache = (0, repository_1.getCache)();
|
126
|
-
cache.scan
|
126
|
+
cache.scan ??= {};
|
127
127
|
if (cache.scan?.[baseBranch]) {
|
128
128
|
delete cache.scan[baseBranch];
|
129
129
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lib/workers/repository/onboarding/branch/index.ts"],"names":[],"mappings":";;AA0BA,sDAqHC;;AA/ID,kEAAkC;AAClC,+CAAsD;AACtD,sDAAyD;AAEzD,yEAAmF;AACnF,+CAA4C;AAC5C,2DAAiE;AACjE,0DAAuD;AACvD,kEAA6D;AAC7D,8CAAqE;AACrE,iDAAqD;AACrD,2CAAuD;AACvD,4CAAuD;AACvD,sCAA4C;AAC5C,mCAAuD;AACvD,qCAA+C;AAC/C,qCAAkD;AAClD,uEAMmC;AACnC,qCAAkD;AAE3C,KAAK,UAAU,qBAAqB,CACzC,MAAsB;IAEtB,eAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAClC,eAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IACzB,IAAI,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAC/C,MAAM,aAAa,GAAG,MAAM,CAAC,aAAc,CAAC;IAC5C,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,MAAM,eAAe,GAAG,MAAM,IAAA,mBAAW,EAAC,MAAM,CAAC,CAAC;IAClD,IAAI,eAAe,EAAE,CAAC;QACpB,eAAM,CA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,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,CAAC,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC;AACxC,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { mergeChildConfig } from '../../../../config';\nimport { GlobalConfig } from '../../../../config/global';\nimport type { RenovateConfig } from '../../../../config/types';\nimport { REPOSITORY_NO_PACKAGE_FILES } from '../../../../constants/error-messages';\nimport { logger } from '../../../../logger';\nimport { type Pr, platform } from '../../../../modules/platform';\nimport { scm } from '../../../../modules/platform/scm';\nimport { getCache } from '../../../../util/cache/repository';\nimport { getBranchCommit, setGitAuthor } from '../../../../util/git';\nimport { checkIfConfigured } from '../../configured';\nimport { extractAllDependencies } from '../../extract';\nimport { mergeRenovateConfig } from '../../init/merge';\nimport { OnboardingState } from '../common';\nimport { getOnboardingPr, isOnboarded } from './check';\nimport { getOnboardingConfig } from './config';\nimport { createOnboardingBranch } from './create';\nimport {\n deleteOnboardingCache,\n hasOnboardingBranchChanged,\n isOnboardingBranchConflicted,\n isOnboardingBranchModified,\n setOnboardingCache,\n} from './onboarding-branch-cache';\nimport { rebaseOnboardingBranch } from './rebase';\n\nexport async function checkOnboardingBranch(\n config: RenovateConfig,\n): Promise<RenovateConfig> {\n logger.debug('checkOnboarding()');\n logger.trace({ config });\n let onboardingBranch = config.onboardingBranch;\n const defaultBranch = config.defaultBranch!;\n let isConflicted = false;\n let isModified = false;\n const repoIsOnboarded = await isOnboarded(config);\n if (repoIsOnboarded) {\n logger.debug('Repo is onboarded');\n\n // delete onboarding cache\n deleteOnboardingCache();\n return { ...config, repoIsOnboarded };\n }\n checkIfConfigured(config);\n\n logger.debug('Repo is not onboarded');\n // global gitAuthor will need to be used\n setGitAuthor(config.gitAuthor);\n const onboardingPr = await getOnboardingPr(config);\n // TODO #22198\n const branchList = [onboardingBranch!];\n if (onboardingPr) {\n logger.debug('Onboarding PR already exists');\n\n isModified = await isOnboardingBranchModified(\n config.onboardingBranch!,\n defaultBranch,\n );\n // if onboarding branch is not modified, check if onboarding config has been changed and rebase if true\n if (!isModified) {\n const commit = await rebaseOnboardingBranch(\n config,\n onboardingPr.bodyStruct?.rawConfigHash,\n );\n if (commit) {\n logger.info(\n { branch: config.onboardingBranch, commit, onboarding: true },\n 'Branch updated',\n );\n }\n // istanbul ignore if\n if (platform.refreshPr) {\n await platform.refreshPr(onboardingPr.number);\n }\n }\n if (config.onboardingRebaseCheckbox) {\n handleOnboardingManualRebase(onboardingPr);\n }\n\n if (\n isConfigHashPresent(onboardingPr) && // needed so that existing onboarding PRs are updated with config hash comment\n isOnboardingCacheValid(defaultBranch, config.onboardingBranch!) &&\n !(config.onboardingRebaseCheckbox && OnboardingState.prUpdateRequested)\n ) {\n logger.debug(\n 'Skip processing since the onboarding branch is up to date and default branch has not changed',\n );\n OnboardingState.onboardingCacheValid = true;\n return { ...config, repoIsOnboarded, onboardingBranch, branchList };\n }\n OnboardingState.onboardingCacheValid = false;\n if (isModified) {\n if (hasOnboardingBranchChanged(config.onboardingBranch!)) {\n invalidateExtractCache(config.baseBranch!);\n }\n isConflicted = await isOnboardingBranchConflicted(\n config.baseBranch!,\n config.onboardingBranch!,\n );\n }\n } else {\n logger.debug('Onboarding PR does not exist');\n const onboardingConfig = await getOnboardingConfig(config);\n let mergedConfig = mergeChildConfig(config, onboardingConfig);\n mergedConfig = await mergeRenovateConfig(mergedConfig);\n onboardingBranch = mergedConfig.onboardingBranch;\n\n if (\n Object.entries((await extractAllDependencies(mergedConfig)).packageFiles)\n .length === 0\n ) {\n if (config.onboardingNoDeps !== 'enabled') {\n throw new Error(REPOSITORY_NO_PACKAGE_FILES);\n }\n }\n logger.debug('Need to create onboarding PR');\n if (config.onboardingRebaseCheckbox) {\n OnboardingState.prUpdateRequested = true;\n }\n const commit = await createOnboardingBranch(mergedConfig);\n // istanbul ignore if\n if (commit) {\n logger.info(\n { branch: onboardingBranch, commit, onboarding: true },\n 'Branch created',\n );\n }\n }\n if (!GlobalConfig.get('dryRun')) {\n // TODO #22198\n if (!isConflicted) {\n logger.debug('Merge onboarding branch in default branch');\n await scm.mergeToLocal(onboardingBranch!);\n }\n }\n setOnboardingCache(\n getBranchCommit(config.defaultBranch!)!,\n getBranchCommit(onboardingBranch!)!,\n isConflicted,\n isModified,\n );\n\n return { ...config, repoIsOnboarded, onboardingBranch, branchList };\n}\n\nfunction handleOnboardingManualRebase(onboardingPr: Pr): void {\n const pl = GlobalConfig.get('platform')!;\n const { rebaseRequested } = onboardingPr.bodyStruct ?? {};\n if (!['github', 'gitlab', 'gitea'].includes(pl)) {\n logger.trace(`Platform '${pl}' does not support extended markdown`);\n OnboardingState.prUpdateRequested = true;\n } else if (is.nullOrUndefined(rebaseRequested)) {\n logger.debug('No rebase checkbox was found in the onboarding PR');\n OnboardingState.prUpdateRequested = true;\n } else if (rebaseRequested) {\n logger.debug('Manual onboarding PR update requested');\n OnboardingState.prUpdateRequested = true;\n }\n}\n\nfunction invalidateExtractCache(baseBranch: string): void {\n const cache = getCache();\n cache.scan ||= {};\n\n if (cache.scan?.[baseBranch]) {\n delete cache.scan[baseBranch];\n }\n}\n\nfunction isOnboardingCacheValid(\n defaultBranch: string,\n onboardingBranch: string,\n): boolean {\n const cache = getCache();\n const onboardingBranchCache = cache?.onboardingBranchCache;\n return !!(\n onboardingBranchCache &&\n onboardingBranchCache.defaultBranchSha === getBranchCommit(defaultBranch) &&\n onboardingBranchCache.onboardingBranchSha ===\n getBranchCommit(onboardingBranch) &&\n onboardingBranchCache.configFileName &&\n onboardingBranchCache.configFileParsed\n );\n}\n\nfunction isConfigHashPresent(pr: Pr): boolean {\n const platform = GlobalConfig.get('platform')!;\n // if platform does not support html comments return true\n if (!['github', 'gitlab', 'gitea'].includes(platform)) {\n return true;\n }\n\n return !!pr.bodyStruct?.rawConfigHash;\n}\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lib/workers/repository/onboarding/branch/index.ts"],"names":[],"mappings":";;AA0BA,sDAqHC;;AA/ID,kEAAkC;AAClC,+CAAsD;AACtD,sDAAyD;AAEzD,yEAAmF;AACnF,+CAA4C;AAC5C,2DAAiE;AACjE,0DAAuD;AACvD,kEAA6D;AAC7D,8CAAqE;AACrE,iDAAqD;AACrD,2CAAuD;AACvD,4CAAuD;AACvD,sCAA4C;AAC5C,mCAAuD;AACvD,qCAA+C;AAC/C,qCAAkD;AAClD,uEAMmC;AACnC,qCAAkD;AAE3C,KAAK,UAAU,qBAAqB,CACzC,MAAsB;IAEtB,eAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAClC,eAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IACzB,IAAI,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAC/C,MAAM,aAAa,GAAG,MAAM,CAAC,aAAc,CAAC;IAC5C,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,MAAM,eAAe,GAAG,MAAM,IAAA,mBAAW,EAAC,MAAM,CAAC,CAAC;IAClD,IAAI,eAAe,EAAE,CAAC;QACpB,eAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAElC,0BAA0B;QAC1B,IAAA,+CAAqB,GAAE,CAAC;QACxB,OAAO,EAAE,GAAG,MAAM,EAAE,eAAe,EAAE,CAAC;IACxC,CAAC;IACD,IAAA,8BAAiB,EAAC,MAAM,CAAC,CAAC;IAE1B,eAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACtC,wCAAwC;IACxC,IAAA,kBAAY,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC/B,MAAM,YAAY,GAAG,MAAM,IAAA,uBAAe,EAAC,MAAM,CAAC,CAAC;IACnD,cAAc;IACd,MAAM,UAAU,GAAG,CAAC,gB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AED,SAAS,sBAAsB,CAAC,UAAkB;IAChD,MAAM,KAAK,GAAG,IAAA,qBAAQ,GAAE,CAAC;IACzB,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC;IAElB,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;AACH,CAAC;AAED,SAAS,sBAAsB,CAC7B,aAAqB,EACrB,gBAAwB;IAExB,MAAM,KAAK,GAAG,IAAA,qBAAQ,GAAE,CAAC;IACzB,MAAM,qBAAqB,GAAG,KAAK,EAAE,qBAAqB,CAAC;IAC3D,OAAO,CAAC,CAAC,CACP,qBAAqB;QACrB,qBAAqB,CAAC,gBAAgB,KAAK,IAAA,qBAAe,EAAC,aAAa,CAAC;QACzE,qBAAqB,CAAC,mBAAmB;YACvC,IAAA,qBAAe,EAAC,gBAAgB,CAAC;QACnC,qBAAqB,CAAC,cAAc;QACpC,qBAAqB,CAAC,gBAAgB,CACvC,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,EAAM;IACjC,MAAM,QAAQ,GAAG,qBAAY,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC;IAC/C,yDAAyD;IACzD,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,CAAC,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC;AACxC,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport { mergeChildConfig } from '../../../../config';\nimport { GlobalConfig } from '../../../../config/global';\nimport type { RenovateConfig } from '../../../../config/types';\nimport { REPOSITORY_NO_PACKAGE_FILES } from '../../../../constants/error-messages';\nimport { logger } from '../../../../logger';\nimport { type Pr, platform } from '../../../../modules/platform';\nimport { scm } from '../../../../modules/platform/scm';\nimport { getCache } from '../../../../util/cache/repository';\nimport { getBranchCommit, setGitAuthor } from '../../../../util/git';\nimport { checkIfConfigured } from '../../configured';\nimport { extractAllDependencies } from '../../extract';\nimport { mergeRenovateConfig } from '../../init/merge';\nimport { OnboardingState } from '../common';\nimport { getOnboardingPr, isOnboarded } from './check';\nimport { getOnboardingConfig } from './config';\nimport { createOnboardingBranch } from './create';\nimport {\n deleteOnboardingCache,\n hasOnboardingBranchChanged,\n isOnboardingBranchConflicted,\n isOnboardingBranchModified,\n setOnboardingCache,\n} from './onboarding-branch-cache';\nimport { rebaseOnboardingBranch } from './rebase';\n\nexport async function checkOnboardingBranch(\n config: RenovateConfig,\n): Promise<RenovateConfig> {\n logger.debug('checkOnboarding()');\n logger.trace({ config });\n let onboardingBranch = config.onboardingBranch;\n const defaultBranch = config.defaultBranch!;\n let isConflicted = false;\n let isModified = false;\n const repoIsOnboarded = await isOnboarded(config);\n if (repoIsOnboarded) {\n logger.debug('Repo is onboarded');\n\n // delete onboarding cache\n deleteOnboardingCache();\n return { ...config, repoIsOnboarded };\n }\n checkIfConfigured(config);\n\n logger.debug('Repo is not onboarded');\n // global gitAuthor will need to be used\n setGitAuthor(config.gitAuthor);\n const onboardingPr = await getOnboardingPr(config);\n // TODO #22198\n const branchList = [onboardingBranch!];\n if (onboardingPr) {\n logger.debug('Onboarding PR already exists');\n\n isModified = await isOnboardingBranchModified(\n config.onboardingBranch!,\n defaultBranch,\n );\n // if onboarding branch is not modified, check if onboarding config has been changed and rebase if true\n if (!isModified) {\n const commit = await rebaseOnboardingBranch(\n config,\n onboardingPr.bodyStruct?.rawConfigHash,\n );\n if (commit) {\n logger.info(\n { branch: config.onboardingBranch, commit, onboarding: true },\n 'Branch updated',\n );\n }\n // istanbul ignore if\n if (platform.refreshPr) {\n await platform.refreshPr(onboardingPr.number);\n }\n }\n if (config.onboardingRebaseCheckbox) {\n handleOnboardingManualRebase(onboardingPr);\n }\n\n if (\n isConfigHashPresent(onboardingPr) && // needed so that existing onboarding PRs are updated with config hash comment\n isOnboardingCacheValid(defaultBranch, config.onboardingBranch!) &&\n !(config.onboardingRebaseCheckbox && OnboardingState.prUpdateRequested)\n ) {\n logger.debug(\n 'Skip processing since the onboarding branch is up to date and default branch has not changed',\n );\n OnboardingState.onboardingCacheValid = true;\n return { ...config, repoIsOnboarded, onboardingBranch, branchList };\n }\n OnboardingState.onboardingCacheValid = false;\n if (isModified) {\n if (hasOnboardingBranchChanged(config.onboardingBranch!)) {\n invalidateExtractCache(config.baseBranch!);\n }\n isConflicted = await isOnboardingBranchConflicted(\n config.baseBranch!,\n config.onboardingBranch!,\n );\n }\n } else {\n logger.debug('Onboarding PR does not exist');\n const onboardingConfig = await getOnboardingConfig(config);\n let mergedConfig = mergeChildConfig(config, onboardingConfig);\n mergedConfig = await mergeRenovateConfig(mergedConfig);\n onboardingBranch = mergedConfig.onboardingBranch;\n\n if (\n Object.entries((await extractAllDependencies(mergedConfig)).packageFiles)\n .length === 0\n ) {\n if (config.onboardingNoDeps !== 'enabled') {\n throw new Error(REPOSITORY_NO_PACKAGE_FILES);\n }\n }\n logger.debug('Need to create onboarding PR');\n if (config.onboardingRebaseCheckbox) {\n OnboardingState.prUpdateRequested = true;\n }\n const commit = await createOnboardingBranch(mergedConfig);\n // istanbul ignore if\n if (commit) {\n logger.info(\n { branch: onboardingBranch, commit, onboarding: true },\n 'Branch created',\n );\n }\n }\n if (!GlobalConfig.get('dryRun')) {\n // TODO #22198\n if (!isConflicted) {\n logger.debug('Merge onboarding branch in default branch');\n await scm.mergeToLocal(onboardingBranch!);\n }\n }\n setOnboardingCache(\n getBranchCommit(config.defaultBranch!)!,\n getBranchCommit(onboardingBranch!)!,\n isConflicted,\n isModified,\n );\n\n return { ...config, repoIsOnboarded, onboardingBranch, branchList };\n}\n\nfunction handleOnboardingManualRebase(onboardingPr: Pr): void {\n const pl = GlobalConfig.get('platform')!;\n const { rebaseRequested } = onboardingPr.bodyStruct ?? {};\n if (!['github', 'gitlab', 'gitea'].includes(pl)) {\n logger.trace(`Platform '${pl}' does not support extended markdown`);\n OnboardingState.prUpdateRequested = true;\n } else if (is.nullOrUndefined(rebaseRequested)) {\n logger.debug('No rebase checkbox was found in the onboarding PR');\n OnboardingState.prUpdateRequested = true;\n } else if (rebaseRequested) {\n logger.debug('Manual onboarding PR update requested');\n OnboardingState.prUpdateRequested = true;\n }\n}\n\nfunction invalidateExtractCache(baseBranch: string): void {\n const cache = getCache();\n cache.scan ??= {};\n\n if (cache.scan?.[baseBranch]) {\n delete cache.scan[baseBranch];\n }\n}\n\nfunction isOnboardingCacheValid(\n defaultBranch: string,\n onboardingBranch: string,\n): boolean {\n const cache = getCache();\n const onboardingBranchCache = cache?.onboardingBranchCache;\n return !!(\n onboardingBranchCache &&\n onboardingBranchCache.defaultBranchSha === getBranchCommit(defaultBranch) &&\n onboardingBranchCache.onboardingBranchSha ===\n getBranchCommit(onboardingBranch) &&\n onboardingBranchCache.configFileName &&\n onboardingBranchCache.configFileParsed\n );\n}\n\nfunction isConfigHashPresent(pr: Pr): boolean {\n const platform = GlobalConfig.get('platform')!;\n // if platform does not support html comments return true\n if (!['github', 'gitlab', 'gitea'].includes(platform)) {\n return true;\n }\n\n return !!pr.bodyStruct?.rawConfigHash;\n}\n"]}
|
@@ -95,7 +95,7 @@ async function extract(config) {
|
|
95
95
|
const baseBranchSha = await scm_1.scm.getBranchCommit(baseBranch);
|
96
96
|
let packageFiles;
|
97
97
|
const cache = (0, repository_1.getCache)();
|
98
|
-
cache.scan
|
98
|
+
cache.scan ??= {};
|
99
99
|
const cachedExtract = cache.scan[baseBranch];
|
100
100
|
const configHash = (0, fingerprint_1.fingerprint)((0, extract_fingerprint_config_1.generateFingerprintConfig)(config));
|
101
101
|
// istanbul ignore if
|