diff --git a/lib/modules/manager/custom/regex/index.ts b/lib/modules/manager/custom/regex/index.ts index 10ddca3d0dd5d5..00d9d79b8afcc9 100644 --- a/lib/modules/manager/custom/regex/index.ts +++ b/lib/modules/manager/custom/regex/index.ts @@ -2,9 +2,9 @@ import is from '@sindresorhus/is'; import type { Category } from '../../../../constants'; import type { ExtractConfig, + MaybePromise, PackageDependency, PackageFileContent, - Result, } from '../../types'; import { handleAny, handleCombination, handleRecursive } from './strategies'; import type { RegexManagerConfig, RegexManagerTemplates } from './types'; @@ -22,7 +22,7 @@ export function extractPackageFile( content: string, packageFile: string, config: ExtractConfig, -): Result { +): MaybePromise { let deps: PackageDependency[]; switch (config.matchStringsStrategy) { default: diff --git a/lib/modules/manager/index.ts b/lib/modules/manager/index.ts index 439bac5ec8520d..e4f9eace2969a3 100644 --- a/lib/modules/manager/index.ts +++ b/lib/modules/manager/index.ts @@ -6,10 +6,10 @@ import type { ExtractConfig, GlobalManagerConfig, ManagerApi, + MaybePromise, PackageFile, PackageFileContent, RangeConfig, - Result, } from './types'; export { hashMap } from './fingerprint.generated'; @@ -65,7 +65,7 @@ export function extractPackageFile( content: string, fileName: string, config: ExtractConfig, -): Result { +): MaybePromise { const m = managers.get(manager)! ?? customManagers.get(manager)!; if (!m) { return null; diff --git a/lib/modules/manager/setup-cfg/extract.ts b/lib/modules/manager/setup-cfg/extract.ts index 017f9903ad30da..5e91fd795eb22c 100644 --- a/lib/modules/manager/setup-cfg/extract.ts +++ b/lib/modules/manager/setup-cfg/extract.ts @@ -4,7 +4,11 @@ import { logger } from '../../../logger'; import { newlineRegex, regEx } from '../../../util/regex'; import { PypiDatasource } from '../../datasource/pypi'; import { normalizePythonDepName } from '../../datasource/pypi/common'; -import type { PackageDependency, PackageFileContent, Result } from '../types'; +import type { + MaybePromise, + PackageDependency, + PackageFileContent, +} from '../types'; function getSectionName(str: string): string { const [, sectionName] = regEx(/^\[\s*([^\s]+)\s*]\s*$/).exec(str) ?? []; @@ -89,7 +93,7 @@ function parseDep( export function extractPackageFile( content: string, -): Result { +): MaybePromise { logger.trace('setup-cfg.extractPackageFile()'); let sectionName: string | null = null; diff --git a/lib/modules/manager/types.ts b/lib/modules/manager/types.ts index a2ccd07d47950d..a1e8ba2824d9df 100644 --- a/lib/modules/manager/types.ts +++ b/lib/modules/manager/types.ts @@ -11,7 +11,7 @@ import type { FileChange } from '../../util/git/types'; import type { MergeConfidence } from '../../util/merge-confidence/types'; import type { CustomExtractConfig } from './custom/types'; -export type Result = T | Promise; +export type MaybePromise = T | Promise; export interface ManagerData { managerData?: T; @@ -258,34 +258,34 @@ export interface ManagerApi extends ModuleApi { currentValue: string, bumpVersion: ReleaseType, packageFile: string, - ): Result; + ): MaybePromise; - detectGlobalConfig?(): Result; + detectGlobalConfig?(): MaybePromise; extractAllPackageFiles?( config: ExtractConfig, files: string[], - ): Result; + ): MaybePromise; extractPackageFile?( content: string, packageFile?: string, config?: ExtractConfig, - ): Result; + ): MaybePromise; getRangeStrategy?(config: RangeConfig): RangeStrategy; updateArtifacts?( updateArtifact: UpdateArtifact, - ): Result; + ): MaybePromise; updateDependency?( updateDependencyConfig: UpdateDependencyConfig, - ): Result; + ): MaybePromise; updateLockedDependency?( config: UpdateLockedConfig, - ): Result; + ): MaybePromise; } // TODO: name and properties used by npm manager