diff --git a/lib/workers/repository/process/fetch.ts b/lib/workers/repository/process/fetch.ts index 60f7d316f4..12f150b10f 100644 --- a/lib/workers/repository/process/fetch.ts +++ b/lib/workers/repository/process/fetch.ts @@ -12,7 +12,8 @@ import { PackageDependency, PackageFile } from '../../../manager/common'; import { SkipReason } from '../../../types'; import { clone } from '../../../util/clone'; import { applyPackageRules } from '../../../util/package-rules'; -import { LookupUpdateConfig, lookupUpdates } from './lookup'; +import { lookupUpdates } from './lookup'; +import { LookupUpdateConfig } from './lookup/common'; async function fetchDepUpdates( packageFileConfig: ManagerConfig & PackageFile, diff --git a/lib/workers/repository/process/lookup/common.ts b/lib/workers/repository/process/lookup/common.ts new file mode 100644 index 0000000000..8c42df3ffa --- /dev/null +++ b/lib/workers/repository/process/lookup/common.ts @@ -0,0 +1,53 @@ +import { RenovateConfig, ValidationMessage } from '../../../../config/common'; +import { Release } from '../../../../datasource'; +import { LookupUpdate, RangeConfig } from '../../../../manager/common'; +import { SkipReason } from '../../../../types'; + +export interface FilterConfig { + allowedVersions?: string; + depName?: string; + followTag?: string; + ignoreDeprecated?: boolean; + ignoreUnstable?: boolean; + respectLatest?: boolean; + versioning: string; +} + +export interface RollbackConfig { + currentValue?: string; + depName?: string; + packageFile?: string; + versioning: string; +} + +export interface LookupUpdateConfig + extends RollbackConfig, + FilterConfig, + RangeConfig, + RenovateConfig { + separateMinorPatch?: boolean; + digestOneAndOnly?: boolean; + pinDigests?: boolean; + rollbackPrs?: boolean; + currentDigest?: string; + lockedVersion?: string; + vulnerabilityAlert?: boolean; + separateMajorMinor?: boolean; + separateMultipleMajor?: boolean; + datasource: string; + depName: string; +} + +export interface UpdateResult { + sourceDirectory?: string; + changelogUrl?: string; + dependencyUrl?: string; + homepage?: string; + deprecationMessage?: string; + sourceUrl?: string; + skipReason: SkipReason; + releases: Release[]; + fixedVersion?: string; + updates: LookupUpdate[]; + warnings: ValidationMessage[]; +} diff --git a/lib/workers/repository/process/lookup/filter.ts b/lib/workers/repository/process/lookup/filter.ts index 3c8dfd0be4..972caaaa35 100644 --- a/lib/workers/repository/process/lookup/filter.ts +++ b/lib/workers/repository/process/lookup/filter.ts @@ -7,16 +7,7 @@ import * as allVersioning from '../../../../versioning'; import * as npmVersioning from '../../../../versioning/npm'; import * as pep440 from '../../../../versioning/pep440'; import * as poetryVersioning from '../../../../versioning/poetry'; - -export interface FilterConfig { - allowedVersions?: string; - depName?: string; - followTag?: string; - ignoreDeprecated?: boolean; - ignoreUnstable?: boolean; - respectLatest?: boolean; - versioning: string; -} +import { FilterConfig } from './common'; export function filterVersions( config: FilterConfig, diff --git a/lib/workers/repository/process/lookup/index.spec.ts b/lib/workers/repository/process/lookup/index.spec.ts index 4d13d8138d..95f3f0181d 100644 --- a/lib/workers/repository/process/lookup/index.spec.ts +++ b/lib/workers/repository/process/lookup/index.spec.ts @@ -22,6 +22,7 @@ import { id as gitVersioningId } from '../../../../versioning/git'; import { id as npmVersioningId } from '../../../../versioning/npm'; import { id as pep440VersioningId } from '../../../../versioning/pep440'; import { id as poetryVersioningId } from '../../../../versioning/poetry'; +import { LookupUpdateConfig } from './common'; import * as lookup from '.'; jest.mock('../../../../datasource/docker'); @@ -37,12 +38,12 @@ const githubReleases = mocked(datasourceGithubReleases); Object.assign(githubReleases, { defaultRegistryUrls: ['https://github.com'] }); -let config: lookup.LookupUpdateConfig; +let config: LookupUpdateConfig; describe('workers/repository/process/lookup', () => { beforeEach(() => { // TODO: fix types - config = partial(getConfig()); + config = partial(getConfig()); config.manager = 'npm'; config.versioning = npmVersioningId; config.rangeStrategy = 'replace'; diff --git a/lib/workers/repository/process/lookup/index.ts b/lib/workers/repository/process/lookup/index.ts index 820c0aeac6..4e66631bd2 100644 --- a/lib/workers/repository/process/lookup/index.ts +++ b/lib/workers/repository/process/lookup/index.ts @@ -1,8 +1,4 @@ -import { - RenovateConfig, - UpdateType, - ValidationMessage, -} from '../../../../config'; +import { UpdateType, ValidationMessage } from '../../../../config'; import { Release, getDefaultVersioning, @@ -14,45 +10,14 @@ import { import * as datasourceGitSubmodules from '../../../../datasource/git-submodules'; import { logger } from '../../../../logger'; import { getRangeStrategy } from '../../../../manager'; -import { LookupUpdate, RangeConfig } from '../../../../manager/common'; +import { LookupUpdate } from '../../../../manager/common'; import { SkipReason } from '../../../../types'; import { clone } from '../../../../util/clone'; import { applyPackageRules } from '../../../../util/package-rules'; import * as allVersioning from '../../../../versioning'; -import { FilterConfig, filterVersions } from './filter'; -import { RollbackConfig, getRollbackUpdate } from './rollback'; - -export interface UpdateResult { - sourceDirectory?: string; - changelogUrl?: string; - dependencyUrl?: string; - homepage?: string; - deprecationMessage?: string; - sourceUrl?: string; - skipReason: SkipReason; - releases: Release[]; - fixedVersion?: string; - updates: LookupUpdate[]; - warnings: ValidationMessage[]; -} - -export interface LookupUpdateConfig - extends RollbackConfig, - FilterConfig, - RangeConfig, - RenovateConfig { - separateMinorPatch?: boolean; - digestOneAndOnly?: boolean; - pinDigests?: boolean; - rollbackPrs?: boolean; - currentDigest?: string; - lockedVersion?: string; - vulnerabilityAlert?: boolean; - separateMajorMinor?: boolean; - separateMultipleMajor?: boolean; - datasource: string; - depName: string; -} +import { LookupUpdateConfig, UpdateResult } from './common'; +import { filterVersions } from './filter'; +import { getRollbackUpdate } from './rollback'; function getUpdateType( config: LookupUpdateConfig, diff --git a/lib/workers/repository/process/lookup/rollback.ts b/lib/workers/repository/process/lookup/rollback.ts index 37cbb8effa..31bcc2741e 100644 --- a/lib/workers/repository/process/lookup/rollback.ts +++ b/lib/workers/repository/process/lookup/rollback.ts @@ -2,13 +2,7 @@ import { Release } from '../../../../datasource/common'; import { logger } from '../../../../logger'; import { LookupUpdate } from '../../../../manager/common'; import * as allVersioning from '../../../../versioning'; - -export interface RollbackConfig { - currentValue?: string; - depName?: string; - packageFile?: string; - versioning: string; -} +import { RollbackConfig } from './common'; export function getRollbackUpdate( config: RollbackConfig,