diff --git a/docs/development/local-development.md b/docs/development/local-development.md index 4585d3b6624fc779dd008304fa5ce9f77922e5b4..1e303df725292ea1e946ff58bbe117f8b988dfa1 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 71b88cd8050577105f75c1273420d90d182341ee..c2089a82e4ba03ae336baaad9884af7db25d8904 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 acd29633ce326955a483f7376ed3c4335b724228..7418787962f4b6a9379814491642e8ec53a6789b 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 8553abb9029207a8a83e8796435b1256892614c3..0000000000000000000000000000000000000000 --- 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 feff7e56e5d9b8fee3de80c07d0cb76e33865716..43fd3a90e59ab05fc76d5c88def23bb6c7d84fac 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 de3e6c294c2bb6b7769daaee003d53ce848fe6dc..8efa0695c2e871f623d73899cc126151283f7b82 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 067e1fe952179c9fe3a23f86aa202792662c577a..dbf1a90e9bd0ad6da8b439247aa90c96aa043632 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 2dfac7b13eea064110061426b8de7f05caad8569..4f56afd0b8052cccf2db1924eb314978b1fb8d71 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 8925d1a4fa687a2fc42b68932215d984b1da9503..ab51121c96ff43c69c3e554275d8c574cc80fc31 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 da1db7c719cc5fe35283181d70a8ee5d50d65049..546b9ac2f73188c1affee00a39697e673bd48ff5 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 86a9ff97aba38883f361af431113aa05f426613f..d46e36a34e195563154e137df1ef3d4ab1319cf5 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 d1a1f6aff4d54b3e43f541e35a127d49d10845e9..6a4ec5d1d877698837a9dac3c02ecc9dcf8bbf79 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 d63d1f7087ead9f2aad135a5d50c3c4c0f6ce2bc..92ac413fb48818177d0c58a03b7e31b9f52c4b69 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 932d2a79082dc42dd7d8175a52cf1f3150c46543..230c10cc48c6bb9168b6bc193b91e92e5345b083 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 65de824a3ee5e427cce4ea53c0122cb097258655..e2c14094ed541e4d16467f13b7b3150af4177cc1 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 f9da16c5c735f864576300d8aecc32b13f75c38a..9ed8bcfc55269c02046a6d51b69d03f4fbf0cb5a 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 8149ac4f40a1bbb31834e631a8bc056deb5eb98b..1ca936d57361ab8bce98e7f65004bc72e4ad6f8c 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 cf7f5bb812ff872f9954d3933093ab3040c27dba..81fb78b90472bd527ed9e5140cf17ebae7747c2c 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 346a883043594d9bc28bd057c9205fa2d4cf2793..581bcef5531bb2b7334cfc127dc0dc1fd996372a 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 c9d67d3a6ca0aa5493791a2fa45f2db944971a18..28f4347e8a69574bd65f4fd38ca8af9b05e3f5bf 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 de9837e996e86f50e5746c00de232a68e3069f25..1ff65b234d126bd361501a10128857e656a87160 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 1dfad6b7118edc8c983aa7df2e1fe8b98fa76134..194c16a34e56119c05e4ef7303f930bd7ce73e70 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 8785464df3b90dbbb18619ff07bc7d58d705a8eb..a53ec4ac7056b6d095baaa52f28fd2a17dbfe7ab 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 375b61fb1572a438286954af5d110188a1bca5c3..7377193996284565c11ebca32e4ade4d037c333e 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 4ec99dcb500b64d3e8398a8c0b7284f585a7b1ad..5f93efef05c0bae4ff1044403c98269ec5be26a9 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 c5b64bb992e6169ce2e92d88bac4483568c8ea2f..67cd04883cd9cb6ae6ea99100d5362d26e5cbf4f 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 d19231d1e720b9bdc9c48a9ac92f8bd7d52b8d6f..cedd9bb615976f01350462de9ce7381d4d296ccb 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 0000000000000000000000000000000000000000..c2b90d226d5948d6b054eb262ae42fabf1f6fd78 --- /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 1d32728ff61203979cb5ae1289a7a787d878dc88..ab5239748629534575610618758429104f5a8b4a 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 2aaf1918f41f7990de04efa74760a4186d2246fe..1cf45f73c756503d796afe55a1385b9f79aca6fb 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 c63fa6caf29abda641cb0c562b1084432e5745e9..32ab7abc6cf65d13d1bab5fd4626d8b412e11698 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 605a1ccf6b4b6eb291672ea45b6bb3142f11118c..f34ec39da65ed6cc9aa1280c3f73bf2078f730be 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 1984e57225176d9c09a4faab1c09d09fe6090dcc..3cf58a6ff85416510dc70aba86740823ac47aed7 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 ad4d1c262702f699f057224872de69b2132a635d..275215065ff79083c813c3fd6a413f5ffeb15213 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 5adfff24401ed776c85d966cadce9185d2873661..33d7dd3090c3bbb1468b7634e9011dea778eb63a 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 0ec31d4e69d4ebb449e66a0493907d512acfa3cb..38e323cae1284b9d33909bb87dfd570cac8e97a7 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 e10e2b410ca2ac2eb19840980298174be6af9e20..7eda18fbc7d1066826292cb167e5a0370eefcfd9 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 2b19fd1793235eadb644363aa3b816b9461f03dc..001a433c093ab6d59e58c7cc607fded740c0b023 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 ad7b3660e5ebe865ad82a1c1d74b6ca1b16e57ef..ceb2e079e91c200477968871263c1c34eac0cd2e 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 ca4d474ca18e1e96dbf852844ce2ca976a96a80a..0b3d393e844b5fd34245435d44df181b2bfdd7d0 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 3dc80349749af9dcc573782280f1fba17e49955e..3a2e8bb096a12351b471ea9ee28a15849d8e287d 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 02723545007c5e26558a1c24014da0e53fe911b8..5d3a86e072ca8a641209b3a40f6be7b007e2a2b9 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 d3eb1d8dfc40da758b9526625510d73d9e3a973f..037c672c043632e05b91a3b03aadb1bc3728db1e 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 77fadc40c1ffd0316955743788f003b413228ca2..d2d250b0f161b6a4c9e9c31b63fb987034449896 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 7ae2564079e6fdcac32d87cd1375c87171115b19..9afc5b55c957ff1925e4cd2bcf4378c95c4d3dcc 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 fdc99b984ab3c39df2bcb501eb3d1f3b25f11f4e..1b3de2321f632d4a6875deffce1313180a33f7f1 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 7040be58372f5c50d832f370de2f42f8e739c4a7..c6ea1da919cd6f0470cc4ec057775ae8ac1f08ec 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 5f25204bdd9ddbdf2671b6a444ec72a613daa2bf..9e33bab6335da7f9ef6a687929f15293bc08f6b0 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 ea41b9ee67f09a251ffbfac50b68f856b585e3d8..f6718c3099f30959566e4830cce186f9b9862ec2 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 dfc462b844d4821139f326d3781f5b1ccdc5d2bf..57f6a7c9133b97df3c1bd188fd6753111509cdd9 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 945b58d597c4a7924ae16b80fb4c1410be7a7518..0423cacd0a7dcc015dda63be8dee54f5ba37d22b 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 7cd8ed8fb3fb9bd5ae2de7098f0a293f925f1f29..1e5faba943b861c9c5fefbc902d74af5e191a16f 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 82d38f9806c5b021a4414e81acc548a404c24a58..3fe66bd32dc8a34343f55bce73ef5afde65d6b88 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 17f7b18e5fdeed561649af8ef3842e5009cbf228..05d4e729e2fb31a20599d3e579b666932caf3b16 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 4c39eac9c79e043aff2450c2ee1fd0ff265d9577..577ca9f31975f2e8a683e4390f277b2f707275e9 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 c586f07ccdaca539d834271e322745e8c5da477a..9d6675ca414ea42bfb5bbd07dd3c60dd6ca6a00d 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 6093b4b95ca9328f3f530ffc0caf3305288455b0..e9c23ab7ae349af1f7d06f45eadd381bdc72daf8 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 beee4e7ac28696fa4ae365370dcc3a3ef2006275..34cc7e1126a54efb81b1c243d7c89df4b51cceb6 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 3c2cbca8627a8327acb082b296d8f2e244a7df66..4a4d51ae9f15a921d0f13da09111ef2e53d45096 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 56360da1c7c18a538c941e324e46116503d05d6b..43e56c478ecd9748dd9780a9c771164e956658ee 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 a7c7319937cea88693ec91072dec3f1cc5e2b6fe..6b2879bc14300fdcde154c43dfc28d24a676b048 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 aa5591149d612a76339e2d04def70423bac367dc..1cfd3c3253dd2c4b3c681be2600f5dc31e93786c 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 4da586627a491bb0016a3f0ffbb4699c9fd20594..a255cf0034159a931d6f5f2169a9396e364c90ac 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 a45646191e3594d4e20e55e58d6440e4641e41d4..9163fd5448ebdd738d796fbfa1825a6d86ee273c 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 efacc235bb50d5809d69c407fa8b0013a288fd7f..4f5eb9307eef592a69260a7cddc01b4fe8fcd0b1 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 f247b6be16617cf0dc2360beb961eeda1b9c55c0..64c3f04edc2f3147b144577ef1302a223b6d4a90 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 84a72a40f299d2db962ac9ea4aba1127145f286c..886475d898d4a8aa5ed7f0e063bcfe4939f74f89 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 f92eed162bd037b0a134f7ea9ec9febc29a9d24d..80f3daeb2c1ad56669612dc5431ee1332baf5f75 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 1f7a749b4f97f91e9dd7001cbe5681af52c5f500..3651c3515572f6156a02b3ac0ac07f1dcd60c0c3 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 98c5db4d94f95520b77c3fdb58ecf543b408638e..58f2029366d0ed6372fc2ff0e1a4199d99bf8235 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 baf1c9bf0d25bd0ae47f1b13a02441d4610eb1ab..787c1b6222ac4703548fa0e52d2bd94193e27066 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 22ce050079bbdba26b95a0e5c1213e42eab27420..c1bb4fa102b45cf8dc7eec9863ae2cd72c7d3408 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",