From a61821bde86356cde61d56e2ab2373366af01cb1 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Thu, 3 Mar 2022 10:53:23 +0100 Subject: [PATCH] refactor: repository worker (#14489) Refactors branch and pr worker to be under repository worker. --- docs/development/local-development.md | 2 +- lib/config/validation.ts | 5 +- lib/constants/platform.spec.ts | 4 +- .../__snapshots__/index.spec.ts.snap | 15 ---- lib/workers/repository/changelog/index.ts | 2 +- lib/workers/repository/onboarding/pr/index.ts | 4 +- lib/workers/repository/process/write.spec.ts | 2 +- lib/workers/repository/process/write.ts | 2 +- .../branch/__snapshots__/commit.spec.ts.snap | 4 +- .../__snapshots__/get-updated.spec.ts.snap | 28 +++---- .../update}/branch/artifacts.spec.ts | 10 +-- .../update}/branch/artifacts.ts | 10 +-- .../update}/branch/auto-replace.spec.ts | 19 +++-- .../update}/branch/auto-replace.ts | 18 ++--- .../update}/branch/automerge.spec.ts | 12 +-- .../update}/branch/automerge.ts | 12 +-- .../update}/branch/check-existing.spec.ts | 8 +- .../update}/branch/check-existing.ts | 10 +-- .../update}/branch/commit.spec.ts | 15 ++-- .../{ => repository/update}/branch/commit.ts | 12 +-- .../execute-post-upgrade-commands.spec.ts | 14 ++-- .../branch/execute-post-upgrade-commands.ts | 26 ++++--- .../update}/branch/get-updated.spec.ts | 30 ++++---- .../update}/branch/get-updated.ts | 14 ++-- .../update}/branch/handle-existing.ts | 16 ++-- .../update}/branch/index.spec.ts | 46 +++++------ .../{ => repository/update}/branch/index.ts | 32 ++++---- .../__snapshots__/index.spec.ts.snap | 15 ++++ .../update}/branch/lock-files/index.spec.ts | 26 +++---- .../update}/branch/reuse.spec.ts | 12 +-- .../{ => repository/update}/branch/reuse.ts | 12 +-- .../update}/branch/schedule.spec.ts | 4 +- .../update}/branch/schedule.ts | 6 +- .../update}/branch/status-checks.spec.ts | 6 +- .../update}/branch/status-checks.ts | 10 +-- .../update}/pr/__fixtures__/adapter-utils.md | 0 .../update}/pr/__fixtures__/angular-js.md | 0 .../update}/pr/__fixtures__/gitter-webapp.md | 0 .../update}/pr/__fixtures__/jest.md | 0 .../update}/pr/__fixtures__/js-yaml.md | 0 .../update}/pr/__fixtures__/yargs.md | 0 .../pr/__snapshots__/index.spec.ts.snap | 36 ++++----- .../update}/pr/automerge.spec.ts | 12 +-- .../{ => repository/update}/pr/automerge.ts | 14 ++-- .../update}/pr/body/changelogs.ts | 10 +-- .../pr/body/config-description.spec.ts | 6 +- .../update}/pr/body/config-description.ts | 6 +- .../update}/pr/body/controls.spec.ts | 8 +- .../update}/pr/body/controls.ts | 6 +- .../{ => repository/update}/pr/body/footer.ts | 4 +- .../{ => repository/update}/pr/body/header.ts | 4 +- .../{ => repository/update}/pr/body/index.ts | 10 +-- .../{ => repository/update}/pr/body/notes.ts | 8 +- .../update}/pr/body/updates-table.spec.ts | 4 +- .../update}/pr/body/updates-table.ts | 8 +- .../__snapshots__/github.spec.ts.snap | 12 +-- .../__snapshots__/gitlab.spec.ts.snap | 18 ++--- .../__snapshots__/index.spec.ts.snap | 24 +++--- .../__snapshots__/release-notes.spec.ts.snap | 76 +++++++++---------- .../__snapshots__/releases.spec.ts.snap | 10 +-- .../update}/pr/changelog/github.spec.ts | 14 ++-- .../update}/pr/changelog/github/index.ts | 14 ++-- .../update}/pr/changelog/gitlab.spec.ts | 14 ++-- .../update}/pr/changelog/gitlab/index.ts | 12 +-- .../update}/pr/changelog/hbs-template.ts | 0 .../update}/pr/changelog/index.spec.ts | 16 ++-- .../update}/pr/changelog/index.ts | 6 +- .../pr/changelog/release-notes.spec.ts | 14 ++-- .../update}/pr/changelog/release-notes.ts | 10 +-- .../update}/pr/changelog/releases.spec.ts | 12 +-- .../update}/pr/changelog/releases.ts | 8 +- .../update}/pr/changelog/source-github.ts | 18 ++--- .../update}/pr/changelog/source-gitlab.ts | 14 ++-- .../update}/pr/changelog/types.ts | 0 .../update}/pr/code-owners.spec.ts | 10 +-- .../{ => repository/update}/pr/code-owners.ts | 10 +-- .../{ => repository/update}/pr/index.spec.ts | 24 +++--- .../{ => repository/update}/pr/index.ts | 36 +++++---- lib/workers/types.ts | 5 +- tsconfig.strict.json | 52 ++++++------- 80 files changed, 528 insertions(+), 500 deletions(-) delete mode 100644 lib/workers/branch/lock-files/__snapshots__/index.spec.ts.snap rename lib/workers/{ => repository/update}/branch/__snapshots__/commit.spec.ts.snap (79%) rename lib/workers/{ => repository/update}/branch/__snapshots__/get-updated.spec.ts.snap (70%) rename lib/workers/{ => repository/update}/branch/artifacts.spec.ts (82%) rename lib/workers/{ => repository/update}/branch/artifacts.ts (75%) rename lib/workers/{ => repository/update}/branch/auto-replace.spec.ts (92%) rename lib/workers/{ => repository/update}/branch/auto-replace.ts (90%) rename lib/workers/{ => repository/update}/branch/automerge.spec.ts (88%) rename lib/workers/{ => repository/update}/branch/automerge.ts (89%) rename lib/workers/{ => repository/update}/branch/check-existing.spec.ts (82%) rename lib/workers/{ => repository/update}/branch/check-existing.ts (74%) rename lib/workers/{ => repository/update}/branch/commit.spec.ts (86%) rename lib/workers/{ => repository/update}/branch/commit.ts (82%) rename lib/workers/{ => repository/update}/branch/execute-post-upgrade-commands.spec.ts (78%) rename lib/workers/{ => repository/update}/branch/execute-post-upgrade-commands.ts (90%) rename lib/workers/{ => repository/update}/branch/get-updated.spec.ts (94%) rename lib/workers/{ => repository/update}/branch/get-updated.ts (96%) rename lib/workers/{ => repository/update}/branch/handle-existing.ts (75%) rename lib/workers/{ => repository/update}/branch/index.spec.ts (97%) rename lib/workers/{ => repository/update}/branch/index.ts (96%) create mode 100644 lib/workers/repository/update/branch/lock-files/__snapshots__/index.spec.ts.snap rename lib/workers/{ => repository/update}/branch/lock-files/index.spec.ts (79%) rename lib/workers/{ => repository/update}/branch/reuse.spec.ts (96%) rename lib/workers/{ => repository/update}/branch/reuse.ts (93%) rename lib/workers/{ => repository/update}/branch/schedule.spec.ts (99%) rename lib/workers/{ => repository/update}/branch/schedule.ts (97%) rename lib/workers/{ => repository/update}/branch/status-checks.spec.ts (94%) rename lib/workers/{ => repository/update}/branch/status-checks.ts (90%) rename lib/workers/{ => repository/update}/pr/__fixtures__/adapter-utils.md (100%) rename lib/workers/{ => repository/update}/pr/__fixtures__/angular-js.md (100%) rename lib/workers/{ => repository/update}/pr/__fixtures__/gitter-webapp.md (100%) rename lib/workers/{ => repository/update}/pr/__fixtures__/jest.md (100%) rename lib/workers/{ => repository/update}/pr/__fixtures__/js-yaml.md (100%) rename lib/workers/{ => repository/update}/pr/__fixtures__/yargs.md (100%) rename lib/workers/{ => repository/update}/pr/__snapshots__/index.spec.ts.snap (87%) rename lib/workers/{ => repository/update}/pr/automerge.spec.ts (92%) rename lib/workers/{ => repository/update}/pr/automerge.ts (91%) rename lib/workers/{ => repository/update}/pr/body/changelogs.ts (78%) rename lib/workers/{ => repository/update}/pr/body/config-description.spec.ts (78%) rename lib/workers/{ => repository/update}/pr/body/config-description.ts (92%) rename lib/workers/{ => repository/update}/pr/body/controls.spec.ts (87%) rename lib/workers/{ => repository/update}/pr/body/controls.ts (67%) rename lib/workers/{ => repository/update}/pr/body/footer.ts (63%) rename lib/workers/{ => repository/update}/pr/body/header.ts (63%) rename lib/workers/{ => repository/update}/pr/body/index.ts (88%) rename lib/workers/{ => repository/update}/pr/body/notes.ts (86%) rename lib/workers/{ => repository/update}/pr/body/updates-table.spec.ts (96%) rename lib/workers/{ => repository/update}/pr/body/updates-table.ts (91%) rename lib/workers/{ => repository/update}/pr/changelog/__snapshots__/github.spec.ts.snap (92%) rename lib/workers/{ => repository/update}/pr/changelog/__snapshots__/gitlab.spec.ts.snap (94%) rename lib/workers/{ => repository/update}/pr/changelog/__snapshots__/index.spec.ts.snap (96%) rename lib/workers/{ => repository/update}/pr/changelog/__snapshots__/release-notes.spec.ts.snap (89%) rename lib/workers/{ => repository/update}/pr/changelog/__snapshots__/releases.spec.ts.snap (61%) rename lib/workers/{ => repository/update}/pr/changelog/github.spec.ts (94%) rename lib/workers/{ => repository/update}/pr/changelog/github/index.ts (87%) rename lib/workers/{ => repository/update}/pr/changelog/gitlab.spec.ts (95%) rename lib/workers/{ => repository/update}/pr/changelog/gitlab/index.ts (87%) rename lib/workers/{ => repository/update}/pr/changelog/hbs-template.ts (100%) rename lib/workers/{ => repository/update}/pr/changelog/index.spec.ts (95%) rename lib/workers/{ => repository/update}/pr/changelog/index.ts (88%) rename lib/workers/{ => repository/update}/pr/changelog/release-notes.spec.ts (98%) rename lib/workers/{ => repository/update}/pr/changelog/release-notes.ts (97%) rename lib/workers/{ => repository/update}/pr/changelog/releases.spec.ts (87%) rename lib/workers/{ => repository/update}/pr/changelog/releases.ts (89%) rename lib/workers/{ => repository/update}/pr/changelog/source-github.ts (89%) rename lib/workers/{ => repository/update}/pr/changelog/source-gitlab.ts (90%) rename lib/workers/{ => repository/update}/pr/changelog/types.ts (100%) rename lib/workers/{ => repository/update}/pr/code-owners.spec.ts (92%) rename lib/workers/{ => repository/update}/pr/code-owners.ts (85%) rename lib/workers/{ => repository/update}/pr/index.spec.ts (98%) rename lib/workers/{ => repository/update}/pr/index.ts (94%) diff --git a/docs/development/local-development.md b/docs/development/local-development.md index 4585d3b662..1e303df725 100644 --- a/docs/development/local-development.md +++ b/docs/development/local-development.md @@ -125,7 +125,7 @@ Refactor PRs should ideally not change or remove tests (adding tests is OK). ### Jest You can run just the Jest unit tests by running `yarn jest`. -You can also run just a subset of the Jest tests using file matching, e.g. `yarn jest composer` or `yarn jest workers/branch`. +You can also run just a subset of the Jest tests using file matching, e.g. `yarn jest composer` or `yarn jest workers/repository/update/branch`. If you get a test failure due to a "snapshot" mismatch, and you are sure that you need to update the snapshot, then you can append `-u` to the end. e.g. `yarn jest composer -u` would update the saved snapshots for _all_ tests in `**/composer/**`. diff --git a/lib/config/validation.ts b/lib/config/validation.ts index 71b88cd805..c2089a82e4 100644 --- a/lib/config/validation.ts +++ b/lib/config/validation.ts @@ -2,7 +2,10 @@ import is from '@sindresorhus/is'; import { getLanguageList, getManagerList } from '../modules/manager'; import { configRegexPredicate, isConfigRegex, regEx } from '../util/regex'; import * as template from '../util/template'; -import { hasValidSchedule, hasValidTimezone } from '../workers/branch/schedule'; +import { + hasValidSchedule, + hasValidTimezone, +} from '../workers/repository/update/branch/schedule'; import { migrateConfig } from './migration'; import { getOptions } from './options'; import { resolveConfigPresets } from './presets'; diff --git a/lib/constants/platform.spec.ts b/lib/constants/platform.spec.ts index acd29633ce..7418787962 100644 --- a/lib/constants/platform.spec.ts +++ b/lib/constants/platform.spec.ts @@ -5,8 +5,8 @@ import { GitlabPackagesDatasource } from '../modules/datasource/gitlab-packages' import { GitlabReleasesDatasource } from '../modules/datasource/gitlab-releases'; import { GitlabTagsDatasource } from '../modules/datasource/gitlab-tags'; import { PodDatasource } from '../modules/datasource/pod'; -import { id as GITHUB_CHANGELOG_ID } from '../workers/pr/changelog/github'; -import { id as GITLAB_CHANGELOG_ID } from '../workers/pr/changelog/gitlab'; +import { id as GITHUB_CHANGELOG_ID } from '../workers/repository/update/pr/changelog/github'; +import { id as GITLAB_CHANGELOG_ID } from '../workers/repository/update/pr/changelog/gitlab'; import { BITBUCKET_API_USING_HOST_TYPES, GITHUB_API_USING_HOST_TYPES, diff --git a/lib/workers/branch/lock-files/__snapshots__/index.spec.ts.snap b/lib/workers/branch/lock-files/__snapshots__/index.spec.ts.snap deleted file mode 100644 index 8553abb902..0000000000 --- a/lib/workers/branch/lock-files/__snapshots__/index.spec.ts.snap +++ /dev/null @@ -1,15 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`workers/branch/lock-files/index getAdditionalFiles returns no error and empty lockfiles if lock file maintenance exists 1`] = ` -Object { - "artifactErrors": Array [], - "updatedArtifacts": Array [], -} -`; - -exports[`workers/branch/lock-files/index getAdditionalFiles returns no error and empty lockfiles if updateLockFiles false 1`] = ` -Object { - "artifactErrors": Array [], - "updatedArtifacts": Array [], -} -`; diff --git a/lib/workers/repository/changelog/index.ts b/lib/workers/repository/changelog/index.ts index feff7e56e5..43fd3a90e5 100644 --- a/lib/workers/repository/changelog/index.ts +++ b/lib/workers/repository/changelog/index.ts @@ -1,6 +1,6 @@ import pMap from 'p-map'; -import { getChangeLogJSON } from '../../pr/changelog'; import type { BranchUpgradeConfig } from '../../types'; +import { getChangeLogJSON } from '../update/pr/changelog'; // istanbul ignore next async function embedChangelog(upgrade: BranchUpgradeConfig): Promise<void> { diff --git a/lib/workers/repository/onboarding/pr/index.ts b/lib/workers/repository/onboarding/pr/index.ts index de3e6c294c..8efa0695c2 100644 --- a/lib/workers/repository/onboarding/pr/index.ts +++ b/lib/workers/repository/onboarding/pr/index.ts @@ -11,12 +11,12 @@ import { isBranchModified, } from '../../../../util/git'; import * as template from '../../../../util/template'; +import type { BranchConfig } from '../../../types'; import { addAssigneesReviewers, getPlatformPrOptions, prepareLabels, -} from '../../../pr'; -import type { BranchConfig } from '../../../types'; +} from '../../update/pr'; import { getBaseBranchDesc } from './base-branch'; import { getConfigDesc } from './config-description'; import { getDepWarnings, getErrors, getWarnings } from './errors-warnings'; diff --git a/lib/workers/repository/process/write.spec.ts b/lib/workers/repository/process/write.spec.ts index 067e1fe952..dbf1a90e9b 100644 --- a/lib/workers/repository/process/write.spec.ts +++ b/lib/workers/repository/process/write.spec.ts @@ -1,7 +1,7 @@ import { RenovateConfig, getConfig, git, mocked } from '../../../../test/util'; -import * as _branchWorker from '../../branch'; import { Limit, isLimitReached } from '../../global/limits'; import { BranchConfig, BranchResult } from '../../types'; +import * as _branchWorker from '../update/branch'; import * as _limits from './limits'; import { writeUpdates } from './write'; diff --git a/lib/workers/repository/process/write.ts b/lib/workers/repository/process/write.ts index 2dfac7b13e..4f56afd0b8 100644 --- a/lib/workers/repository/process/write.ts +++ b/lib/workers/repository/process/write.ts @@ -1,9 +1,9 @@ import type { RenovateConfig } from '../../../config/types'; import { addMeta, logger, removeMeta } from '../../../logger'; import { branchExists } from '../../../util/git'; -import { processBranch } from '../../branch'; import { Limit, incLimitedValue, setMaxLimit } from '../../global/limits'; import { BranchConfig, BranchResult } from '../../types'; +import { processBranch } from '../update/branch'; import { getBranchesRemaining, getPrsRemaining } from './limits'; export type WriteUpdateResult = 'done' | 'automerged'; diff --git a/lib/workers/branch/__snapshots__/commit.spec.ts.snap b/lib/workers/repository/update/branch/__snapshots__/commit.spec.ts.snap similarity index 79% rename from lib/workers/branch/__snapshots__/commit.spec.ts.snap rename to lib/workers/repository/update/branch/__snapshots__/commit.spec.ts.snap index 8925d1a4fa..ab51121c96 100644 --- a/lib/workers/branch/__snapshots__/commit.spec.ts.snap +++ b/lib/workers/repository/update/branch/__snapshots__/commit.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`workers/branch/commit commitFilesToBranch commits files 1`] = ` +exports[`workers/repository/update/branch/commit commitFilesToBranch commits files 1`] = ` Array [ Array [ Object { @@ -20,7 +20,7 @@ Array [ ] `; -exports[`workers/branch/commit commitFilesToBranch commits via platform 1`] = ` +exports[`workers/repository/update/branch/commit commitFilesToBranch commits via platform 1`] = ` Array [ Array [ Object { diff --git a/lib/workers/branch/__snapshots__/get-updated.spec.ts.snap b/lib/workers/repository/update/branch/__snapshots__/get-updated.spec.ts.snap similarity index 70% rename from lib/workers/branch/__snapshots__/get-updated.spec.ts.snap rename to lib/workers/repository/update/branch/__snapshots__/get-updated.spec.ts.snap index da1db7c719..546b9ac2f7 100644 --- a/lib/workers/branch/__snapshots__/get-updated.spec.ts.snap +++ b/lib/workers/repository/update/branch/__snapshots__/get-updated.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`workers/branch/get-updated getUpdatedPackageFiles() bumps versions in autoReplace managers 1`] = ` +exports[`workers/repository/update/branch/get-updated getUpdatedPackageFiles() bumps versions in autoReplace managers 1`] = ` Object { "artifactErrors": Array [], "reuseExistingBranch": undefined, @@ -15,7 +15,7 @@ Object { } `; -exports[`workers/branch/get-updated getUpdatedPackageFiles() bumps versions in updateDependency managers 1`] = ` +exports[`workers/repository/update/branch/get-updated getUpdatedPackageFiles() bumps versions in updateDependency managers 1`] = ` Object { "artifactErrors": Array [], "reuseExistingBranch": undefined, @@ -30,7 +30,7 @@ Object { } `; -exports[`workers/branch/get-updated getUpdatedPackageFiles() handles autoreplace base updated 1`] = ` +exports[`workers/repository/update/branch/get-updated getUpdatedPackageFiles() handles autoreplace base updated 1`] = ` Object { "artifactErrors": Array [], "reuseExistingBranch": undefined, @@ -45,7 +45,7 @@ Object { } `; -exports[`workers/branch/get-updated getUpdatedPackageFiles() handles autoreplace branch needs update 1`] = ` +exports[`workers/repository/update/branch/get-updated getUpdatedPackageFiles() handles autoreplace branch needs update 1`] = ` Object { "artifactErrors": Array [], "reuseExistingBranch": false, @@ -60,7 +60,7 @@ Object { } `; -exports[`workers/branch/get-updated getUpdatedPackageFiles() handles content change 1`] = ` +exports[`workers/repository/update/branch/get-updated getUpdatedPackageFiles() handles content change 1`] = ` Object { "artifactErrors": Array [], "reuseExistingBranch": false, @@ -75,7 +75,7 @@ Object { } `; -exports[`workers/branch/get-updated getUpdatedPackageFiles() handles git submodules 1`] = ` +exports[`workers/repository/update/branch/get-updated getUpdatedPackageFiles() handles git submodules 1`] = ` Object { "artifactErrors": Array [], "reuseExistingBranch": undefined, @@ -90,7 +90,7 @@ Object { } `; -exports[`workers/branch/get-updated getUpdatedPackageFiles() handles isRemediation rebase 1`] = ` +exports[`workers/repository/update/branch/get-updated getUpdatedPackageFiles() handles isRemediation rebase 1`] = ` Object { "artifactErrors": Array [], "reuseExistingBranch": false, @@ -105,7 +105,7 @@ Object { } `; -exports[`workers/branch/get-updated getUpdatedPackageFiles() handles isRemediation success 1`] = ` +exports[`workers/repository/update/branch/get-updated getUpdatedPackageFiles() handles isRemediation success 1`] = ` Object { "artifactErrors": Array [], "reuseExistingBranch": undefined, @@ -120,7 +120,7 @@ Object { } `; -exports[`workers/branch/get-updated getUpdatedPackageFiles() handles lock file errors 1`] = ` +exports[`workers/repository/update/branch/get-updated getUpdatedPackageFiles() handles lock file errors 1`] = ` Object { "artifactErrors": Array [ Object { @@ -140,7 +140,7 @@ Object { } `; -exports[`workers/branch/get-updated getUpdatedPackageFiles() handles lock files 1`] = ` +exports[`workers/repository/update/branch/get-updated getUpdatedPackageFiles() handles lock files 1`] = ` Object { "artifactErrors": Array [], "reuseExistingBranch": true, @@ -161,7 +161,7 @@ Object { } `; -exports[`workers/branch/get-updated getUpdatedPackageFiles() handles lockFileMaintenance 1`] = ` +exports[`workers/repository/update/branch/get-updated getUpdatedPackageFiles() handles lockFileMaintenance 1`] = ` Object { "artifactErrors": Array [], "reuseExistingBranch": undefined, @@ -176,7 +176,7 @@ Object { } `; -exports[`workers/branch/get-updated getUpdatedPackageFiles() handles lockFileMaintenance error 1`] = ` +exports[`workers/repository/update/branch/get-updated getUpdatedPackageFiles() handles lockFileMaintenance error 1`] = ` Object { "artifactErrors": Array [ Object { @@ -190,7 +190,7 @@ Object { } `; -exports[`workers/branch/get-updated getUpdatedPackageFiles() update artifacts on update-lockfile strategy 1`] = ` +exports[`workers/repository/update/branch/get-updated getUpdatedPackageFiles() update artifacts on update-lockfile strategy 1`] = ` Object { "artifactErrors": Array [], "reuseExistingBranch": undefined, @@ -211,7 +211,7 @@ Object { } `; -exports[`workers/branch/get-updated getUpdatedPackageFiles() update artifacts on update-lockfile strategy with no updateLockedDependency 1`] = ` +exports[`workers/repository/update/branch/get-updated getUpdatedPackageFiles() update artifacts on update-lockfile strategy with no updateLockedDependency 1`] = ` Object { "artifactErrors": Array [], "reuseExistingBranch": undefined, diff --git a/lib/workers/branch/artifacts.spec.ts b/lib/workers/repository/update/branch/artifacts.spec.ts similarity index 82% rename from lib/workers/branch/artifacts.spec.ts rename to lib/workers/repository/update/branch/artifacts.spec.ts index 86a9ff97ab..d46e36a34e 100644 --- a/lib/workers/branch/artifacts.spec.ts +++ b/lib/workers/repository/update/branch/artifacts.spec.ts @@ -1,10 +1,10 @@ -import { getConfig, platform } from '../../../test/util'; -import { GlobalConfig } from '../../config/global'; -import { BranchStatus } from '../../types'; -import type { BranchConfig } from '../types'; +import { getConfig, platform } from '../../../../../test/util'; +import { GlobalConfig } from '../../../../config/global'; +import { BranchStatus } from '../../../../types'; +import type { BranchConfig } from '../../../types'; import { setArtifactErrorStatus } from './artifacts'; -describe('workers/branch/artifacts', () => { +describe('workers/repository/update/branch/artifacts', () => { let config: BranchConfig; beforeEach(() => { GlobalConfig.set({}); diff --git a/lib/workers/branch/artifacts.ts b/lib/workers/repository/update/branch/artifacts.ts similarity index 75% rename from lib/workers/branch/artifacts.ts rename to lib/workers/repository/update/branch/artifacts.ts index d1a1f6aff4..6a4ec5d1d8 100644 --- a/lib/workers/branch/artifacts.ts +++ b/lib/workers/repository/update/branch/artifacts.ts @@ -1,8 +1,8 @@ -import { GlobalConfig } from '../../config/global'; -import { logger } from '../../logger'; -import { platform } from '../../modules/platform'; -import { BranchStatus } from '../../types'; -import type { BranchConfig } from '../types'; +import { GlobalConfig } from '../../../../config/global'; +import { logger } from '../../../../logger'; +import { platform } from '../../../../modules/platform'; +import { BranchStatus } from '../../../../types'; +import type { BranchConfig } from '../../../types'; export async function setArtifactErrorStatus( config: BranchConfig diff --git a/lib/workers/branch/auto-replace.spec.ts b/lib/workers/repository/update/branch/auto-replace.spec.ts similarity index 92% rename from lib/workers/branch/auto-replace.spec.ts rename to lib/workers/repository/update/branch/auto-replace.spec.ts index d63d1f7087..92ac413fb4 100644 --- a/lib/workers/branch/auto-replace.spec.ts +++ b/lib/workers/repository/update/branch/auto-replace.spec.ts @@ -1,16 +1,19 @@ -import { Fixtures } from '../../../test/fixtures'; -import { defaultConfig } from '../../../test/util'; -import { GlobalConfig } from '../../config/global'; -import { WORKER_FILE_UPDATE_FAILED } from '../../constants/error-messages'; -import { extractPackageFile } from '../../modules/manager/html'; -import type { BranchUpgradeConfig } from '../types'; +import { Fixtures } from '../../../../../test/fixtures'; +import { defaultConfig } from '../../../../../test/util'; +import { GlobalConfig } from '../../../../config/global'; +import { WORKER_FILE_UPDATE_FAILED } from '../../../../constants/error-messages'; +import { extractPackageFile } from '../../../../modules/manager/html'; +import type { BranchUpgradeConfig } from '../../../types'; import { doAutoReplace } from './auto-replace'; -const sampleHtml = Fixtures.get('sample.html', `../../modules/manager/html`); +const sampleHtml = Fixtures.get( + 'sample.html', + `../../../../modules/manager/html` +); jest.mock('fs-extra', () => Fixtures.fsExtra()); -describe('workers/branch/auto-replace', () => { +describe('workers/repository/update/branch/auto-replace', () => { describe('doAutoReplace', () => { let reuseExistingBranch: boolean; let upgrade: BranchUpgradeConfig; diff --git a/lib/workers/branch/auto-replace.ts b/lib/workers/repository/update/branch/auto-replace.ts similarity index 90% rename from lib/workers/branch/auto-replace.ts rename to lib/workers/repository/update/branch/auto-replace.ts index 932d2a7908..230c10cc48 100644 --- a/lib/workers/branch/auto-replace.ts +++ b/lib/workers/repository/update/branch/auto-replace.ts @@ -1,12 +1,12 @@ -import { WORKER_FILE_UPDATE_FAILED } from '../../constants/error-messages'; -import { logger } from '../../logger'; -import { get } from '../../modules/manager'; -import type { PackageDependency } from '../../modules/manager/types'; -import { writeLocalFile } from '../../util/fs'; -import { escapeRegExp, regEx } from '../../util/regex'; -import { matchAt, replaceAt } from '../../util/string'; -import { compile } from '../../util/template'; -import type { BranchUpgradeConfig } from '../types'; +import { WORKER_FILE_UPDATE_FAILED } from '../../../../constants/error-messages'; +import { logger } from '../../../../logger'; +import { get } from '../../../../modules/manager'; +import type { PackageDependency } from '../../../../modules/manager/types'; +import { writeLocalFile } from '../../../../util/fs'; +import { escapeRegExp, regEx } from '../../../../util/regex'; +import { matchAt, replaceAt } from '../../../../util/string'; +import { compile } from '../../../../util/template'; +import type { BranchUpgradeConfig } from '../../../types'; export async function confirmIfDepUpdated( upgrade: BranchUpgradeConfig, diff --git a/lib/workers/branch/automerge.spec.ts b/lib/workers/repository/update/branch/automerge.spec.ts similarity index 88% rename from lib/workers/branch/automerge.spec.ts rename to lib/workers/repository/update/branch/automerge.spec.ts index 65de824a3e..e2c14094ed 100644 --- a/lib/workers/branch/automerge.spec.ts +++ b/lib/workers/repository/update/branch/automerge.spec.ts @@ -1,12 +1,12 @@ -import { defaultConfig, git, platform } from '../../../test/util'; -import { GlobalConfig } from '../../config/global'; -import type { RenovateConfig } from '../../config/types'; -import { BranchStatus } from '../../types'; +import { defaultConfig, git, platform } from '../../../../../test/util'; +import { GlobalConfig } from '../../../../config/global'; +import type { RenovateConfig } from '../../../../config/types'; +import { BranchStatus } from '../../../../types'; import { tryBranchAutomerge } from './automerge'; -jest.mock('../../util/git'); +jest.mock('../../../../util/git'); -describe('workers/branch/automerge', () => { +describe('workers/repository/update/branch/automerge', () => { describe('tryBranchAutomerge', () => { let config: RenovateConfig; beforeEach(() => { diff --git a/lib/workers/branch/automerge.ts b/lib/workers/repository/update/branch/automerge.ts similarity index 89% rename from lib/workers/branch/automerge.ts rename to lib/workers/repository/update/branch/automerge.ts index f9da16c5c7..9ed8bcfc55 100644 --- a/lib/workers/branch/automerge.ts +++ b/lib/workers/repository/update/branch/automerge.ts @@ -1,9 +1,9 @@ -import { GlobalConfig } from '../../config/global'; -import type { RenovateConfig } from '../../config/types'; -import { logger } from '../../logger'; -import { platform } from '../../modules/platform'; -import { BranchStatus } from '../../types'; -import { mergeBranch } from '../../util/git'; +import { GlobalConfig } from '../../../../config/global'; +import type { RenovateConfig } from '../../../../config/types'; +import { logger } from '../../../../logger'; +import { platform } from '../../../../modules/platform'; +import { BranchStatus } from '../../../../types'; +import { mergeBranch } from '../../../../util/git'; import { resolveBranchStatus } from './status-checks'; export type AutomergeResult = diff --git a/lib/workers/branch/check-existing.spec.ts b/lib/workers/repository/update/branch/check-existing.spec.ts similarity index 82% rename from lib/workers/branch/check-existing.spec.ts rename to lib/workers/repository/update/branch/check-existing.spec.ts index 8149ac4f40..1ca936d573 100644 --- a/lib/workers/branch/check-existing.spec.ts +++ b/lib/workers/repository/update/branch/check-existing.spec.ts @@ -1,9 +1,9 @@ -import { defaultConfig, partial, platform } from '../../../test/util'; -import { PrState } from '../../types'; -import type { BranchConfig } from '../types'; +import { defaultConfig, partial, platform } from '../../../../../test/util'; +import { PrState } from '../../../../types'; +import type { BranchConfig } from '../../../types'; import { prAlreadyExisted } from './check-existing'; -describe('workers/branch/check-existing', () => { +describe('workers/repository/update/branch/check-existing', () => { describe('prAlreadyExisted', () => { let config: BranchConfig; beforeEach(() => { diff --git a/lib/workers/branch/check-existing.ts b/lib/workers/repository/update/branch/check-existing.ts similarity index 74% rename from lib/workers/branch/check-existing.ts rename to lib/workers/repository/update/branch/check-existing.ts index cf7f5bb812..81fb78b904 100644 --- a/lib/workers/branch/check-existing.ts +++ b/lib/workers/repository/update/branch/check-existing.ts @@ -1,8 +1,8 @@ -import { REPOSITORY_CHANGED } from '../../constants/error-messages'; -import { logger } from '../../logger'; -import { Pr, platform } from '../../modules/platform'; -import { PrState } from '../../types'; -import type { BranchConfig } from '../types'; +import { REPOSITORY_CHANGED } from '../../../../constants/error-messages'; +import { logger } from '../../../../logger'; +import { Pr, platform } from '../../../../modules/platform'; +import { PrState } from '../../../../types'; +import type { BranchConfig } from '../../../types'; export async function prAlreadyExisted( config: BranchConfig diff --git a/lib/workers/branch/commit.spec.ts b/lib/workers/repository/update/branch/commit.spec.ts similarity index 86% rename from lib/workers/branch/commit.spec.ts rename to lib/workers/repository/update/branch/commit.spec.ts index 346a883043..581bcef553 100644 --- a/lib/workers/branch/commit.spec.ts +++ b/lib/workers/repository/update/branch/commit.spec.ts @@ -1,11 +1,16 @@ -import { defaultConfig, git, partial, platform } from '../../../test/util'; -import { GlobalConfig } from '../../config/global'; -import type { BranchConfig } from '../types'; +import { + defaultConfig, + git, + partial, + platform, +} from '../../../../../test/util'; +import { GlobalConfig } from '../../../../config/global'; +import type { BranchConfig } from '../../../types'; import { commitFilesToBranch } from './commit'; -jest.mock('../../util/git'); +jest.mock('../../../../util/git'); -describe('workers/branch/commit', () => { +describe('workers/repository/update/branch/commit', () => { describe('commitFilesToBranch', () => { let config: BranchConfig; beforeEach(() => { diff --git a/lib/workers/branch/commit.ts b/lib/workers/repository/update/branch/commit.ts similarity index 82% rename from lib/workers/branch/commit.ts rename to lib/workers/repository/update/branch/commit.ts index c9d67d3a6c..28f4347e8a 100644 --- a/lib/workers/branch/commit.ts +++ b/lib/workers/repository/update/branch/commit.ts @@ -1,11 +1,11 @@ import is from '@sindresorhus/is'; import minimatch from 'minimatch'; -import { GlobalConfig } from '../../config/global'; -import { CONFIG_SECRETS_EXPOSED } from '../../constants/error-messages'; -import { logger } from '../../logger'; -import { commitAndPush } from '../../modules/platform/commit'; -import { sanitize } from '../../util/sanitize'; -import type { BranchConfig } from '../types'; +import { GlobalConfig } from '../../../../config/global'; +import { CONFIG_SECRETS_EXPOSED } from '../../../../constants/error-messages'; +import { logger } from '../../../../logger'; +import { commitAndPush } from '../../../../modules/platform/commit'; +import { sanitize } from '../../../../util/sanitize'; +import type { BranchConfig } from '../../../types'; export function commitFilesToBranch( config: BranchConfig diff --git a/lib/workers/branch/execute-post-upgrade-commands.spec.ts b/lib/workers/repository/update/branch/execute-post-upgrade-commands.spec.ts similarity index 78% rename from lib/workers/branch/execute-post-upgrade-commands.spec.ts rename to lib/workers/repository/update/branch/execute-post-upgrade-commands.spec.ts index de9837e996..1ff65b234d 100644 --- a/lib/workers/branch/execute-post-upgrade-commands.spec.ts +++ b/lib/workers/repository/update/branch/execute-post-upgrade-commands.spec.ts @@ -1,13 +1,13 @@ -import { fs, git } from '../../../test/util'; -import { GlobalConfig } from '../../config/global'; -import type { StatusResult } from '../../util/git/types'; -import type { BranchConfig, BranchUpgradeConfig } from '../types'; +import { fs, git } from '../../../../../test/util'; +import { GlobalConfig } from '../../../../config/global'; +import type { StatusResult } from '../../../../util/git/types'; +import type { BranchConfig, BranchUpgradeConfig } from '../../../types'; import * as postUpgradeCommands from './execute-post-upgrade-commands'; -jest.mock('../../util/fs'); -jest.mock('../../util/git'); +jest.mock('../../../../util/fs'); +jest.mock('../../../../util/git'); -describe('workers/branch/execute-post-upgrade-commands', () => { +describe('workers/repository/update/branch/execute-post-upgrade-commands', () => { describe('postUpgradeCommandsExecutor', () => { it('handles an artifact which is a directory', async () => { const commands: BranchUpgradeConfig[] = [ diff --git a/lib/workers/branch/execute-post-upgrade-commands.ts b/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts similarity index 90% rename from lib/workers/branch/execute-post-upgrade-commands.ts rename to lib/workers/repository/update/branch/execute-post-upgrade-commands.ts index 1dfad6b711..194c16a34e 100644 --- a/lib/workers/branch/execute-post-upgrade-commands.ts +++ b/lib/workers/repository/update/branch/execute-post-upgrade-commands.ts @@ -1,16 +1,20 @@ import is from '@sindresorhus/is'; import minimatch from 'minimatch'; -import { GlobalConfig } from '../../config/global'; -import { addMeta, logger } from '../../logger'; -import type { ArtifactError } from '../../modules/manager/types'; -import { exec } from '../../util/exec'; -import { localPathIsFile, readLocalFile, writeLocalFile } from '../../util/fs'; -import { getRepoStatus } from '../../util/git'; -import type { FileChange } from '../../util/git/types'; -import { regEx } from '../../util/regex'; -import { sanitize } from '../../util/sanitize'; -import { compile } from '../../util/template'; -import type { BranchConfig, BranchUpgradeConfig } from '../types'; +import { GlobalConfig } from '../../../../config/global'; +import { addMeta, logger } from '../../../../logger'; +import type { ArtifactError } from '../../../../modules/manager/types'; +import { exec } from '../../../../util/exec'; +import { + localPathIsFile, + readLocalFile, + writeLocalFile, +} from '../../../../util/fs'; +import { getRepoStatus } from '../../../../util/git'; +import type { FileChange } from '../../../../util/git/types'; +import { regEx } from '../../../../util/regex'; +import { sanitize } from '../../../../util/sanitize'; +import { compile } from '../../../../util/template'; +import type { BranchConfig, BranchUpgradeConfig } from '../../../types'; export type PostUpgradeCommandsExecutionResult = { updatedArtifacts: FileChange[]; diff --git a/lib/workers/branch/get-updated.spec.ts b/lib/workers/repository/update/branch/get-updated.spec.ts similarity index 94% rename from lib/workers/branch/get-updated.spec.ts rename to lib/workers/repository/update/branch/get-updated.spec.ts index 8785464df3..a53ec4ac70 100644 --- a/lib/workers/branch/get-updated.spec.ts +++ b/lib/workers/repository/update/branch/get-updated.spec.ts @@ -1,11 +1,11 @@ -import { defaultConfig, git, mocked } from '../../../test/util'; -import { GitRefsDatasource } from '../../modules/datasource/git-refs'; -import * as _composer from '../../modules/manager/composer'; -import * as _gitSubmodules from '../../modules/manager/git-submodules'; -import * as _helmv3 from '../../modules/manager/helmv3'; -import * as _npm from '../../modules/manager/npm'; -import * as _poetry from '../../modules/manager/poetry'; -import type { BranchConfig } from '../types'; +import { defaultConfig, git, mocked } from '../../../../../test/util'; +import { GitRefsDatasource } from '../../../../modules/datasource/git-refs'; +import * as _composer from '../../../../modules/manager/composer'; +import * as _gitSubmodules from '../../../../modules/manager/git-submodules'; +import * as _helmv3 from '../../../../modules/manager/helmv3'; +import * as _npm from '../../../../modules/manager/npm'; +import * as _poetry from '../../../../modules/manager/poetry'; +import type { BranchConfig } from '../../../types'; import * as _autoReplace from './auto-replace'; import { getUpdatedPackageFiles } from './get-updated'; @@ -16,15 +16,15 @@ const npm = mocked(_npm); const poetry = mocked(_poetry); const autoReplace = mocked(_autoReplace); -jest.mock('../../modules/manager/composer'); -jest.mock('../../modules/manager/helmv3'); -jest.mock('../../modules/manager/npm'); -jest.mock('../../modules/manager/git-submodules'); -jest.mock('../../modules/manager/poetry'); -jest.mock('../../util/git'); +jest.mock('../../../../modules/manager/composer'); +jest.mock('../../../../modules/manager/helmv3'); +jest.mock('../../../../modules/manager/npm'); +jest.mock('../../../../modules/manager/git-submodules'); +jest.mock('../../../../modules/manager/poetry'); +jest.mock('../../../../util/git'); jest.mock('./auto-replace'); -describe('workers/branch/get-updated', () => { +describe('workers/repository/update/branch/get-updated', () => { describe('getUpdatedPackageFiles()', () => { let config: BranchConfig; beforeEach(() => { diff --git a/lib/workers/branch/get-updated.ts b/lib/workers/repository/update/branch/get-updated.ts similarity index 96% rename from lib/workers/branch/get-updated.ts rename to lib/workers/repository/update/branch/get-updated.ts index 375b61fb15..7377193996 100644 --- a/lib/workers/branch/get-updated.ts +++ b/lib/workers/repository/update/branch/get-updated.ts @@ -1,14 +1,14 @@ import is from '@sindresorhus/is'; -import { WORKER_FILE_UPDATE_FAILED } from '../../constants/error-messages'; -import { logger } from '../../logger'; -import { get } from '../../modules/manager'; +import { WORKER_FILE_UPDATE_FAILED } from '../../../../constants/error-messages'; +import { logger } from '../../../../logger'; +import { get } from '../../../../modules/manager'; import type { ArtifactError, PackageDependency, -} from '../../modules/manager/types'; -import { getFile } from '../../util/git'; -import type { FileAddition, FileChange } from '../../util/git/types'; -import type { BranchConfig } from '../types'; +} from '../../../../modules/manager/types'; +import { getFile } from '../../../../util/git'; +import type { FileAddition, FileChange } from '../../../../util/git/types'; +import type { BranchConfig } from '../../../types'; import { doAutoReplace } from './auto-replace'; export interface PackageFilesResult { diff --git a/lib/workers/branch/handle-existing.ts b/lib/workers/repository/update/branch/handle-existing.ts similarity index 75% rename from lib/workers/branch/handle-existing.ts rename to lib/workers/repository/update/branch/handle-existing.ts index 4ec99dcb50..5f93efef05 100644 --- a/lib/workers/branch/handle-existing.ts +++ b/lib/workers/repository/update/branch/handle-existing.ts @@ -1,11 +1,11 @@ -import { GlobalConfig } from '../../config/global'; -import { logger } from '../../logger'; -import type { Pr } from '../../modules/platform'; -import { ensureComment } from '../../modules/platform/comment'; -import { PrState } from '../../types'; -import { branchExists, deleteBranch } from '../../util/git'; -import * as template from '../../util/template'; -import type { BranchConfig } from '../types'; +import { GlobalConfig } from '../../../../config/global'; +import { logger } from '../../../../logger'; +import type { Pr } from '../../../../modules/platform'; +import { ensureComment } from '../../../../modules/platform/comment'; +import { PrState } from '../../../../types'; +import { branchExists, deleteBranch } from '../../../../util/git'; +import * as template from '../../../../util/template'; +import type { BranchConfig } from '../../../types'; export async function handlepr(config: BranchConfig, pr: Pr): Promise<void> { if (pr.state === PrState.Closed) { diff --git a/lib/workers/branch/index.spec.ts b/lib/workers/repository/update/branch/index.spec.ts similarity index 97% rename from lib/workers/branch/index.spec.ts rename to lib/workers/repository/update/branch/index.spec.ts index c5b64bb992..67cd04883c 100644 --- a/lib/workers/branch/index.spec.ts +++ b/lib/workers/repository/update/branch/index.spec.ts @@ -5,27 +5,27 @@ import { mocked, partial, platform, -} from '../../../test/util'; -import { GlobalConfig } from '../../config/global'; -import type { RepoGlobalConfig } from '../../config/types'; +} from '../../../../../test/util'; +import { GlobalConfig } from '../../../../config/global'; +import type { RepoGlobalConfig } from '../../../../config/types'; import { MANAGER_LOCKFILE_ERROR, REPOSITORY_CHANGED, -} from '../../constants/error-messages'; -import * as _npmPostExtract from '../../modules/manager/npm/post-update'; -import type { WriteExistingFilesResult } from '../../modules/manager/npm/post-update/types'; -import { PrState } from '../../types'; -import * as _exec from '../../util/exec'; -import type { FileChange, StatusResult } from '../../util/git/types'; -import * as _mergeConfidence from '../../util/merge-confidence'; -import * as _sanitize from '../../util/sanitize'; -import * as _limits from '../global/limits'; +} from '../../../../constants/error-messages'; +import * as _npmPostExtract from '../../../../modules/manager/npm/post-update'; +import type { WriteExistingFilesResult } from '../../../../modules/manager/npm/post-update/types'; +import { PrState } from '../../../../types'; +import * as _exec from '../../../../util/exec'; +import type { FileChange, StatusResult } from '../../../../util/git/types'; +import * as _mergeConfidence from '../../../../util/merge-confidence'; +import * as _sanitize from '../../../../util/sanitize'; +import * as _limits from '../../../global/limits'; +import type { BranchConfig, BranchUpgradeConfig } from '../../../types'; +import { BranchResult } from '../../../types'; +import type { Pr } from '../../onboarding/branch/check'; import * as _prWorker from '../pr'; import type { ResultWithPr } from '../pr'; import * as _prAutomerge from '../pr/automerge'; -import type { Pr } from '../repository/onboarding/branch/check'; -import type { BranchConfig, BranchUpgradeConfig } from '../types'; -import { BranchResult } from '../types'; import * as _automerge from './automerge'; import * as _checkExisting from './check-existing'; import * as _commit from './commit'; @@ -39,17 +39,17 @@ jest.mock('./get-updated'); jest.mock('./schedule'); jest.mock('./check-existing'); jest.mock('./reuse'); -jest.mock('../../modules/manager/npm/post-update'); +jest.mock('../../../../modules/manager/npm/post-update'); jest.mock('./automerge'); jest.mock('./commit'); jest.mock('../pr'); jest.mock('../pr/automerge'); -jest.mock('../../util/exec'); -jest.mock('../../util/merge-confidence'); -jest.mock('../../util/sanitize'); -jest.mock('../../util/fs'); -jest.mock('../../util/git'); -jest.mock('../global/limits'); +jest.mock('../../../../util/exec'); +jest.mock('../../../../util/merge-confidence'); +jest.mock('../../../../util/sanitize'); +jest.mock('../../../../util/fs'); +jest.mock('../../../../util/git'); +jest.mock('../../../global/limits'); const getUpdated = mocked(_getUpdated); const schedule = mocked(_schedule); @@ -75,7 +75,7 @@ function findFileContent(files: FileChange[], path: string): string | null { return null; } -describe('workers/branch/index', () => { +describe('workers/repository/update/branch/index', () => { describe('processBranch', () => { const updatedPackageFiles: PackageFilesResult = { updatedPackageFiles: [], diff --git a/lib/workers/branch/index.ts b/lib/workers/repository/update/branch/index.ts similarity index 96% rename from lib/workers/branch/index.ts rename to lib/workers/repository/update/branch/index.ts index d19231d1e7..cedd9bb615 100644 --- a/lib/workers/branch/index.ts +++ b/lib/workers/repository/update/branch/index.ts @@ -1,6 +1,6 @@ import { DateTime } from 'luxon'; -import { GlobalConfig } from '../../config/global'; -import type { RenovateConfig } from '../../config/types'; +import { GlobalConfig } from '../../../../config/global'; +import type { RenovateConfig } from '../../../../config/types'; import { CONFIG_VALIDATION, MANAGER_LOCKFILE_ERROR, @@ -12,18 +12,18 @@ import { SYSTEM_INSUFFICIENT_DISK_SPACE, TEMPORARY_ERROR, WORKER_FILE_UPDATE_FAILED, -} from '../../constants/error-messages'; -import { logger, removeMeta } from '../../logger'; -import { getAdditionalFiles } from '../../modules/manager/npm/post-update'; -import { Pr, platform } from '../../modules/platform'; +} from '../../../../constants/error-messages'; +import { logger, removeMeta } from '../../../../logger'; +import { getAdditionalFiles } from '../../../../modules/manager/npm/post-update'; +import { Pr, platform } from '../../../../modules/platform'; import { ensureComment, ensureCommentRemoval, -} from '../../modules/platform/comment'; -import { BranchStatus, PrState } from '../../types'; -import { ExternalHostError } from '../../types/errors/external-host-error'; -import { getElapsedDays } from '../../util/date'; -import { emojify } from '../../util/emoji'; +} from '../../../../modules/platform/comment'; +import { BranchStatus, PrState } from '../../../../types'; +import { ExternalHostError } from '../../../../types/errors/external-host-error'; +import { getElapsedDays } from '../../../../util/date'; +import { emojify } from '../../../../util/emoji'; import { checkoutBranch, deleteBranch, @@ -31,17 +31,17 @@ import { branchExists as gitBranchExists, isBranchConflicted, isBranchModified, -} from '../../util/git'; +} from '../../../../util/git'; import { getMergeConfidenceLevel, isActiveConfidenceLevel, satisfiesConfidenceLevel, -} from '../../util/merge-confidence'; -import { regEx } from '../../util/regex'; -import { Limit, isLimitReached } from '../global/limits'; +} from '../../../../util/merge-confidence'; +import { regEx } from '../../../../util/regex'; +import { Limit, isLimitReached } from '../../../global/limits'; +import { BranchConfig, BranchResult, PrBlockedBy } from '../../../types'; import { ensurePr, getPlatformPrOptions } from '../pr'; import { checkAutoMerge } from '../pr/automerge'; -import { BranchConfig, BranchResult, PrBlockedBy } from '../types'; import { setArtifactErrorStatus } from './artifacts'; import { tryBranchAutomerge } from './automerge'; import { prAlreadyExisted } from './check-existing'; diff --git a/lib/workers/repository/update/branch/lock-files/__snapshots__/index.spec.ts.snap b/lib/workers/repository/update/branch/lock-files/__snapshots__/index.spec.ts.snap new file mode 100644 index 0000000000..c2b90d226d --- /dev/null +++ b/lib/workers/repository/update/branch/lock-files/__snapshots__/index.spec.ts.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`workers/repository/update/branch/lock-files/index getAdditionalFiles returns no error and empty lockfiles if lock file maintenance exists 1`] = ` +Object { + "artifactErrors": Array [], + "updatedArtifacts": Array [], +} +`; + +exports[`workers/repository/update/branch/lock-files/index getAdditionalFiles returns no error and empty lockfiles if updateLockFiles false 1`] = ` +Object { + "artifactErrors": Array [], + "updatedArtifacts": Array [], +} +`; diff --git a/lib/workers/branch/lock-files/index.spec.ts b/lib/workers/repository/update/branch/lock-files/index.spec.ts similarity index 79% rename from lib/workers/branch/lock-files/index.spec.ts rename to lib/workers/repository/update/branch/lock-files/index.spec.ts index 1d32728ff6..ab52397486 100644 --- a/lib/workers/branch/lock-files/index.spec.ts +++ b/lib/workers/repository/update/branch/lock-files/index.spec.ts @@ -1,14 +1,14 @@ -import { git, mocked } from '../../../../test/util'; -import { getConfig } from '../../../config/defaults'; -import { GlobalConfig } from '../../../config/global'; -import * as _lockFiles from '../../../modules/manager/npm/post-update'; -import * as _lerna from '../../../modules/manager/npm/post-update/lerna'; -import * as _npm from '../../../modules/manager/npm/post-update/npm'; -import * as _pnpm from '../../../modules/manager/npm/post-update/pnpm'; -import * as _yarn from '../../../modules/manager/npm/post-update/yarn'; -import type { PostUpdateConfig } from '../../../modules/manager/types'; -import * as _fs from '../../../util/fs/proxies'; -import * as _hostRules from '../../../util/host-rules'; +import { git, mocked } from '../../../../../../test/util'; +import { getConfig } from '../../../../../config/defaults'; +import { GlobalConfig } from '../../../../../config/global'; +import * as _lockFiles from '../../../../../modules/manager/npm/post-update'; +import * as _lerna from '../../../../../modules/manager/npm/post-update/lerna'; +import * as _npm from '../../../../../modules/manager/npm/post-update/npm'; +import * as _pnpm from '../../../../../modules/manager/npm/post-update/pnpm'; +import * as _yarn from '../../../../../modules/manager/npm/post-update/yarn'; +import type { PostUpdateConfig } from '../../../../../modules/manager/types'; +import * as _fs from '../../../../../util/fs/proxies'; +import * as _hostRules from '../../../../../util/host-rules'; const config: PostUpdateConfig = getConfig(); @@ -20,7 +20,7 @@ const pnpm = mocked(_pnpm); const lerna = mocked(_lerna); const hostRules = mocked(_hostRules); -jest.mock('../../../util/git'); +jest.mock('../../../../../util/git'); hostRules.find = jest.fn((_) => ({ token: 'abc', @@ -28,7 +28,7 @@ hostRules.find = jest.fn((_) => ({ const { writeUpdatedPackageFiles, getAdditionalFiles } = lockFiles; -describe('workers/branch/lock-files/index', () => { +describe('workers/repository/update/branch/lock-files/index', () => { describe('writeUpdatedPackageFiles', () => { beforeEach(() => { GlobalConfig.set({ diff --git a/lib/workers/branch/reuse.spec.ts b/lib/workers/repository/update/branch/reuse.spec.ts similarity index 96% rename from lib/workers/branch/reuse.spec.ts rename to lib/workers/repository/update/branch/reuse.spec.ts index 2aaf1918f4..1cf45f73c7 100644 --- a/lib/workers/branch/reuse.spec.ts +++ b/lib/workers/repository/update/branch/reuse.spec.ts @@ -1,12 +1,12 @@ -import { git, platform } from '../../../test/util'; -import type { Pr } from '../../modules/platform'; -import { PrState } from '../../types'; -import type { BranchConfig } from '../types'; +import { git, platform } from '../../../../../test/util'; +import type { Pr } from '../../../../modules/platform'; +import { PrState } from '../../../../types'; +import type { BranchConfig } from '../../../types'; import { shouldReuseExistingBranch } from './reuse'; -jest.mock('../../util/git'); +jest.mock('../../../../util/git'); -describe('workers/branch/reuse', () => { +describe('workers/repository/update/branch/reuse', () => { describe('shouldReuseExistingBranch(config)', () => { const pr: Pr = { number: 42, diff --git a/lib/workers/branch/reuse.ts b/lib/workers/repository/update/branch/reuse.ts similarity index 93% rename from lib/workers/branch/reuse.ts rename to lib/workers/repository/update/branch/reuse.ts index c63fa6caf2..32ab7abc6c 100644 --- a/lib/workers/branch/reuse.ts +++ b/lib/workers/repository/update/branch/reuse.ts @@ -1,14 +1,14 @@ -import { GlobalConfig } from '../../config/global'; -import { logger } from '../../logger'; -import { platform } from '../../modules/platform'; -import type { RangeStrategy } from '../../types'; +import { GlobalConfig } from '../../../../config/global'; +import { logger } from '../../../../logger'; +import { platform } from '../../../../modules/platform'; +import type { RangeStrategy } from '../../../../types'; import { branchExists, isBranchConflicted, isBranchModified, isBranchStale, -} from '../../util/git'; -import type { BranchConfig } from '../types'; +} from '../../../../util/git'; +import type { BranchConfig } from '../../../types'; type ParentBranch = { reuseExistingBranch: boolean; diff --git a/lib/workers/branch/schedule.spec.ts b/lib/workers/repository/update/branch/schedule.spec.ts similarity index 99% rename from lib/workers/branch/schedule.spec.ts rename to lib/workers/repository/update/branch/schedule.spec.ts index 605a1ccf6b..f34ec39da6 100644 --- a/lib/workers/branch/schedule.spec.ts +++ b/lib/workers/repository/update/branch/schedule.spec.ts @@ -1,8 +1,8 @@ import mockDate from 'mockdate'; -import type { RenovateConfig } from '../../config/types'; +import type { RenovateConfig } from '../../../../config/types'; import * as schedule from './schedule'; -describe('workers/branch/schedule', () => { +describe('workers/repository/update/branch/schedule', () => { describe('hasValidTimezone(schedule)', () => { it('returns false for invalid timezone', () => { expect(schedule.hasValidTimezone('Asia')[0]).toBeFalse(); diff --git a/lib/workers/branch/schedule.ts b/lib/workers/repository/update/branch/schedule.ts similarity index 97% rename from lib/workers/branch/schedule.ts rename to lib/workers/repository/update/branch/schedule.ts index 1984e57225..3cf58a6ff8 100644 --- a/lib/workers/branch/schedule.ts +++ b/lib/workers/repository/update/branch/schedule.ts @@ -2,9 +2,9 @@ import later from '@breejs/later'; import { parseCron } from '@cheap-glitch/mi-cron'; import is from '@sindresorhus/is'; import { DateTime } from 'luxon'; -import { fixShortHours } from '../../config/migration'; -import type { RenovateConfig } from '../../config/types'; -import { logger } from '../../logger'; +import { fixShortHours } from '../../../../config/migration'; +import type { RenovateConfig } from '../../../../config/types'; +import { logger } from '../../../../logger'; const minutesChar = '*'; diff --git a/lib/workers/branch/status-checks.spec.ts b/lib/workers/repository/update/branch/status-checks.spec.ts similarity index 94% rename from lib/workers/branch/status-checks.spec.ts rename to lib/workers/repository/update/branch/status-checks.spec.ts index ad4d1c2627..275215065f 100644 --- a/lib/workers/branch/status-checks.spec.ts +++ b/lib/workers/repository/update/branch/status-checks.spec.ts @@ -1,5 +1,5 @@ -import { defaultConfig, platform } from '../../../test/util'; -import { BranchStatus } from '../../types'; +import { defaultConfig, platform } from '../../../../../test/util'; +import { BranchStatus } from '../../../../types'; import { ConfidenceConfig, StabilityConfig, @@ -8,7 +8,7 @@ import { setStability, } from './status-checks'; -describe('workers/branch/status-checks', () => { +describe('workers/repository/update/branch/status-checks', () => { describe('setStability', () => { let config: StabilityConfig; beforeEach(() => { diff --git a/lib/workers/branch/status-checks.ts b/lib/workers/repository/update/branch/status-checks.ts similarity index 90% rename from lib/workers/branch/status-checks.ts rename to lib/workers/repository/update/branch/status-checks.ts index 5adfff2440..33d7dd3090 100644 --- a/lib/workers/branch/status-checks.ts +++ b/lib/workers/repository/update/branch/status-checks.ts @@ -1,11 +1,11 @@ -import type { RenovateConfig } from '../../config/types'; -import { logger } from '../../logger'; -import { platform } from '../../modules/platform'; -import { BranchStatus } from '../../types'; +import type { RenovateConfig } from '../../../../config/types'; +import { logger } from '../../../../logger'; +import { platform } from '../../../../modules/platform'; +import { BranchStatus } from '../../../../types'; import { MergeConfidence, isActiveConfidenceLevel, -} from '../../util/merge-confidence'; +} from '../../../../util/merge-confidence'; export async function resolveBranchStatus( branchName: string, diff --git a/lib/workers/pr/__fixtures__/adapter-utils.md b/lib/workers/repository/update/pr/__fixtures__/adapter-utils.md similarity index 100% rename from lib/workers/pr/__fixtures__/adapter-utils.md rename to lib/workers/repository/update/pr/__fixtures__/adapter-utils.md diff --git a/lib/workers/pr/__fixtures__/angular-js.md b/lib/workers/repository/update/pr/__fixtures__/angular-js.md similarity index 100% rename from lib/workers/pr/__fixtures__/angular-js.md rename to lib/workers/repository/update/pr/__fixtures__/angular-js.md diff --git a/lib/workers/pr/__fixtures__/gitter-webapp.md b/lib/workers/repository/update/pr/__fixtures__/gitter-webapp.md similarity index 100% rename from lib/workers/pr/__fixtures__/gitter-webapp.md rename to lib/workers/repository/update/pr/__fixtures__/gitter-webapp.md diff --git a/lib/workers/pr/__fixtures__/jest.md b/lib/workers/repository/update/pr/__fixtures__/jest.md similarity index 100% rename from lib/workers/pr/__fixtures__/jest.md rename to lib/workers/repository/update/pr/__fixtures__/jest.md diff --git a/lib/workers/pr/__fixtures__/js-yaml.md b/lib/workers/repository/update/pr/__fixtures__/js-yaml.md similarity index 100% rename from lib/workers/pr/__fixtures__/js-yaml.md rename to lib/workers/repository/update/pr/__fixtures__/js-yaml.md diff --git a/lib/workers/pr/__fixtures__/yargs.md b/lib/workers/repository/update/pr/__fixtures__/yargs.md similarity index 100% rename from lib/workers/pr/__fixtures__/yargs.md rename to lib/workers/repository/update/pr/__fixtures__/yargs.md diff --git a/lib/workers/pr/__snapshots__/index.spec.ts.snap b/lib/workers/repository/update/pr/__snapshots__/index.spec.ts.snap similarity index 87% rename from lib/workers/pr/__snapshots__/index.spec.ts.snap rename to lib/workers/repository/update/pr/__snapshots__/index.spec.ts.snap index 0ec31d4e69..38e323cae1 100644 --- a/lib/workers/pr/__snapshots__/index.spec.ts.snap +++ b/lib/workers/repository/update/pr/__snapshots__/index.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`workers/pr/index ensurePr should add and deduplicate additionalReviewers on new PR 1`] = ` +exports[`workers/repository/update/pr/index ensurePr should add and deduplicate additionalReviewers on new PR 1`] = ` Array [ Array [ undefined, @@ -14,7 +14,7 @@ Array [ ] `; -exports[`workers/pr/index ensurePr should add and deduplicate additionalReviewers to empty reviewers on new PR 1`] = ` +exports[`workers/repository/update/pr/index ensurePr should add and deduplicate additionalReviewers to empty reviewers on new PR 1`] = ` Array [ Array [ undefined, @@ -28,7 +28,7 @@ Array [ ] `; -exports[`workers/pr/index ensurePr should add assignees and reviewers to new PR 1`] = ` +exports[`workers/repository/update/pr/index ensurePr should add assignees and reviewers to new PR 1`] = ` Array [ Array [ undefined, @@ -40,7 +40,7 @@ Array [ ] `; -exports[`workers/pr/index ensurePr should add assignees and reviewers to new PR 2`] = ` +exports[`workers/repository/update/pr/index ensurePr should add assignees and reviewers to new PR 2`] = ` Array [ Array [ undefined, @@ -52,7 +52,7 @@ Array [ ] `; -exports[`workers/pr/index ensurePr should add note about Pin 1`] = ` +exports[`workers/repository/update/pr/index ensurePr should add note about Pin 1`] = ` Array [ Object { "draftPR": false, @@ -72,7 +72,7 @@ Array [ ] `; -exports[`workers/pr/index ensurePr should combine assignees from code owners and config 1`] = ` +exports[`workers/repository/update/pr/index ensurePr should combine assignees from code owners and config 1`] = ` Array [ Array [ undefined, @@ -85,7 +85,7 @@ Array [ ] `; -exports[`workers/pr/index ensurePr should create PR if success 1`] = ` +exports[`workers/repository/update/pr/index ensurePr should create PR if success 1`] = ` Array [ Object { "draftPR": false, @@ -105,7 +105,7 @@ Array [ ] `; -exports[`workers/pr/index ensurePr should create PR if success for gitlab deps 1`] = ` +exports[`workers/repository/update/pr/index ensurePr should create PR if success for gitlab deps 1`] = ` Array [ Object { "draftPR": false, @@ -125,7 +125,7 @@ Array [ ] `; -exports[`workers/pr/index ensurePr should create group PR 1`] = ` +exports[`workers/repository/update/pr/index ensurePr should create group PR 1`] = ` Array [ Object { "draftPR": false, @@ -145,7 +145,7 @@ Array [ ] `; -exports[`workers/pr/index ensurePr should create privateRepo PR if success 1`] = ` +exports[`workers/repository/update/pr/index ensurePr should create privateRepo PR if success 1`] = ` Array [ Object { "draftPR": false, @@ -165,7 +165,7 @@ Array [ ] `; -exports[`workers/pr/index ensurePr should determine assignees from code owners 1`] = ` +exports[`workers/repository/update/pr/index ensurePr should determine assignees from code owners 1`] = ` Array [ Array [ undefined, @@ -177,7 +177,7 @@ Array [ ] `; -exports[`workers/pr/index ensurePr should determine reviewers from code owners 1`] = ` +exports[`workers/repository/update/pr/index ensurePr should determine reviewers from code owners 1`] = ` Array [ Array [ undefined, @@ -189,7 +189,7 @@ Array [ ] `; -exports[`workers/pr/index ensurePr should filter assignees and reviewers based on their availability 1`] = ` +exports[`workers/repository/update/pr/index ensurePr should filter assignees and reviewers based on their availability 1`] = ` Array [ Array [ undefined, @@ -200,7 +200,7 @@ Array [ ] `; -exports[`workers/pr/index ensurePr should filter assignees and reviewers based on their availability 2`] = ` +exports[`workers/repository/update/pr/index ensurePr should filter assignees and reviewers based on their availability 2`] = ` Array [ Array [ undefined, @@ -211,7 +211,7 @@ Array [ ] `; -exports[`workers/pr/index ensurePr should filter assignees and reviewers based on their availability 3`] = ` +exports[`workers/repository/update/pr/index ensurePr should filter assignees and reviewers based on their availability 3`] = ` Array [ Array [ Array [ @@ -229,7 +229,7 @@ Array [ ] `; -exports[`workers/pr/index ensurePr should return modified existing PR 1`] = ` +exports[`workers/repository/update/pr/index ensurePr should return modified existing PR 1`] = ` Object { "body": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` |\\n\\n---\\n\\n### Release Notes\\n\\n<details>\\n<summary>renovateapp/dummy</summary>\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n</details>\\n\\n---\\n\\n### Configuration\\n\\n📅 **Schedule**: \\"before 5am\\" (UTC).\\n\\n🚦 **Automerge**: Enabled.\\n\\n♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.\\n\\n🔕 **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).", "displayNumber": "Existing PR", @@ -237,7 +237,7 @@ Object { } `; -exports[`workers/pr/index ensurePr should return modified existing PR title 1`] = ` +exports[`workers/repository/update/pr/index ensurePr should return modified existing PR title 1`] = ` Object { "body": "This PR contains the following updates:\\n\\n| Package | Type | Update | Change |\\n|---|---|---|---|\\n| [dummy](https://dummy.com) ([source](https://github.com/renovateapp/dummy), [changelog](https://github.com/renovateapp/dummy/changelog.md)) | devDependencies | minor | \`1.0.0\` -> \`1.1.0\` |\\n\\n---\\n\\n### Release Notes\\n\\n<details>\\n<summary>renovateapp/dummy</summary>\\n\\n### [\`v1.1.0\`](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n[Compare Source](https://github.com/renovateapp/dummy/compare/v1.0.0...v1.1.0)\\n\\n</details>\\n\\n---\\n\\n### Configuration\\n\\n📅 **Schedule**: \\"before 5am\\" (UTC).\\n\\n🚦 **Automerge**: Enabled.\\n\\n♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.\\n\\n🔕 **Ignore**: Close this PR and you won't be reminded about this update again.\\n\\n---\\n\\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.\\n\\n---\\n\\nThis PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).", "displayNumber": "Existing PR", @@ -245,4 +245,4 @@ Object { } `; -exports[`workers/pr/index ensurePr should return unmodified existing PR 1`] = `Array []`; +exports[`workers/repository/update/pr/index ensurePr should return unmodified existing PR 1`] = `Array []`; diff --git a/lib/workers/pr/automerge.spec.ts b/lib/workers/repository/update/pr/automerge.spec.ts similarity index 92% rename from lib/workers/pr/automerge.spec.ts rename to lib/workers/repository/update/pr/automerge.spec.ts index e10e2b410c..7eda18fbc7 100644 --- a/lib/workers/pr/automerge.spec.ts +++ b/lib/workers/repository/update/pr/automerge.spec.ts @@ -1,15 +1,15 @@ -import { getConfig, git, mocked, partial } from '../../../test/util'; -import { Pr, platform as _platform } from '../../modules/platform'; -import { BranchStatus } from '../../types'; -import type { BranchConfig } from '../types'; +import { getConfig, git, mocked, partial } from '../../../../../test/util'; +import { Pr, platform as _platform } from '../../../../modules/platform'; +import { BranchStatus } from '../../../../types'; +import type { BranchConfig } from '../../../types'; import * as prAutomerge from './automerge'; -jest.mock('../../util/git'); +jest.mock('../../../../util/git'); const platform = mocked(_platform); const defaultConfig = getConfig(); -describe('workers/pr/automerge', () => { +describe('workers/repository/update/pr/automerge', () => { describe('checkAutoMerge(pr, config)', () => { let config: BranchConfig; let pr: Pr; diff --git a/lib/workers/pr/automerge.ts b/lib/workers/repository/update/pr/automerge.ts similarity index 91% rename from lib/workers/pr/automerge.ts rename to lib/workers/repository/update/pr/automerge.ts index 2b19fd1793..001a433c09 100644 --- a/lib/workers/pr/automerge.ts +++ b/lib/workers/repository/update/pr/automerge.ts @@ -1,18 +1,18 @@ -import { GlobalConfig } from '../../config/global'; -import { logger } from '../../logger'; -import { Pr, platform } from '../../modules/platform'; +import { GlobalConfig } from '../../../../config/global'; +import { logger } from '../../../../logger'; +import { Pr, platform } from '../../../../modules/platform'; import { ensureComment, ensureCommentRemoval, -} from '../../modules/platform/comment'; -import { BranchStatus } from '../../types'; +} from '../../../../modules/platform/comment'; +import { BranchStatus } from '../../../../types'; import { deleteBranch, isBranchConflicted, isBranchModified, -} from '../../util/git'; +} from '../../../../util/git'; +import type { BranchConfig } from '../../../types'; import { resolveBranchStatus } from '../branch/status-checks'; -import type { BranchConfig } from '../types'; // eslint-disable-next-line typescript-enum/no-enum export enum PrAutomergeBlockReason { diff --git a/lib/workers/pr/body/changelogs.ts b/lib/workers/repository/update/pr/body/changelogs.ts similarity index 78% rename from lib/workers/pr/body/changelogs.ts rename to lib/workers/repository/update/pr/body/changelogs.ts index ad7b3660e5..ceb2e079e9 100644 --- a/lib/workers/pr/body/changelogs.ts +++ b/lib/workers/repository/update/pr/body/changelogs.ts @@ -1,8 +1,8 @@ -import { unemojify } from '../../../util/emoji'; -import { sanitizeMarkdown } from '../../../util/markdown'; -import { regEx } from '../../../util/regex'; -import * as template from '../../../util/template'; -import type { BranchConfig } from '../../types'; +import { unemojify } from '../../../../../util/emoji'; +import { sanitizeMarkdown } from '../../../../../util/markdown'; +import { regEx } from '../../../../../util/regex'; +import * as template from '../../../../../util/template'; +import type { BranchConfig } from '../../../../types'; import releaseNotesHbs from '../changelog/hbs-template'; export function getChangelogs(config: BranchConfig): string { diff --git a/lib/workers/pr/body/config-description.spec.ts b/lib/workers/repository/update/pr/body/config-description.spec.ts similarity index 78% rename from lib/workers/pr/body/config-description.spec.ts rename to lib/workers/repository/update/pr/body/config-description.spec.ts index ca4d474ca1..0b3d393e84 100644 --- a/lib/workers/pr/body/config-description.spec.ts +++ b/lib/workers/repository/update/pr/body/config-description.spec.ts @@ -1,10 +1,10 @@ import { mock } from 'jest-mock-extended'; -import type { BranchConfig } from '../../types'; +import type { BranchConfig } from '../../../../types'; import { getPrConfigDescription } from './config-description'; -jest.mock('../../../util/git'); +jest.mock('../../../../../util/git'); -describe('workers/pr/body/config-description', () => { +describe('workers/repository/update/pr/body/config-description', () => { describe('getPrConfigDescription', () => { let branchConfig: BranchConfig; beforeEach(() => { diff --git a/lib/workers/pr/body/config-description.ts b/lib/workers/repository/update/pr/body/config-description.ts similarity index 92% rename from lib/workers/pr/body/config-description.ts rename to lib/workers/repository/update/pr/body/config-description.ts index 3dc8034974..3a2e8bb096 100644 --- a/lib/workers/pr/body/config-description.ts +++ b/lib/workers/repository/update/pr/body/config-description.ts @@ -1,7 +1,7 @@ -import { BranchStatus } from '../../../types'; -import { emojify } from '../../../util/emoji'; +import { BranchStatus } from '../../../../../types'; +import { emojify } from '../../../../../util/emoji'; +import type { BranchConfig } from '../../../../types'; import { resolveBranchStatus } from '../../branch/status-checks'; -import type { BranchConfig } from '../../types'; export async function getPrConfigDescription( config: BranchConfig diff --git a/lib/workers/pr/body/controls.spec.ts b/lib/workers/repository/update/pr/body/controls.spec.ts similarity index 87% rename from lib/workers/pr/body/controls.spec.ts rename to lib/workers/repository/update/pr/body/controls.spec.ts index 0272354500..5d3a86e072 100644 --- a/lib/workers/pr/body/controls.spec.ts +++ b/lib/workers/repository/update/pr/body/controls.spec.ts @@ -1,11 +1,11 @@ import { mock } from 'jest-mock-extended'; -import { git } from '../../../../test/util'; -import type { BranchConfig } from '../../types'; +import { git } from '../../../../../../test/util'; +import type { BranchConfig } from '../../../../types'; import { getControls } from './controls'; -jest.mock('../../../util/git'); +jest.mock('../../../../../util/git'); -describe('workers/pr/body/controls', () => { +describe('workers/repository/update/pr/body/controls', () => { describe('getControls', () => { let branchConfig: BranchConfig; beforeEach(() => { diff --git a/lib/workers/pr/body/controls.ts b/lib/workers/repository/update/pr/body/controls.ts similarity index 67% rename from lib/workers/pr/body/controls.ts rename to lib/workers/repository/update/pr/body/controls.ts index d3eb1d8dfc..037c672c04 100644 --- a/lib/workers/pr/body/controls.ts +++ b/lib/workers/repository/update/pr/body/controls.ts @@ -1,6 +1,6 @@ -import { emojify } from '../../../util/emoji'; -import { isBranchModified } from '../../../util/git'; -import type { BranchConfig } from '../../types'; +import { emojify } from '../../../../../util/emoji'; +import { isBranchModified } from '../../../../../util/git'; +import type { BranchConfig } from '../../../../types'; export async function getControls(config: BranchConfig): Promise<string> { const warning = (await isBranchModified(config.branchName)) diff --git a/lib/workers/pr/body/footer.ts b/lib/workers/repository/update/pr/body/footer.ts similarity index 63% rename from lib/workers/pr/body/footer.ts rename to lib/workers/repository/update/pr/body/footer.ts index 77fadc40c1..d2d250b0f1 100644 --- a/lib/workers/pr/body/footer.ts +++ b/lib/workers/repository/update/pr/body/footer.ts @@ -1,5 +1,5 @@ -import * as template from '../../../util/template'; -import type { BranchConfig } from '../../types'; +import * as template from '../../../../../util/template'; +import type { BranchConfig } from '../../../../types'; // istanbul ignore next export function getPrFooter(config: BranchConfig): string { diff --git a/lib/workers/pr/body/header.ts b/lib/workers/repository/update/pr/body/header.ts similarity index 63% rename from lib/workers/pr/body/header.ts rename to lib/workers/repository/update/pr/body/header.ts index 7ae2564079..9afc5b55c9 100644 --- a/lib/workers/pr/body/header.ts +++ b/lib/workers/repository/update/pr/body/header.ts @@ -1,5 +1,5 @@ -import * as template from '../../../util/template'; -import type { BranchConfig } from '../../types'; +import * as template from '../../../../../util/template'; +import type { BranchConfig } from '../../../../types'; // istanbul ignore next export function getPrHeader(config: BranchConfig): string { diff --git a/lib/workers/pr/body/index.ts b/lib/workers/repository/update/pr/body/index.ts similarity index 88% rename from lib/workers/pr/body/index.ts rename to lib/workers/repository/update/pr/body/index.ts index fdc99b984a..1b3de2321f 100644 --- a/lib/workers/pr/body/index.ts +++ b/lib/workers/repository/update/pr/body/index.ts @@ -1,8 +1,8 @@ -import { platform } from '../../../modules/platform'; -import { regEx } from '../../../util/regex'; -import * as template from '../../../util/template'; -import { ensureTrailingSlash } from '../../../util/url'; -import type { BranchConfig } from '../../types'; +import { platform } from '../../../../../modules/platform'; +import { regEx } from '../../../../../util/regex'; +import * as template from '../../../../../util/template'; +import { ensureTrailingSlash } from '../../../../../util/url'; +import type { BranchConfig } from '../../../../types'; import { getChangelogs } from './changelogs'; import { getPrConfigDescription } from './config-description'; import { getControls } from './controls'; diff --git a/lib/workers/pr/body/notes.ts b/lib/workers/repository/update/pr/body/notes.ts similarity index 86% rename from lib/workers/pr/body/notes.ts rename to lib/workers/repository/update/pr/body/notes.ts index 7040be5837..c6ea1da919 100644 --- a/lib/workers/pr/body/notes.ts +++ b/lib/workers/repository/update/pr/body/notes.ts @@ -1,8 +1,8 @@ import is from '@sindresorhus/is'; -import { logger } from '../../../logger'; -import { emojify } from '../../../util/emoji'; -import * as template from '../../../util/template'; -import type { BranchConfig } from '../../types'; +import { logger } from '../../../../../logger'; +import { emojify } from '../../../../../util/emoji'; +import * as template from '../../../../../util/template'; +import type { BranchConfig } from '../../../../types'; export function getPrNotes(config: BranchConfig): string { const notes = []; diff --git a/lib/workers/pr/body/updates-table.spec.ts b/lib/workers/repository/update/pr/body/updates-table.spec.ts similarity index 96% rename from lib/workers/pr/body/updates-table.spec.ts rename to lib/workers/repository/update/pr/body/updates-table.spec.ts index 5f25204bdd..9e33bab633 100644 --- a/lib/workers/pr/body/updates-table.spec.ts +++ b/lib/workers/repository/update/pr/body/updates-table.spec.ts @@ -1,7 +1,7 @@ -import type { BranchConfig, BranchUpgradeConfig } from '../../types'; +import type { BranchConfig, BranchUpgradeConfig } from '../../../../types'; import { getPrUpdatesTable } from './updates-table'; -describe('workers/pr/body/updates-table', () => { +describe('workers/repository/update/pr/body/updates-table', () => { it('checks a case where prBodyColumns are undefined', () => { const configObj: BranchConfig = { branchName: 'some-branch', diff --git a/lib/workers/pr/body/updates-table.ts b/lib/workers/repository/update/pr/body/updates-table.ts similarity index 91% rename from lib/workers/pr/body/updates-table.ts rename to lib/workers/repository/update/pr/body/updates-table.ts index ea41b9ee67..f6718c3099 100644 --- a/lib/workers/pr/body/updates-table.ts +++ b/lib/workers/repository/update/pr/body/updates-table.ts @@ -1,7 +1,7 @@ -import { logger } from '../../../logger'; -import { regEx } from '../../../util/regex'; -import * as template from '../../../util/template'; -import type { BranchConfig, BranchUpgradeConfig } from '../../types'; +import { logger } from '../../../../../logger'; +import { regEx } from '../../../../../util/regex'; +import * as template from '../../../../../util/template'; +import type { BranchConfig, BranchUpgradeConfig } from '../../../../types'; type TableDefinition = { header: string; diff --git a/lib/workers/pr/changelog/__snapshots__/github.spec.ts.snap b/lib/workers/repository/update/pr/changelog/__snapshots__/github.spec.ts.snap similarity index 92% rename from lib/workers/pr/changelog/__snapshots__/github.spec.ts.snap rename to lib/workers/repository/update/pr/changelog/__snapshots__/github.spec.ts.snap index dfc462b844..57f6a7c913 100644 --- a/lib/workers/pr/changelog/__snapshots__/github.spec.ts.snap +++ b/lib/workers/repository/update/pr/changelog/__snapshots__/github.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`workers/pr/changelog/github getChangeLogJSON filters unnecessary warns 1`] = ` +exports[`workers/repository/update/pr/changelog/github getChangeLogJSON filters unnecessary warns 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -55,7 +55,7 @@ Object { } `; -exports[`workers/pr/changelog/github getChangeLogJSON supports github enterprise and github enterprise changelog 1`] = ` +exports[`workers/repository/update/pr/changelog/github getChangeLogJSON supports github enterprise and github enterprise changelog 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -110,7 +110,7 @@ Object { } `; -exports[`workers/pr/changelog/github getChangeLogJSON supports github enterprise and github.com changelog 1`] = ` +exports[`workers/repository/update/pr/changelog/github getChangeLogJSON supports github enterprise and github.com changelog 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -165,7 +165,7 @@ Object { } `; -exports[`workers/pr/changelog/github getChangeLogJSON supports node engines 1`] = ` +exports[`workers/repository/update/pr/changelog/github getChangeLogJSON supports node engines 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -220,7 +220,7 @@ Object { } `; -exports[`workers/pr/changelog/github getChangeLogJSON uses GitHub tags 1`] = ` +exports[`workers/repository/update/pr/changelog/github getChangeLogJSON uses GitHub tags 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -275,7 +275,7 @@ Object { } `; -exports[`workers/pr/changelog/github getChangeLogJSON works without Github 1`] = ` +exports[`workers/repository/update/pr/changelog/github getChangeLogJSON works without Github 1`] = ` Object { "hasReleaseNotes": true, "project": Object { diff --git a/lib/workers/pr/changelog/__snapshots__/gitlab.spec.ts.snap b/lib/workers/repository/update/pr/changelog/__snapshots__/gitlab.spec.ts.snap similarity index 94% rename from lib/workers/pr/changelog/__snapshots__/gitlab.spec.ts.snap rename to lib/workers/repository/update/pr/changelog/__snapshots__/gitlab.spec.ts.snap index 945b58d597..0423cacd0a 100644 --- a/lib/workers/pr/changelog/__snapshots__/gitlab.spec.ts.snap +++ b/lib/workers/repository/update/pr/changelog/__snapshots__/gitlab.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`workers/pr/changelog/gitlab getChangeLogJSON handles empty GitLab tags response 1`] = ` +exports[`workers/repository/update/pr/changelog/gitlab getChangeLogJSON handles empty GitLab tags response 1`] = ` Object { "hasReleaseNotes": false, "project": Object { @@ -45,7 +45,7 @@ Object { } `; -exports[`workers/pr/changelog/gitlab getChangeLogJSON handles empty GitLab tags response 2`] = ` +exports[`workers/repository/update/pr/changelog/gitlab getChangeLogJSON handles empty GitLab tags response 2`] = ` Array [ Object { "headers": Object { @@ -149,7 +149,7 @@ Array [ ] `; -exports[`workers/pr/changelog/gitlab getChangeLogJSON supports gitlab enterprise and gitlab enterprise changelog 1`] = ` +exports[`workers/repository/update/pr/changelog/gitlab getChangeLogJSON supports gitlab enterprise and gitlab enterprise changelog 1`] = ` Object { "hasReleaseNotes": false, "project": Object { @@ -194,7 +194,7 @@ Object { } `; -exports[`workers/pr/changelog/gitlab getChangeLogJSON supports self-hosted gitlab changelog 1`] = ` +exports[`workers/repository/update/pr/changelog/gitlab getChangeLogJSON supports self-hosted gitlab changelog 1`] = ` Object { "hasReleaseNotes": false, "project": Object { @@ -239,7 +239,7 @@ Object { } `; -exports[`workers/pr/changelog/gitlab getChangeLogJSON uses GitLab tags 1`] = ` +exports[`workers/repository/update/pr/changelog/gitlab getChangeLogJSON uses GitLab tags 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -304,7 +304,7 @@ Object { } `; -exports[`workers/pr/changelog/gitlab getChangeLogJSON uses GitLab tags 2`] = ` +exports[`workers/repository/update/pr/changelog/gitlab getChangeLogJSON uses GitLab tags 2`] = ` Array [ Object { "headers": Object { @@ -408,7 +408,7 @@ Array [ ] `; -exports[`workers/pr/changelog/gitlab getChangeLogJSON uses GitLab tags with error 1`] = ` +exports[`workers/repository/update/pr/changelog/gitlab getChangeLogJSON uses GitLab tags with error 1`] = ` Object { "hasReleaseNotes": false, "project": Object { @@ -453,7 +453,7 @@ Object { } `; -exports[`workers/pr/changelog/gitlab getChangeLogJSON uses GitLab tags with error 2`] = ` +exports[`workers/repository/update/pr/changelog/gitlab getChangeLogJSON uses GitLab tags with error 2`] = ` Array [ Object { "headers": Object { @@ -557,7 +557,7 @@ Array [ ] `; -exports[`workers/pr/changelog/gitlab getChangeLogJSON works without GitLab 1`] = ` +exports[`workers/repository/update/pr/changelog/gitlab getChangeLogJSON works without GitLab 1`] = ` Object { "hasReleaseNotes": false, "project": Object { diff --git a/lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap b/lib/workers/repository/update/pr/changelog/__snapshots__/index.spec.ts.snap similarity index 96% rename from lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap rename to lib/workers/repository/update/pr/changelog/__snapshots__/index.spec.ts.snap index 7cd8ed8fb3..1e5faba943 100644 --- a/lib/workers/pr/changelog/__snapshots__/index.spec.ts.snap +++ b/lib/workers/repository/update/pr/changelog/__snapshots__/index.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`workers/pr/changelog/index getChangeLogJSON filters unnecessary warns 1`] = ` +exports[`workers/repository/update/pr/changelog/index getChangeLogJSON filters unnecessary warns 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -55,7 +55,7 @@ Object { } `; -exports[`workers/pr/changelog/index getChangeLogJSON filters unnecessary warns 2`] = ` +exports[`workers/repository/update/pr/changelog/index getChangeLogJSON filters unnecessary warns 2`] = ` Array [ Object { "headers": Object { @@ -159,7 +159,7 @@ Array [ ] `; -exports[`workers/pr/changelog/index getChangeLogJSON supports github enterprise and github enterprise changelog 1`] = ` +exports[`workers/repository/update/pr/changelog/index getChangeLogJSON supports github enterprise and github enterprise changelog 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -214,7 +214,7 @@ Object { } `; -exports[`workers/pr/changelog/index getChangeLogJSON supports github enterprise and github enterprise changelog 2`] = ` +exports[`workers/repository/update/pr/changelog/index getChangeLogJSON supports github enterprise and github enterprise changelog 2`] = ` Array [ Object { "headers": Object { @@ -362,7 +362,7 @@ Array [ ] `; -exports[`workers/pr/changelog/index getChangeLogJSON supports github enterprise and github.com changelog 1`] = ` +exports[`workers/repository/update/pr/changelog/index getChangeLogJSON supports github enterprise and github.com changelog 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -417,7 +417,7 @@ Object { } `; -exports[`workers/pr/changelog/index getChangeLogJSON supports github enterprise and github.com changelog 2`] = ` +exports[`workers/repository/update/pr/changelog/index getChangeLogJSON supports github enterprise and github.com changelog 2`] = ` Array [ Object { "headers": Object { @@ -565,7 +565,7 @@ Array [ ] `; -exports[`workers/pr/changelog/index getChangeLogJSON supports github.com and github enterprise changelog 1`] = ` +exports[`workers/repository/update/pr/changelog/index getChangeLogJSON supports github.com and github enterprise changelog 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -620,7 +620,7 @@ Object { } `; -exports[`workers/pr/changelog/index getChangeLogJSON supports github.com and github enterprise changelog 2`] = ` +exports[`workers/repository/update/pr/changelog/index getChangeLogJSON supports github.com and github enterprise changelog 2`] = ` Array [ Object { "headers": Object { @@ -768,7 +768,7 @@ Array [ ] `; -exports[`workers/pr/changelog/index getChangeLogJSON supports node engines 1`] = ` +exports[`workers/repository/update/pr/changelog/index getChangeLogJSON supports node engines 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -823,7 +823,7 @@ Object { } `; -exports[`workers/pr/changelog/index getChangeLogJSON uses GitHub tags 1`] = ` +exports[`workers/repository/update/pr/changelog/index getChangeLogJSON uses GitHub tags 1`] = ` Object { "hasReleaseNotes": true, "project": Object { @@ -883,7 +883,7 @@ Object { } `; -exports[`workers/pr/changelog/index getChangeLogJSON uses GitHub tags 2`] = ` +exports[`workers/repository/update/pr/changelog/index getChangeLogJSON uses GitHub tags 2`] = ` Array [ Object { "headers": Object { @@ -1031,7 +1031,7 @@ Array [ ] `; -exports[`workers/pr/changelog/index getChangeLogJSON works without Github 1`] = ` +exports[`workers/repository/update/pr/changelog/index getChangeLogJSON works without Github 1`] = ` Object { "hasReleaseNotes": true, "project": Object { diff --git a/lib/workers/pr/changelog/__snapshots__/release-notes.spec.ts.snap b/lib/workers/repository/update/pr/changelog/__snapshots__/release-notes.spec.ts.snap similarity index 89% rename from lib/workers/pr/changelog/__snapshots__/release-notes.spec.ts.snap rename to lib/workers/repository/update/pr/changelog/__snapshots__/release-notes.spec.ts.snap index 82d38f9806..3fe66bd32d 100644 --- a/lib/workers/pr/changelog/__snapshots__/release-notes.spec.ts.snap +++ b/lib/workers/repository/update/pr/changelog/__snapshots__/release-notes.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`workers/pr/changelog/release-notes getReleaseList() should return release list for github repo 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseList() should return release list for github repo 1`] = ` Array [ Object { "body": undefined, @@ -21,7 +21,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseList() should return release list for github repo 2`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseList() should return release list for github repo 2`] = ` Array [ Object { "headers": Object { @@ -36,7 +36,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseList() should return release list for gitlab.com project 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseList() should return release list for gitlab.com project 1`] = ` Array [ Object { "body": undefined, @@ -55,7 +55,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseList() should return release list for gitlab.com project 2`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseList() should return release list for gitlab.com project 2`] = ` Array [ Object { "headers": Object { @@ -70,7 +70,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseList() should return release list for self hosted gitlab project 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseList() should return release list for self hosted gitlab project 1`] = ` Array [ Object { "body": undefined, @@ -89,7 +89,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseList() should return release list for self hosted gitlab project 2`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseList() should return release list for self hosted gitlab project 2`] = ` Array [ Object { "headers": Object { @@ -105,7 +105,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body "" 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotes() gets release notes with body "" 1`] = ` Array [ Object { "headers": Object { @@ -120,7 +120,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body "other@" 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotes() gets release notes with body "other@" 1`] = ` Array [ Object { "headers": Object { @@ -135,7 +135,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body "other_v" 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotes() gets release notes with body "other_v" 1`] = ` Array [ Object { "headers": Object { @@ -150,7 +150,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body "other-" 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotes() gets release notes with body "other-" 1`] = ` Array [ Object { "headers": Object { @@ -165,7 +165,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body "v" 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotes() gets release notes with body "v" 1`] = ` Array [ Object { "headers": Object { @@ -180,7 +180,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body from gitlab repo "" 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotes() gets release notes with body from gitlab repo "" 1`] = ` Array [ Object { "headers": Object { @@ -195,7 +195,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body from gitlab repo "other-" 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotes() gets release notes with body from gitlab repo "other-" 1`] = ` Array [ Object { "headers": Object { @@ -210,7 +210,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotes() gets release notes with body from gitlab repo "v" 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotes() gets release notes with body from gitlab repo "v" 1`] = ` Array [ Object { "headers": Object { @@ -225,7 +225,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotes() should return null for release notes without body 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotes() should return null for release notes without body 1`] = ` Array [ Object { "headers": Object { @@ -240,7 +240,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness handles gitlab sourceDirectory 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness handles gitlab sourceDirectory 1`] = ` Array [ Object { "headers": Object { @@ -264,7 +264,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness handles gitlab sourceDirectory 2`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness handles gitlab sourceDirectory 2`] = ` Object { "body": "- add new auth, fix accept header and base path in mock @@ -279,7 +279,7 @@ See merge request itentialopensource/adapter-utils!177 } `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses adapter-utils 4.33.0 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses adapter-utils 4.33.0 1`] = ` Array [ Object { "headers": Object { @@ -303,7 +303,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses adapter-utils 4.33.0 2`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses adapter-utils 4.33.0 2`] = ` Object { "body": "- add new auth, fix accept header and base path in mock @@ -318,7 +318,7 @@ See merge request itentialopensource/adapter-utils!177 } `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.2.0 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.2.0 1`] = ` Array [ Object { "headers": Object { @@ -353,7 +353,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.2.0 2`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.2.0 2`] = ` Object { "body": "##### ⚠ BREAKING CHANGES @@ -384,7 +384,7 @@ Object { } `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.3.0 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.3.0 1`] = ` Array [ Object { "headers": Object { @@ -419,7 +419,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.3.0 2`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() ReleaseNotes Correctness parses yargs 15.3.0 2`] = ` Object { "body": "##### Features @@ -435,7 +435,7 @@ Object { } `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() handles bad markdown 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() handles bad markdown 1`] = ` Array [ Object { "headers": Object { @@ -470,7 +470,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() handles files mismatch 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() handles files mismatch 1`] = ` Array [ Object { "headers": Object { @@ -495,7 +495,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() handles github sourceDirectory 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() handles github sourceDirectory 1`] = ` Array [ Object { "headers": Object { @@ -530,7 +530,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() handles github sourceDirectory 2`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() handles github sourceDirectory 2`] = ` Object { "body": "- Fix \`condenseFlow\` output (quote keys for sure, instead of spaces), [#371](https://github.com/nodeca/js-yaml/issues/371), [#370](https://github.com/nodeca/js-yaml/issues/370). - Dump astrals as codepoints instead of surrogate pair, [#368](https://github.com/nodeca/js-yaml/issues/368). @@ -540,7 +540,7 @@ Object { } `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() handles wrong format 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() handles wrong format 1`] = ` Array [ Object { "headers": Object { @@ -575,7 +575,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses angular.js 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() parses angular.js 1`] = ` Object { "body": "#### Bug Fixes @@ -606,7 +606,7 @@ Object { } `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses angular.js 2`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() parses angular.js 2`] = ` Array [ Object { "headers": Object { @@ -641,7 +641,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses gitlab.com/gitlab-org/gitter/webapp 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() parses gitlab.com/gitlab-org/gitter/webapp 1`] = ` Array [ Object { "headers": Object { @@ -665,7 +665,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses gitlab.com/gitlab-org/gitter/webapp 2`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() parses gitlab.com/gitlab-org/gitter/webapp 2`] = ` Object { "body": "- Removing markup from a part of the French translation, <https://gitlab.com/gitlab-org/gitter/webapp/-/merge_requests/1878> - Fix typo documentation -> documentation, <https://gitlab.com/gitlab-org/gitter/webapp/-/merge_requests/1880> @@ -682,7 +682,7 @@ Object { } `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses jest 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() parses jest 1`] = ` Array [ Object { "headers": Object { @@ -717,7 +717,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses jest 2`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() parses jest 2`] = ` Object { "body": "##### Fixes @@ -910,7 +910,7 @@ Object { } `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses js-yaml 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() parses js-yaml 1`] = ` Array [ Object { "headers": Object { @@ -945,7 +945,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses js-yaml 2`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() parses js-yaml 2`] = ` Object { "body": "- Fix \`condenseFlow\` output (quote keys for sure, instead of spaces), [#371](https://github.com/nodeca/js-yaml/issues/371), [#370](https://github.com/nodeca/js-yaml/issues/370). - Dump astrals as codepoints instead of surrogate pair, [#368](https://github.com/nodeca/js-yaml/issues/368). @@ -955,7 +955,7 @@ Object { } `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses self hosted gitlab 1`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() parses self hosted gitlab 1`] = ` Array [ Object { "headers": Object { @@ -981,7 +981,7 @@ Array [ ] `; -exports[`workers/pr/changelog/release-notes getReleaseNotesMd() parses self hosted gitlab 2`] = ` +exports[`workers/repository/update/pr/changelog/release-notes getReleaseNotesMd() parses self hosted gitlab 2`] = ` Object { "body": "- Removing markup from a part of the French translation, <https://gitlab.com/gitlab-org/gitter/webapp/-/merge_requests/1878> - Fix typo documentation -> documentation, <https://gitlab.com/gitlab-org/gitter/webapp/-/merge_requests/1880> diff --git a/lib/workers/pr/changelog/__snapshots__/releases.spec.ts.snap b/lib/workers/repository/update/pr/changelog/__snapshots__/releases.spec.ts.snap similarity index 61% rename from lib/workers/pr/changelog/__snapshots__/releases.spec.ts.snap rename to lib/workers/repository/update/pr/changelog/__snapshots__/releases.spec.ts.snap index 17f7b18e5f..05d4e729e2 100644 --- a/lib/workers/pr/changelog/__snapshots__/releases.spec.ts.snap +++ b/lib/workers/repository/update/pr/changelog/__snapshots__/releases.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`workers/pr/changelog/releases getReleaseNotes() should contain both currentVersion newVersion unstable 1`] = ` +exports[`workers/repository/update/pr/changelog/releases getReleaseNotes() should contain both currentVersion newVersion unstable 1`] = ` Array [ Object { "version": "1.0.1-rc0", @@ -23,7 +23,7 @@ Array [ ] `; -exports[`workers/pr/changelog/releases getReleaseNotes() should contain currentVersion unstable 1`] = ` +exports[`workers/repository/update/pr/changelog/releases getReleaseNotes() should contain currentVersion unstable 1`] = ` Array [ Object { "version": "1.0.1-rc0", @@ -40,7 +40,7 @@ Array [ ] `; -exports[`workers/pr/changelog/releases getReleaseNotes() should contain only stable 1`] = ` +exports[`workers/repository/update/pr/changelog/releases getReleaseNotes() should contain only stable 1`] = ` Array [ Object { "version": "1.0.0", @@ -54,7 +54,7 @@ Array [ ] `; -exports[`workers/pr/changelog/releases getReleaseNotes() should contain newVersion unstable 1`] = ` +exports[`workers/repository/update/pr/changelog/releases getReleaseNotes() should contain newVersion unstable 1`] = ` Array [ Object { "version": "1.0.1", @@ -71,7 +71,7 @@ Array [ ] `; -exports[`workers/pr/changelog/releases getReleaseNotes() should valueToVersion 1`] = ` +exports[`workers/repository/update/pr/changelog/releases getReleaseNotes() should valueToVersion 1`] = ` Array [ Object { "version": "1.0.1", diff --git a/lib/workers/pr/changelog/github.spec.ts b/lib/workers/repository/update/pr/changelog/github.spec.ts similarity index 94% rename from lib/workers/pr/changelog/github.spec.ts rename to lib/workers/repository/update/pr/changelog/github.spec.ts index 4c39eac9c7..577ca9f319 100644 --- a/lib/workers/pr/changelog/github.spec.ts +++ b/lib/workers/repository/update/pr/changelog/github.spec.ts @@ -1,11 +1,11 @@ -import * as httpMock from '../../../../test/http-mock'; -import { PlatformId } from '../../../constants'; -import * as semverVersioning from '../../../modules/versioning/semver'; -import * as hostRules from '../../../util/host-rules'; -import type { BranchUpgradeConfig } from '../../types'; +import * as httpMock from '../../../../../../test/http-mock'; +import { PlatformId } from '../../../../../constants'; +import * as semverVersioning from '../../../../../modules/versioning/semver'; +import * as hostRules from '../../../../../util/host-rules'; +import type { BranchUpgradeConfig } from '../../../../types'; import { ChangeLogError, getChangeLogJSON } from '.'; -jest.mock('../../../modules/datasource/npm'); +jest.mock('../../../../../modules/datasource/npm'); const upgrade: BranchUpgradeConfig = { branchName: undefined, @@ -29,7 +29,7 @@ const upgrade: BranchUpgradeConfig = { ], }; -describe('workers/pr/changelog/github', () => { +describe('workers/repository/update/pr/changelog/github', () => { afterEach(() => { // FIXME: add missing http mocks httpMock.clear(false); diff --git a/lib/workers/pr/changelog/github/index.ts b/lib/workers/repository/update/pr/changelog/github/index.ts similarity index 87% rename from lib/workers/pr/changelog/github/index.ts rename to lib/workers/repository/update/pr/changelog/github/index.ts index c586f07ccd..9d6675ca41 100644 --- a/lib/workers/pr/changelog/github/index.ts +++ b/lib/workers/repository/update/pr/changelog/github/index.ts @@ -1,15 +1,15 @@ import changelogFilenameRegex from 'changelog-filename-regex'; -import { logger } from '../../../../logger'; -import type { GithubRelease } from '../../../../modules/datasource/github-releases/types'; -import type { GitHubTag } from '../../../../modules/datasource/github-tags/types'; +import { logger } from '../../../../../../logger'; +import type { GithubRelease } from '../../../../../../modules/datasource/github-releases/types'; +import type { GitHubTag } from '../../../../../../modules/datasource/github-tags/types'; import type { GithubGitBlob, GithubGitTree, GithubGitTreeNode, -} from '../../../../types/platform/github'; -import { GithubHttp } from '../../../../util/http/github'; -import { fromBase64 } from '../../../../util/string'; -import { ensureTrailingSlash } from '../../../../util/url'; +} from '../../../../../../types/platform/github'; +import { GithubHttp } from '../../../../../../util/http/github'; +import { fromBase64 } from '../../../../../../util/string'; +import { ensureTrailingSlash } from '../../../../../../util/url'; import type { ChangeLogFile, ChangeLogNotes } from '../types'; export const id = 'github-changelog'; diff --git a/lib/workers/pr/changelog/gitlab.spec.ts b/lib/workers/repository/update/pr/changelog/gitlab.spec.ts similarity index 95% rename from lib/workers/pr/changelog/gitlab.spec.ts rename to lib/workers/repository/update/pr/changelog/gitlab.spec.ts index 6093b4b95c..e9c23ab7ae 100644 --- a/lib/workers/pr/changelog/gitlab.spec.ts +++ b/lib/workers/repository/update/pr/changelog/gitlab.spec.ts @@ -1,11 +1,11 @@ -import * as httpMock from '../../../../test/http-mock'; -import { PlatformId } from '../../../constants'; -import * as semverVersioning from '../../../modules/versioning/semver'; -import * as hostRules from '../../../util/host-rules'; -import type { BranchUpgradeConfig } from '../../types'; +import * as httpMock from '../../../../../../test/http-mock'; +import { PlatformId } from '../../../../../constants'; +import * as semverVersioning from '../../../../../modules/versioning/semver'; +import * as hostRules from '../../../../../util/host-rules'; +import type { BranchUpgradeConfig } from '../../../../types'; import { getChangeLogJSON } from '.'; -jest.mock('../../../modules/datasource/npm'); +jest.mock('../../../../../modules/datasource/npm'); const upgrade: BranchUpgradeConfig = { branchName: undefined, @@ -30,7 +30,7 @@ const upgrade: BranchUpgradeConfig = { const matchHost = 'https://gitlab.com/'; -describe('workers/pr/changelog/gitlab', () => { +describe('workers/repository/update/pr/changelog/gitlab', () => { afterEach(() => { // FIXME: add missing http mocks httpMock.clear(false); diff --git a/lib/workers/pr/changelog/gitlab/index.ts b/lib/workers/repository/update/pr/changelog/gitlab/index.ts similarity index 87% rename from lib/workers/pr/changelog/gitlab/index.ts rename to lib/workers/repository/update/pr/changelog/gitlab/index.ts index beee4e7ac2..34cc7e1126 100644 --- a/lib/workers/pr/changelog/gitlab/index.ts +++ b/lib/workers/repository/update/pr/changelog/gitlab/index.ts @@ -1,10 +1,10 @@ import changelogFilenameRegex from 'changelog-filename-regex'; -import { logger } from '../../../../logger'; -import type { GitlabRelease } from '../../../../modules/datasource/gitlab-releases/types'; -import type { GitlabTag } from '../../../../modules/datasource/gitlab-tags/types'; -import type { GitlabTreeNode } from '../../../../types/platform/gitlab'; -import { GitlabHttp } from '../../../../util/http/gitlab'; -import { ensureTrailingSlash } from '../../../../util/url'; +import { logger } from '../../../../../../logger'; +import type { GitlabRelease } from '../../../../../../modules/datasource/gitlab-releases/types'; +import type { GitlabTag } from '../../../../../../modules/datasource/gitlab-tags/types'; +import type { GitlabTreeNode } from '../../../../../../types/platform/gitlab'; +import { GitlabHttp } from '../../../../../../util/http/gitlab'; +import { ensureTrailingSlash } from '../../../../../../util/url'; import type { ChangeLogFile, ChangeLogNotes } from '../types'; export const id = 'gitlab-changelog'; diff --git a/lib/workers/pr/changelog/hbs-template.ts b/lib/workers/repository/update/pr/changelog/hbs-template.ts similarity index 100% rename from lib/workers/pr/changelog/hbs-template.ts rename to lib/workers/repository/update/pr/changelog/hbs-template.ts diff --git a/lib/workers/pr/changelog/index.spec.ts b/lib/workers/repository/update/pr/changelog/index.spec.ts similarity index 95% rename from lib/workers/pr/changelog/index.spec.ts rename to lib/workers/repository/update/pr/changelog/index.spec.ts index 3c2cbca862..4a4d51ae9f 100644 --- a/lib/workers/pr/changelog/index.spec.ts +++ b/lib/workers/repository/update/pr/changelog/index.spec.ts @@ -1,12 +1,12 @@ -import * as httpMock from '../../../../test/http-mock'; -import { partial } from '../../../../test/util'; -import { PlatformId } from '../../../constants'; -import * as semverVersioning from '../../../modules/versioning/semver'; -import * as hostRules from '../../../util/host-rules'; -import type { BranchConfig } from '../../types'; +import * as httpMock from '../../../../../../test/http-mock'; +import { partial } from '../../../../../../test/util'; +import { PlatformId } from '../../../../../constants'; +import * as semverVersioning from '../../../../../modules/versioning/semver'; +import * as hostRules from '../../../../../util/host-rules'; +import type { BranchConfig } from '../../../../types'; import { ChangeLogError, getChangeLogJSON } from '.'; -jest.mock('../../../modules/datasource/npm'); +jest.mock('../../../../../modules/datasource/npm'); const githubApiHost = 'https://api.github.com'; @@ -31,7 +31,7 @@ const upgrade: BranchConfig = partial<BranchConfig>({ ], }); -describe('workers/pr/changelog/index', () => { +describe('workers/repository/update/pr/changelog/index', () => { describe('getChangeLogJSON', () => { beforeEach(() => { hostRules.clear(); diff --git a/lib/workers/pr/changelog/index.ts b/lib/workers/repository/update/pr/changelog/index.ts similarity index 88% rename from lib/workers/pr/changelog/index.ts rename to lib/workers/repository/update/pr/changelog/index.ts index 56360da1c7..43e56c478e 100644 --- a/lib/workers/pr/changelog/index.ts +++ b/lib/workers/repository/update/pr/changelog/index.ts @@ -1,6 +1,6 @@ -import { logger } from '../../../logger'; -import * as allVersioning from '../../../modules/versioning'; -import type { BranchUpgradeConfig } from '../../types'; +import { logger } from '../../../../../logger'; +import * as allVersioning from '../../../../../modules/versioning'; +import type { BranchUpgradeConfig } from '../../../../types'; import { getInRangeReleases } from './releases'; import * as sourceGithub from './source-github'; import * as sourceGitlab from './source-gitlab'; diff --git a/lib/workers/pr/changelog/release-notes.spec.ts b/lib/workers/repository/update/pr/changelog/release-notes.spec.ts similarity index 98% rename from lib/workers/pr/changelog/release-notes.spec.ts rename to lib/workers/repository/update/pr/changelog/release-notes.spec.ts index a7c7319937..6b2879bc14 100644 --- a/lib/workers/pr/changelog/release-notes.spec.ts +++ b/lib/workers/repository/update/pr/changelog/release-notes.spec.ts @@ -1,9 +1,9 @@ import { DateTime } from 'luxon'; -import * as httpMock from '../../../../test/http-mock'; -import { loadFixture, mocked } from '../../../../test/util'; -import { clone } from '../../../util/clone'; -import * as _hostRules from '../../../util/host-rules'; -import { toBase64 } from '../../../util/string'; +import * as httpMock from '../../../../../../test/http-mock'; +import { loadFixture, mocked } from '../../../../../../test/util'; +import { clone } from '../../../../../util/clone'; +import * as _hostRules from '../../../../../util/host-rules'; +import { toBase64 } from '../../../../../util/string'; import { addReleaseNotes, getReleaseList, @@ -18,7 +18,7 @@ import type { ChangeLogResult, } from './types'; -jest.mock('../../../util/host-rules'); +jest.mock('../../../../../util/host-rules'); const hostRules = mocked(_hostRules); @@ -55,7 +55,7 @@ const gitlabProject = { baseUrl: 'https://gitlab.com/', } as ChangeLogProject; -describe('workers/pr/changelog/release-notes', () => { +describe('workers/repository/update/pr/changelog/release-notes', () => { beforeEach(() => { hostRules.find.mockReturnValue({}); hostRules.hosts.mockReturnValue([]); diff --git a/lib/workers/pr/changelog/release-notes.ts b/lib/workers/repository/update/pr/changelog/release-notes.ts similarity index 97% rename from lib/workers/pr/changelog/release-notes.ts rename to lib/workers/repository/update/pr/changelog/release-notes.ts index aa5591149d..1cfd3c3253 100644 --- a/lib/workers/pr/changelog/release-notes.ts +++ b/lib/workers/repository/update/pr/changelog/release-notes.ts @@ -2,11 +2,11 @@ import URL from 'url'; import is from '@sindresorhus/is'; import { DateTime } from 'luxon'; import MarkdownIt from 'markdown-it'; -import { logger } from '../../../logger'; -import * as memCache from '../../../util/cache/memory'; -import * as packageCache from '../../../util/cache/package'; -import { linkify } from '../../../util/markdown'; -import { newlineRegex, regEx } from '../../../util/regex'; +import { logger } from '../../../../../logger'; +import * as memCache from '../../../../../util/cache/memory'; +import * as packageCache from '../../../../../util/cache/package'; +import { linkify } from '../../../../../util/markdown'; +import { newlineRegex, regEx } from '../../../../../util/regex'; import * as github from './github'; import * as gitlab from './gitlab'; import type { diff --git a/lib/workers/pr/changelog/releases.spec.ts b/lib/workers/repository/update/pr/changelog/releases.spec.ts similarity index 87% rename from lib/workers/pr/changelog/releases.spec.ts rename to lib/workers/repository/update/pr/changelog/releases.spec.ts index 4da586627a..a255cf0034 100644 --- a/lib/workers/pr/changelog/releases.spec.ts +++ b/lib/workers/repository/update/pr/changelog/releases.spec.ts @@ -1,11 +1,11 @@ -import { partial } from '../../../../test/util'; -import * as datasource from '../../../modules/datasource'; -import * as dockerVersioning from '../../../modules/versioning/docker'; -import * as npmVersioning from '../../../modules/versioning/npm'; -import type { BranchUpgradeConfig } from '../../types'; +import { partial } from '../../../../../../test/util'; +import * as datasource from '../../../../../modules/datasource'; +import * as dockerVersioning from '../../../../../modules/versioning/docker'; +import * as npmVersioning from '../../../../../modules/versioning/npm'; +import type { BranchUpgradeConfig } from '../../../../types'; import * as releases from './releases'; -describe('workers/pr/changelog/releases', () => { +describe('workers/repository/update/pr/changelog/releases', () => { describe('getReleaseNotes()', () => { beforeEach(() => { jest.spyOn(datasource, 'getPkgReleases').mockResolvedValueOnce({ diff --git a/lib/workers/pr/changelog/releases.ts b/lib/workers/repository/update/pr/changelog/releases.ts similarity index 89% rename from lib/workers/pr/changelog/releases.ts rename to lib/workers/repository/update/pr/changelog/releases.ts index a45646191e..9163fd5448 100644 --- a/lib/workers/pr/changelog/releases.ts +++ b/lib/workers/repository/update/pr/changelog/releases.ts @@ -1,11 +1,11 @@ -import { logger } from '../../../logger'; +import { logger } from '../../../../../logger'; import { Release, getPkgReleases, isGetPkgReleasesConfig, -} from '../../../modules/datasource'; -import { VersioningApi, get } from '../../../modules/versioning'; -import type { BranchUpgradeConfig } from '../../types'; +} from '../../../../../modules/datasource'; +import { VersioningApi, get } from '../../../../../modules/versioning'; +import type { BranchUpgradeConfig } from '../../../../types'; function matchesMMP(version: VersioningApi, v1: string, v2: string): boolean { return ( diff --git a/lib/workers/pr/changelog/source-github.ts b/lib/workers/repository/update/pr/changelog/source-github.ts similarity index 89% rename from lib/workers/pr/changelog/source-github.ts rename to lib/workers/repository/update/pr/changelog/source-github.ts index efacc235bb..4f5eb9307e 100644 --- a/lib/workers/pr/changelog/source-github.ts +++ b/lib/workers/repository/update/pr/changelog/source-github.ts @@ -1,13 +1,13 @@ import URL from 'url'; -import { PlatformId } from '../../../constants'; -import { logger } from '../../../logger'; -import type { Release } from '../../../modules/datasource/types'; -import * as allVersioning from '../../../modules/versioning'; -import * as memCache from '../../../util/cache/memory'; -import * as packageCache from '../../../util/cache/package'; -import * as hostRules from '../../../util/host-rules'; -import { regEx } from '../../../util/regex'; -import type { BranchUpgradeConfig } from '../../types'; +import { PlatformId } from '../../../../../constants'; +import { logger } from '../../../../../logger'; +import type { Release } from '../../../../../modules/datasource/types'; +import * as allVersioning from '../../../../../modules/versioning'; +import * as memCache from '../../../../../util/cache/memory'; +import * as packageCache from '../../../../../util/cache/package'; +import * as hostRules from '../../../../../util/host-rules'; +import { regEx } from '../../../../../util/regex'; +import type { BranchUpgradeConfig } from '../../../../types'; import { getTags } from './github'; import { addReleaseNotes } from './release-notes'; import { ChangeLogError, ChangeLogRelease, ChangeLogResult } from './types'; diff --git a/lib/workers/pr/changelog/source-gitlab.ts b/lib/workers/repository/update/pr/changelog/source-gitlab.ts similarity index 90% rename from lib/workers/pr/changelog/source-gitlab.ts rename to lib/workers/repository/update/pr/changelog/source-gitlab.ts index f247b6be16..64c3f04edc 100644 --- a/lib/workers/pr/changelog/source-gitlab.ts +++ b/lib/workers/repository/update/pr/changelog/source-gitlab.ts @@ -1,11 +1,11 @@ import URL from 'url'; -import { logger } from '../../../logger'; -import type { Release } from '../../../modules/datasource/types'; -import * as allVersioning from '../../../modules/versioning'; -import * as memCache from '../../../util/cache/memory'; -import * as packageCache from '../../../util/cache/package'; -import { regEx } from '../../../util/regex'; -import type { BranchUpgradeConfig } from '../../types'; +import { logger } from '../../../../../logger'; +import type { Release } from '../../../../../modules/datasource/types'; +import * as allVersioning from '../../../../../modules/versioning'; +import * as memCache from '../../../../../util/cache/memory'; +import * as packageCache from '../../../../../util/cache/package'; +import { regEx } from '../../../../../util/regex'; +import type { BranchUpgradeConfig } from '../../../../types'; import { getTags } from './gitlab'; import { addReleaseNotes } from './release-notes'; import type { ChangeLogRelease, ChangeLogResult } from './types'; diff --git a/lib/workers/pr/changelog/types.ts b/lib/workers/repository/update/pr/changelog/types.ts similarity index 100% rename from lib/workers/pr/changelog/types.ts rename to lib/workers/repository/update/pr/changelog/types.ts diff --git a/lib/workers/pr/code-owners.spec.ts b/lib/workers/repository/update/pr/code-owners.spec.ts similarity index 92% rename from lib/workers/pr/code-owners.spec.ts rename to lib/workers/repository/update/pr/code-owners.spec.ts index 84a72a40f2..886475d898 100644 --- a/lib/workers/pr/code-owners.spec.ts +++ b/lib/workers/repository/update/pr/code-owners.spec.ts @@ -1,12 +1,12 @@ import { mock } from 'jest-mock-extended'; -import { fs, git } from '../../../test/util'; -import type { Pr } from '../../modules/platform'; +import { fs, git } from '../../../../../test/util'; +import type { Pr } from '../../../../modules/platform'; import { codeOwnersForPr } from './code-owners'; -jest.mock('../../util/fs'); -jest.mock('../../util/git'); +jest.mock('../../../../util/fs'); +jest.mock('../../../../util/git'); -describe('workers/pr/code-owners', () => { +describe('workers/repository/update/pr/code-owners', () => { describe('codeOwnersForPr', () => { let pr: Pr; beforeEach(() => { diff --git a/lib/workers/pr/code-owners.ts b/lib/workers/repository/update/pr/code-owners.ts similarity index 85% rename from lib/workers/pr/code-owners.ts rename to lib/workers/repository/update/pr/code-owners.ts index f92eed162b..80f3daeb2c 100644 --- a/lib/workers/pr/code-owners.ts +++ b/lib/workers/repository/update/pr/code-owners.ts @@ -1,9 +1,9 @@ import ignore from 'ignore'; -import { logger } from '../../logger'; -import type { Pr } from '../../modules/platform'; -import { readLocalFile } from '../../util/fs'; -import { getBranchFiles } from '../../util/git'; -import { newlineRegex, regEx } from '../../util/regex'; +import { logger } from '../../../../logger'; +import type { Pr } from '../../../../modules/platform'; +import { readLocalFile } from '../../../../util/fs'; +import { getBranchFiles } from '../../../../util/git'; +import { newlineRegex, regEx } from '../../../../util/regex'; export async function codeOwnersForPr(pr: Pr): Promise<string[]> { logger.debug('Searching for CODEOWNERS file'); diff --git a/lib/workers/pr/index.spec.ts b/lib/workers/repository/update/pr/index.spec.ts similarity index 98% rename from lib/workers/pr/index.spec.ts rename to lib/workers/repository/update/pr/index.spec.ts index 1f7a749b4f..3651c35155 100644 --- a/lib/workers/pr/index.spec.ts +++ b/lib/workers/repository/update/pr/index.spec.ts @@ -1,9 +1,15 @@ -import { getConfig, git, mocked, partial, platform } from '../../../test/util'; -import { PlatformId } from '../../constants'; -import type { Pr } from '../../modules/platform/types'; -import { BranchStatus } from '../../types'; -import * as _limits from '../global/limits'; -import type { BranchConfig } from '../types'; +import { + getConfig, + git, + mocked, + partial, + platform, +} from '../../../../../test/util'; +import { PlatformId } from '../../../../constants'; +import type { Pr } from '../../../../modules/platform/types'; +import { BranchStatus } from '../../../../types'; +import * as _limits from '../../../global/limits'; +import type { BranchConfig } from '../../../types'; import * as prAutomerge from './automerge'; import * as _changelogHelper from './changelog'; import type { ChangeLogResult } from './changelog'; @@ -16,10 +22,10 @@ const changelogHelper = mocked(_changelogHelper); const gitlabChangelogHelper = mocked(_changelogHelper); const limits = mocked(_limits); -jest.mock('../../util/git'); +jest.mock('../../../../util/git'); jest.mock('./changelog'); jest.mock('./code-owners'); -jest.mock('../global/limits'); +jest.mock('../../../global/limits'); function setupChangelogMock() { const resultValue = { @@ -109,7 +115,7 @@ function isResultWithoutPr( } } -describe('workers/pr/index', () => { +describe('workers/repository/update/pr/index', () => { describe('checkAutoMerge(pr, config)', () => { let config: BranchConfig; let pr: Pr; diff --git a/lib/workers/pr/index.ts b/lib/workers/repository/update/pr/index.ts similarity index 94% rename from lib/workers/pr/index.ts rename to lib/workers/repository/update/pr/index.ts index 98c5db4d94..58f2029366 100644 --- a/lib/workers/pr/index.ts +++ b/lib/workers/repository/update/pr/index.ts @@ -1,24 +1,28 @@ -import { GlobalConfig } from '../../config/global'; -import type { RenovateConfig } from '../../config/types'; +import { GlobalConfig } from '../../../../config/global'; +import type { RenovateConfig } from '../../../../config/types'; import { PLATFORM_INTEGRATION_UNAUTHORIZED, PLATFORM_RATE_LIMIT_EXCEEDED, REPOSITORY_CHANGED, -} from '../../constants/error-messages'; -import { logger } from '../../logger'; -import { PlatformPrOptions, Pr, platform } from '../../modules/platform'; -import { ensureComment } from '../../modules/platform/comment'; -import { BranchStatus } from '../../types'; -import { ExternalHostError } from '../../types/errors/external-host-error'; -import { sampleSize } from '../../util'; -import { stripEmojis } from '../../util/emoji'; -import { deleteBranch, getBranchLastCommitTime } from '../../util/git'; -import { regEx } from '../../util/regex'; -import { nonEmptyStringAndNotWhitespace } from '../../util/string'; -import * as template from '../../util/template'; +} from '../../../../constants/error-messages'; +import { logger } from '../../../../logger'; +import { PlatformPrOptions, Pr, platform } from '../../../../modules/platform'; +import { ensureComment } from '../../../../modules/platform/comment'; +import { BranchStatus } from '../../../../types'; +import { ExternalHostError } from '../../../../types/errors/external-host-error'; +import { sampleSize } from '../../../../util'; +import { stripEmojis } from '../../../../util/emoji'; +import { deleteBranch, getBranchLastCommitTime } from '../../../../util/git'; +import { regEx } from '../../../../util/regex'; +import { nonEmptyStringAndNotWhitespace } from '../../../../util/string'; +import * as template from '../../../../util/template'; +import { Limit, incLimitedValue, isLimitReached } from '../../../global/limits'; +import type { + BranchConfig, + BranchUpgradeConfig, + PrBlockedBy, +} from '../../../types'; import { resolveBranchStatus } from '../branch/status-checks'; -import { Limit, incLimitedValue, isLimitReached } from '../global/limits'; -import type { BranchConfig, BranchUpgradeConfig, PrBlockedBy } from '../types'; import { getPrBody } from './body'; import { ChangeLogError } from './changelog/types'; import { codeOwnersForPr } from './code-owners'; diff --git a/lib/workers/types.ts b/lib/workers/types.ts index baf1c9bf0d..787c1b6222 100644 --- a/lib/workers/types.ts +++ b/lib/workers/types.ts @@ -16,7 +16,10 @@ import type { import type { PlatformPrOptions } from '../modules/platform/types'; import type { FileChange } from '../util/git/types'; import type { MergeConfidence } from '../util/merge-confidence'; -import type { ChangeLogRelease, ChangeLogResult } from './pr/changelog/types'; +import type { + ChangeLogRelease, + ChangeLogResult, +} from './repository/update/pr/changelog/types'; export type ReleaseWithNotes = Release & Partial<ChangeLogRelease>; diff --git a/tsconfig.strict.json b/tsconfig.strict.json index 22ce050079..c1bb4fa102 100644 --- a/tsconfig.strict.json +++ b/tsconfig.strict.json @@ -323,18 +323,18 @@ "lib/util/git/private-key.ts", "lib/util/git/url.ts", "lib/util/package-rules.ts", - "lib/workers/branch/artifacts.ts", - "lib/workers/branch/auto-replace.ts", - "lib/workers/branch/automerge.ts", - "lib/workers/branch/check-existing.ts", - "lib/workers/branch/commit.ts", - "lib/workers/branch/execute-post-upgrade-commands.ts", - "lib/workers/branch/get-updated.ts", - "lib/workers/branch/handle-existing.ts", - "lib/workers/branch/index.ts", - "lib/workers/branch/reuse.ts", - "lib/workers/branch/schedule.ts", - "lib/workers/branch/status-checks.ts", + "lib/workers/repository/update/branch/artifacts.ts", + "lib/workers/repository/update/branch/auto-replace.ts", + "lib/workers/repository/update/branch/automerge.ts", + "lib/workers/repository/update/branch/check-existing.ts", + "lib/workers/repository/update/branch/commit.ts", + "lib/workers/repository/update/branch/execute-post-upgrade-commands.ts", + "lib/workers/repository/update/branch/get-updated.ts", + "lib/workers/repository/update/branch/handle-existing.ts", + "lib/workers/repository/update/branch/index.ts", + "lib/workers/repository/update/branch/reuse.ts", + "lib/workers/repository/update/branch/schedule.ts", + "lib/workers/repository/update/branch/status-checks.ts", "lib/workers/global/autodiscover.ts", "lib/workers/global/config/parse/cli.ts", "lib/workers/global/config/parse/env.ts", @@ -343,20 +343,20 @@ "lib/workers/global/config/parse/index.ts", "lib/workers/global/index.ts", "lib/workers/global/initialize.ts", - "lib/workers/pr/automerge.ts", - "lib/workers/pr/body/changelogs.ts", - "lib/workers/pr/body/config-description.ts", - "lib/workers/pr/body/controls.ts", - "lib/workers/pr/body/index.ts", - "lib/workers/pr/changelog/github/index.ts", - "lib/workers/pr/changelog/gitlab/index.ts", - "lib/workers/pr/changelog/index.ts", - "lib/workers/pr/changelog/release-notes.ts", - "lib/workers/pr/changelog/releases.ts", - "lib/workers/pr/changelog/source-github.ts", - "lib/workers/pr/changelog/source-gitlab.ts", - "lib/workers/pr/code-owners.ts", - "lib/workers/pr/index.ts", + "lib/workers/repository/update/pr/automerge.ts", + "lib/workers/repository/update/pr/body/changelogs.ts", + "lib/workers/repository/update/pr/body/config-description.ts", + "lib/workers/repository/update/pr/body/controls.ts", + "lib/workers/repository/update/pr/body/index.ts", + "lib/workers/repository/update/pr/changelog/github/index.ts", + "lib/workers/repository/update/pr/changelog/gitlab/index.ts", + "lib/workers/repository/update/pr/changelog/index.ts", + "lib/workers/repository/update/pr/changelog/release-notes.ts", + "lib/workers/repository/update/pr/changelog/releases.ts", + "lib/workers/repository/update/pr/changelog/source-github.ts", + "lib/workers/repository/update/pr/changelog/source-gitlab.ts", + "lib/workers/repository/update/pr/code-owners.ts", + "lib/workers/repository/update/pr/index.ts", "lib/workers/repository/cache.ts", "lib/workers/repository/changelog/index.ts", "lib/workers/repository/dependency-dashboard.ts", -- GitLab