backport 6.2.1 → 6.3.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -5
- package/dist/backportRun.d.ts +2 -2
- package/dist/backportRun.js +11 -7
- package/dist/entrypoint.cli.js +0 -0
- package/dist/entrypoint.module.js +1 -1
- package/dist/options/ConfigOptions.d.ts +2 -0
- package/dist/options/cliArgs.js +3 -2
- package/dist/options/config/config.d.ts +2 -0
- package/dist/options/config/config.js +2 -7
- package/dist/options/config/globalConfig.js +3 -3
- package/dist/options/config/readConfigFile.d.ts +2 -0
- package/dist/options/config/readConfigFile.js +2 -2
- package/dist/options/options.d.ts +4 -27
- package/dist/options/options.js +37 -29
- package/dist/runSequentially.d.ts +0 -1
- package/dist/runSequentially.js +0 -1
- package/dist/services/HandledError.d.ts +6 -4
- package/dist/services/HandledError.js +18 -3
- package/dist/services/child-process-promisified.d.ts +3 -1
- package/dist/services/git.d.ts +22 -9
- package/dist/services/git.js +66 -54
- package/dist/services/github/commitFormatters.d.ts +0 -1
- package/dist/services/github/commitFormatters.js +1 -8
- package/dist/services/github/v3/createPullRequest.js +8 -5
- package/dist/services/github/v3/createStatusComment.js +26 -15
- package/dist/services/github/v3/getGithubV3ErrorMessage.d.ts +2 -1
- package/dist/services/github/v4/FetchPullRequestId.d.ts +0 -7
- package/dist/services/github/v4/apiRequestV4.d.ts +21 -17
- package/dist/services/github/v4/apiRequestV4.js +38 -28
- package/dist/services/github/v4/disablePullRequestAutoMerge.d.ts +0 -7
- package/dist/services/github/v4/enablePullRequestAutoMerge.d.ts +0 -7
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +3 -3
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +2 -2
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +1 -8
- package/dist/services/github/v4/fetchExistingPullRequest.d.ts +0 -4
- package/dist/services/github/v4/fetchExistingPullRequest.js +1 -2
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.d.ts +0 -9
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +3 -1
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +38 -32
- package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +2 -1
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +29 -0
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.js +56 -0
- package/dist/services/github/v4/throwOnInvalidAccessToken.d.ts +4 -5
- package/dist/services/github/v4/throwOnInvalidAccessToken.js +10 -7
- package/dist/services/logger.d.ts +6 -3
- package/dist/services/logger.js +11 -7
- package/dist/services/prompts.js +12 -10
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +1 -1
- package/dist/services/sourceCommit/getMockSourceCommit.js +6 -6
- package/dist/services/sourceCommit/parseSourceCommit.d.ts +18 -10
- package/dist/services/sourceCommit/parseSourceCommit.js +20 -14
- package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +0 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +12 -13
- package/dist/ui/getCommits.js +8 -14
- package/dist/ui/getCommitsWithoutBackports.js +6 -6
- package/dist/ui/getTargetBranches.js +1 -1
- package/dist/ui/maybeSetupRepo.js +25 -5
- package/dist/utils/maybe.d.ts +1 -0
- package/dist/utils/maybe.js +7 -0
- package/dist/utils/packageVersion.d.ts +1 -0
- package/dist/{types/PromiseReturnType.js → utils/packageVersion.js} +2 -0
- package/package.json +22 -18
- package/yarn.lock +114 -147
- package/dist/entrypoint.api.d.ts +0 -22
- package/dist/entrypoint.api.js +0 -57
- package/dist/entrypoint.api.private.test.d.ts +0 -1
- package/dist/entrypoint.api.private.test.js +0 -37
- package/dist/entrypoint.module.private.test.d.ts +0 -1
- package/dist/entrypoint.module.private.test.js +0 -37
- package/dist/index.d.ts +0 -783
- package/dist/index.js +0 -8001
- package/dist/ink.d.ts +0 -1
- package/dist/ink.js +0 -49
- package/dist/main.d.ts +0 -14
- package/dist/main.js +0 -68
- package/dist/options/cliArgs.test.d.ts +0 -1
- package/dist/options/cliArgs.test.js +0 -152
- package/dist/options/config/config.test.d.ts +0 -1
- package/dist/options/config/config.test.js +0 -48
- package/dist/options/config/getOptionsFromGit.d.ts +0 -4
- package/dist/options/config/getOptionsFromGit.js +0 -8
- package/dist/options/config/getProjectConfig.d.ts +0 -0
- package/dist/options/config/getProjectConfig.js +0 -1
- package/dist/options/config/globalConfig.test.d.ts +0 -1
- package/dist/options/config/globalConfig.test.js +0 -80
- package/dist/options/config/projectConfig.test.d.ts +0 -1
- package/dist/options/config/projectConfig.test.js +0 -128
- package/dist/options/getValidatedOptions.d.ts +0 -49
- package/dist/options/getValidatedOptions.js +0 -45
- package/dist/options/getValidatedOptions.test.d.ts +0 -1
- package/dist/options/getValidatedOptions.test.js +0 -97
- package/dist/options/options.test.d.ts +0 -1
- package/dist/options/options.test.js +0 -338
- package/dist/options/parseRequiredOptions.d.ts +0 -71
- package/dist/options/parseRequiredOptions.js +0 -68
- package/dist/options/parseRequiredOptions.test.d.ts +0 -1
- package/dist/options/parseRequiredOptions.test.js +0 -122
- package/dist/react-components/0-loadOptions.d.ts +0 -6
- package/dist/react-components/0-loadOptions.js +0 -45
- package/dist/react-components/1-loadCommit.d.ts +0 -8
- package/dist/react-components/1-loadCommit.js +0 -88
- package/dist/react-components/1a-loadCommit.d.ts +0 -5
- package/dist/react-components/1a-loadCommit.js +0 -76
- package/dist/react-components/1b-commitChoices.d.ts +0 -5
- package/dist/react-components/1b-commitChoices.js +0 -98
- package/dist/react-components/2-commitChoices.d.ts +0 -8
- package/dist/react-components/2-commitChoices.js +0 -96
- package/dist/react-components/2-commitsPrompt.d.ts +0 -8
- package/dist/react-components/2-commitsPrompt.js +0 -96
- package/dist/react-components/2-targetBranchChoices.d.ts +0 -9
- package/dist/react-components/2-targetBranchChoices.js +0 -109
- package/dist/react-components/3-cherrypick.d.ts +0 -1
- package/dist/react-components/3-cherrypick.js +0 -2
- package/dist/react-components/App.d.ts +0 -2
- package/dist/react-components/App.js +0 -35
- package/dist/react-components/BackportStateContext.d.ts +0 -33
- package/dist/react-components/BackportStateContext.js +0 -42
- package/dist/react-components/CommitPrompt/2-commitsPrompt.d.ts +0 -8
- package/dist/react-components/CommitPrompt/2-commitsPrompt.js +0 -96
- package/dist/react-components/CommitPrompt/CommitPrompt.d.ts +0 -8
- package/dist/react-components/CommitPrompt/CommitPrompt.js +0 -96
- package/dist/react-components/CommitPrompt/getCommits.d.ts +0 -2
- package/dist/react-components/CommitPrompt/getCommits.js +0 -27
- package/dist/react-components/CommitPrompt.d.ts +0 -8
- package/dist/react-components/CommitPrompt.js +0 -96
- package/dist/react-components/CustomMultiSelect.d.ts +0 -13
- package/dist/react-components/CustomMultiSelect.js +0 -21
- package/dist/react-components/CustomMultiSelectItem.d.ts +0 -5
- package/dist/react-components/CustomMultiSelectItem.js +0 -12
- package/dist/react-components/CustomSelect.d.ts +0 -14
- package/dist/react-components/CustomSelect.js +0 -34
- package/dist/react-components/ErrorBoundary.d.ts +0 -15
- package/dist/react-components/ErrorBoundary.js +0 -53
- package/dist/react-components/MultiSelect.d.ts +0 -7
- package/dist/react-components/MultiSelect.js +0 -16
- package/dist/react-components/hooks/useAsync.d.ts +0 -12
- package/dist/react-components/hooks/useAsync.js +0 -73
- package/dist/runSequentially.test.d.ts +0 -1
- package/dist/runSequentially.test.js +0 -195
- package/dist/runWithOptions.d.ts +0 -9
- package/dist/runWithOptions.js +0 -43
- package/dist/runWithOptions.test.d.ts +0 -1
- package/dist/runWithOptions.test.js +0 -304
- package/dist/scripts/generate-gql.d.ts +0 -1
- package/dist/scripts/generate-gql.js +0 -15
- package/dist/scripts/postinstall.test.d.ts +0 -1
- package/dist/scripts/postinstall.test.js +0 -53
- package/dist/services/backportRun/backportRun.ci.d.ts +0 -6
- package/dist/services/backportRun/backportRun.ci.js +0 -81
- package/dist/services/backportRun/backportRun.d.ts +0 -14
- package/dist/services/backportRun/backportRun.interactive.d.ts +0 -1
- package/dist/services/backportRun/backportRun.interactive.js +0 -4
- package/dist/services/backportRun/backportRun.js +0 -14
- package/dist/services/backportRun/backportState.d.ts +0 -4
- package/dist/services/backportRun/backportState.js +0 -28
- package/dist/services/backportRun/getCommits.d.ts +0 -2
- package/dist/services/backportRun/getCommits.js +0 -20
- package/dist/services/backportRun/runSequentially.d.ts +0 -20
- package/dist/services/backportRun/runSequentially.js +0 -41
- package/dist/services/backportRun/runSequentially.test.d.ts +0 -1
- package/dist/services/backportRun/runSequentially.test.js +0 -199
- package/dist/services/cherrypickAndCreateTargetPullRequest.d.ts +0 -12
- package/dist/services/cherrypickAndCreateTargetPullRequest.js +0 -206
- package/dist/services/cherrypickAndCreateTargetPullRequest.test.d.ts +0 -1
- package/dist/services/cherrypickAndCreateTargetPullRequest.test.js +0 -403
- package/dist/services/env.test.d.ts +0 -1
- package/dist/services/env.test.js +0 -21
- package/dist/services/fs-promisified.d.ts +0 -6
- package/dist/services/fs-promisified.js +0 -12
- package/dist/services/getCommits.d.ts +0 -2
- package/dist/services/getCommits.js +0 -38
- package/dist/services/getCommitsWithoutBackports.d.ts +0 -11
- package/dist/services/getCommitsWithoutBackports.js +0 -68
- package/dist/services/getCommitsWithoutBackports.test.d.ts +0 -1
- package/dist/services/getCommitsWithoutBackports.test.js +0 -259
- package/dist/services/getExpectedTarget.d.ts +0 -9
- package/dist/services/getExpectedTarget.js +0 -77
- package/dist/services/getExpectedTargetPullRequests.d.ts +0 -9
- package/dist/services/getExpectedTargetPullRequests.js +0 -77
- package/dist/services/getTargetBranches.d.ts +0 -5
- package/dist/services/getTargetBranches.js +0 -60
- package/dist/services/getTargetBranches.test.d.ts +0 -1
- package/dist/services/getTargetBranches.test.js +0 -180
- package/dist/services/git.integration.test.d.ts +0 -1
- package/dist/services/git.integration.test.js +0 -168
- package/dist/services/git.test.d.ts +0 -1
- package/dist/services/git.test.js +0 -503
- package/dist/services/github/commitFormatters.test.d.ts +0 -1
- package/dist/services/github/commitFormatters.test.js +0 -11
- package/dist/services/github/v3/addAssigneesToPullRequest.test.d.ts +0 -1
- package/dist/services/github/v3/addAssigneesToPullRequest.test.js +0 -27
- package/dist/services/github/v3/createPullRequest.test.d.ts +0 -1
- package/dist/services/github/v3/createPullRequest.test.js +0 -160
- package/dist/services/github/v3/createStatusComment.test.d.ts +0 -1
- package/dist/services/github/v3/createStatusComment.test.js +0 -326
- package/dist/services/github/v4/apiRequestV4.test.d.ts +0 -1
- package/dist/services/github/v4/apiRequestV4.test.js +0 -82
- package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.d.ts +0 -1
- package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +0 -112
- package/dist/services/github/v4/fetchAuthorId.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchAuthorId.private.test.js +0 -28
- package/dist/services/github/v4/fetchCommitByPullNumber.d.ts +0 -5
- package/dist/services/github/v4/fetchCommitByPullNumber.js +0 -86
- package/dist/services/github/v4/fetchCommitByPullNumber.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitByPullNumber.private.test.js +0 -57
- package/dist/services/github/v4/fetchCommitBySha.d.ts +0 -5
- package/dist/services/github/v4/fetchCommitBySha.js +0 -95
- package/dist/services/github/v4/fetchCommitBySha.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitBySha.private.test.js +0 -50
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +0 -78
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +0 -134
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +0 -115
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +0 -200
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +0 -131
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.d.ts +0 -28
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.js +0 -52
- package/dist/services/github/v4/fetchCommits/fetchProjectConfig.d.ts +0 -3
- package/dist/services/github/v4/fetchCommits/fetchProjectConfig.js +0 -55
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +0 -85
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.js +0 -252
- package/dist/services/github/v4/fetchCommitsByAuthor.d.ts +0 -28
- package/dist/services/github/v4/fetchCommitsByAuthor.js +0 -161
- package/dist/services/github/v4/fetchCommitsByAuthor.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitsByAuthor.private.test.js +0 -115
- package/dist/services/github/v4/fetchCommitsByAuthor.test.d.ts +0 -1
- package/dist/services/github/v4/fetchCommitsByAuthor.test.js +0 -272
- package/dist/services/github/v4/fetchDefaultBranch.d.ts +0 -9
- package/dist/services/github/v4/fetchDefaultBranch.js +0 -24
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +0 -4
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.js +0 -52
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +0 -32
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.d.ts +0 -4
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.js +0 -72
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.js +0 -34
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.d.ts +0 -40
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.js +0 -72
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +0 -17
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.js +0 -69
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +0 -32
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +0 -47
- package/dist/services/github/v4/fetchMergedPullRequests.d.ts +0 -37
- package/dist/services/github/v4/fetchMergedPullRequests.js +0 -37
- package/dist/services/github/v4/fetchMergedPullRequests.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchMergedPullRequests.private.test.js +0 -59
- package/dist/services/github/v4/fetchMergedPullRequests.test.d.ts +0 -1
- package/dist/services/github/v4/fetchMergedPullRequests.test.js +0 -22
- package/dist/services/github/v4/fetchProjectConfig.d.ts +0 -8
- package/dist/services/github/v4/fetchProjectConfig.js +0 -56
- package/dist/services/github/v4/fetchProjectConfig.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchProjectConfig.private.test.js +0 -52
- package/dist/services/github/v4/fetchProjectConfig.test.d.ts +0 -1
- package/dist/services/github/v4/fetchProjectConfig.test.js +0 -37
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.d.ts +0 -9
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.js +0 -92
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.js +0 -66
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.d.ts +0 -1
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.js +0 -242
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.d.ts +0 -1
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +0 -52
- package/dist/services/github/v4/getExistingTargetPullRequests.d.ts +0 -7
- package/dist/services/github/v4/getExistingTargetPullRequests.js +0 -45
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +0 -1
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +0 -130
- package/dist/services/github/v4/getOptionsFromGithub/index.d.ts +0 -63
- package/dist/services/github/v4/getOptionsFromGithub/index.js +0 -139
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.d.ts +0 -1
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.js +0 -147
- package/dist/services/github/v4/getTargetBranchesFromLabels.d.ts +0 -5
- package/dist/services/github/v4/getTargetBranchesFromLabels.js +0 -20
- package/dist/services/github/v4/getTargetBranchesFromLabels.test.d.ts +0 -1
- package/dist/services/github/v4/getTargetBranchesFromLabels.test.js +0 -201
- package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +0 -2
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +0 -154
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.d.ts +0 -2
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.js +0 -843
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.d.ts +0 -2
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.js +0 -73
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.d.ts +0 -12
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.js +0 -44
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.d.ts +0 -1
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +0 -87
- package/dist/services/maybeSetupRepo.d.ts +0 -2
- package/dist/services/maybeSetupRepo.js +0 -33
- package/dist/services/maybeSetupRepo.test.d.ts +0 -1
- package/dist/services/maybeSetupRepo.test.js +0 -78
- package/dist/services/prompt.test.d.ts +0 -1
- package/dist/services/prompt.test.js +0 -87
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +0 -1
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +0 -433
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.d.ts +0 -5
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.js +0 -20
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.d.ts +0 -1
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.js +0 -201
- package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +0 -1
- package/dist/services/sourceCommit/parseSourceCommit.test.js +0 -237
- package/dist/services/sourceCommit/sourceCommit.d.ts +0 -78
- package/dist/services/sourceCommit/sourceCommit.js +0 -86
- package/dist/services/sourceCommit/sourceCommit.test.d.ts +0 -1
- package/dist/services/sourceCommit/sourceCommit.test.js +0 -287
- package/dist/services/sourceCommit.d.ts +0 -78
- package/dist/services/sourceCommit.js +0 -86
- package/dist/services/sourceCommit.test.d.ts +0 -1
- package/dist/services/sourceCommit.test.js +0 -280
- package/dist/test/ExecError.d.ts +0 -16
- package/dist/test/ExecError.js +0 -15
- package/dist/test/backport-e2e.private.test.d.ts +0 -1
- package/dist/test/backport-e2e.private.test.js +0 -325
- package/dist/test/handleUnbackportedPullRequests.private.test.d.ts +0 -1
- package/dist/test/handleUnbackportedPullRequests.private.test.js +0 -43
- package/dist/test/inquirer.private.test.d.ts +0 -1
- package/dist/test/inquirer.private.test.js +0 -170
- package/dist/test/integration/createSpies.d.ts +0 -17
- package/dist/test/integration/createSpies.js +0 -85
- package/dist/test/integration/envConstants.d.ts +0 -5
- package/dist/test/integration/envConstants.js +0 -9
- package/dist/test/integration/helpers.d.ts +0 -7
- package/dist/test/integration/helpers.js +0 -31
- package/dist/test/integration/integration.private.test.d.ts +0 -1
- package/dist/test/integration/integration.private.test.js +0 -327
- package/dist/test/integration/integration.test.d.ts +0 -1
- package/dist/test/integration/integration.test.js +0 -214
- package/dist/test/mockConfigFiles.d.ts +0 -5
- package/dist/test/mockConfigFiles.js +0 -37
- package/dist/test/nockHelpers.d.ts +0 -16
- package/dist/test/nockHelpers.js +0 -32
- package/dist/test/private/getDevAccessToken.d.ts +0 -1
- package/dist/test/private/getDevAccessToken.js +0 -24
- package/dist/test/setupFiles/automatic-mocks.d.ts +0 -0
- package/dist/test/setupFiles/automatic-mocks.js +0 -43
- package/dist/todo-delete.d.ts +0 -1
- package/dist/todo-delete.js +0 -17
- package/dist/types/Commit.d.ts +0 -85
- package/dist/types/Commit.js +0 -139
- package/dist/types/PromiseReturnType.d.ts +0 -1
- package/dist/types/commitNode.d.ts +0 -89
- package/dist/types/commitNode.js +0 -139
- package/dist/types/commitNode.test.d.ts +0 -1
- package/dist/types/commitNode.test.js +0 -255
- package/dist/types/commitWithAssociatedPullRequests.d.ts +0 -86
- package/dist/types/commitWithAssociatedPullRequests.js +0 -145
- package/dist/ui/cherrypickAndCreatePullRequest.test.d.ts +0 -1
- package/dist/ui/cherrypickAndCreatePullRequest.test.js +0 -617
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +0 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +0 -427
- package/dist/ui/getCommitsWithoutBackports.test.d.ts +0 -1
- package/dist/ui/getCommitsWithoutBackports.test.js +0 -259
- package/dist/ui/getTargetBranches.test.d.ts +0 -1
- package/dist/ui/getTargetBranches.test.js +0 -180
- package/dist/ui/getTargetBranchesFromLabels.d.ts +0 -6
- package/dist/ui/getTargetBranchesFromLabels.js +0 -40
- package/dist/ui/getTargetBranchesFromLabels.test.d.ts +0 -1
- package/dist/ui/getTargetBranchesFromLabels.test.js +0 -288
- package/dist/ui/maybeSetupRepo.test.d.ts +0 -1
- package/dist/ui/maybeSetupRepo.test.js +0 -78
- package/dist/utils/excludeUndefined.test.d.ts +0 -1
- package/dist/utils/excludeUndefined.test.js +0 -24
- package/dist/utils/sequentially.d.ts +0 -1
- package/dist/utils/sequentially.js +0 -10
package/dist/ink.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function renderInk(): void;
|
package/dist/ink.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.renderInk = void 0;
|
|
26
|
-
const ink_1 = require("ink");
|
|
27
|
-
const ink_spinner_1 = __importDefault(require("ink-spinner"));
|
|
28
|
-
const react_1 = __importStar(require("react"));
|
|
29
|
-
const Example = () => {
|
|
30
|
-
const [message, setMessage] = (0, react_1.useState)();
|
|
31
|
-
(0, react_1.useEffect)(() => {
|
|
32
|
-
setTimeout(() => {
|
|
33
|
-
setMessage('Received message');
|
|
34
|
-
}, 5000);
|
|
35
|
-
});
|
|
36
|
-
if (!message) {
|
|
37
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
38
|
-
react_1.default.createElement(ink_1.Box, null,
|
|
39
|
-
react_1.default.createElement(ink_1.Box, { marginRight: 1 },
|
|
40
|
-
react_1.default.createElement(ink_1.Text, { color: 'cyan' },
|
|
41
|
-
react_1.default.createElement(ink_spinner_1.default, { type: "dots" }))),
|
|
42
|
-
react_1.default.createElement(ink_1.Text, null, "Loading via ink!!"))));
|
|
43
|
-
}
|
|
44
|
-
return react_1.default.createElement(ink_1.Text, null, message);
|
|
45
|
-
};
|
|
46
|
-
function renderInk() {
|
|
47
|
-
(0, ink_1.render)(react_1.default.createElement(Example, null));
|
|
48
|
-
}
|
|
49
|
-
exports.renderInk = renderInk;
|
package/dist/main.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ConfigFileOptions } from './options/ConfigOptions';
|
|
2
|
-
import { Result } from './runSequentially';
|
|
3
|
-
import { Commit } from './services/sourceCommit/parseSourceCommit';
|
|
4
|
-
export declare type BackportResponse = {
|
|
5
|
-
status: 'success';
|
|
6
|
-
commits: Commit[];
|
|
7
|
-
results: Result[];
|
|
8
|
-
} | {
|
|
9
|
-
status: 'failure';
|
|
10
|
-
commits: Commit[];
|
|
11
|
-
errorMessage: string;
|
|
12
|
-
error: Error;
|
|
13
|
-
};
|
|
14
|
-
export declare function main(argv: string[], optionsFromModule?: ConfigFileOptions): Promise<BackportResponse>;
|
package/dist/main.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.main = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const ora_1 = __importDefault(require("ora"));
|
|
9
|
-
const options_1 = require("./options/options");
|
|
10
|
-
const runSequentially_1 = require("./runSequentially");
|
|
11
|
-
const HandledError_1 = require("./services/HandledError");
|
|
12
|
-
const env_1 = require("./services/env");
|
|
13
|
-
const createStatusComment_1 = require("./services/github/v3/createStatusComment");
|
|
14
|
-
const logger_1 = require("./services/logger");
|
|
15
|
-
const getCommits_1 = require("./ui/getCommits");
|
|
16
|
-
const getTargetBranches_1 = require("./ui/getTargetBranches");
|
|
17
|
-
async function main(argv, optionsFromModule) {
|
|
18
|
-
const spinner = (0, ora_1.default)().start('Initializing...');
|
|
19
|
-
let options = null;
|
|
20
|
-
let commits = [];
|
|
21
|
-
try {
|
|
22
|
-
options = await (0, options_1.getOptions)(argv, optionsFromModule);
|
|
23
|
-
spinner.stop();
|
|
24
|
-
commits = await (0, getCommits_1.getCommits)(options);
|
|
25
|
-
const targetBranches = await (0, getTargetBranches_1.getTargetBranches)(options, commits);
|
|
26
|
-
const results = await (0, runSequentially_1.runSequentially)({ options, commits, targetBranches });
|
|
27
|
-
const backportResponse = {
|
|
28
|
-
status: 'success',
|
|
29
|
-
commits,
|
|
30
|
-
results,
|
|
31
|
-
};
|
|
32
|
-
await (0, createStatusComment_1.createStatusComment)({
|
|
33
|
-
options,
|
|
34
|
-
backportResponse,
|
|
35
|
-
});
|
|
36
|
-
return backportResponse;
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
spinner.stop();
|
|
40
|
-
const backportResponse = {
|
|
41
|
-
status: 'failure',
|
|
42
|
-
commits,
|
|
43
|
-
errorMessage: e.message,
|
|
44
|
-
error: e,
|
|
45
|
-
};
|
|
46
|
-
if (options) {
|
|
47
|
-
await (0, createStatusComment_1.createStatusComment)({
|
|
48
|
-
options,
|
|
49
|
-
backportResponse,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
if (e instanceof HandledError_1.HandledError) {
|
|
53
|
-
(0, logger_1.consoleLog)(e.message);
|
|
54
|
-
}
|
|
55
|
-
else if (e instanceof Error) {
|
|
56
|
-
// output
|
|
57
|
-
(0, logger_1.consoleLog)('\n');
|
|
58
|
-
(0, logger_1.consoleLog)(chalk_1.default.bold('⚠️ Ouch! An unhandled error occured 😿'));
|
|
59
|
-
(0, logger_1.consoleLog)(`Error message: ${e.message}`);
|
|
60
|
-
(0, logger_1.consoleLog)('Please open an issue in https://github.com/sqren/backport/issues or contact me directly on https://twitter.com/sorenlouv');
|
|
61
|
-
(0, logger_1.consoleLog)(chalk_1.default.italic(`For additional details see the logs: ${(0, env_1.getLogfilePath)()}`));
|
|
62
|
-
// log file
|
|
63
|
-
logger_1.logger.info('Unknown error:', e);
|
|
64
|
-
}
|
|
65
|
-
return backportResponse;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.main = main;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const cliArgs_1 = require("./cliArgs");
|
|
4
|
-
describe('getOptionsFromCliArgs', () => {
|
|
5
|
-
describe('yargs settings', () => {
|
|
6
|
-
it('should accept both camel-case and dashed-case and convert them to camel cased', () => {
|
|
7
|
-
const argv = [
|
|
8
|
-
'--access-token',
|
|
9
|
-
'my access token',
|
|
10
|
-
'--githubApiBaseUrlV3',
|
|
11
|
-
'my api hostname',
|
|
12
|
-
];
|
|
13
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
14
|
-
expect(res.accessToken).toEqual('my access token');
|
|
15
|
-
expect('access-token' in res).toEqual(false);
|
|
16
|
-
expect(res.githubApiBaseUrlV3).toEqual('my api hostname');
|
|
17
|
-
expect('api-hostname' in res).toEqual(false);
|
|
18
|
-
});
|
|
19
|
-
it('strips undefined values from the object', () => {
|
|
20
|
-
const argv = [
|
|
21
|
-
'--access-token',
|
|
22
|
-
'my access token',
|
|
23
|
-
'--repo-owner',
|
|
24
|
-
'elastic',
|
|
25
|
-
'--repo-name',
|
|
26
|
-
'kibana',
|
|
27
|
-
];
|
|
28
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
29
|
-
expect(res).toEqual({
|
|
30
|
-
accessToken: 'my access token',
|
|
31
|
-
repoOwner: 'elastic',
|
|
32
|
-
repoName: 'kibana',
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
// blocked by: https://github.com/yargs/yargs/issues/1853
|
|
37
|
-
describe('help', () => {
|
|
38
|
-
// eslint-disable-next-line jest/no-commented-out-tests
|
|
39
|
-
// it('should output help', () => {
|
|
40
|
-
// const argv = ['--help'];
|
|
41
|
-
// expect(() =>
|
|
42
|
-
// getOptionsFromCliArgs(argv, { exitOnError: false, returnHelp: true })
|
|
43
|
-
// ).toThrow('asa');
|
|
44
|
-
// });
|
|
45
|
-
});
|
|
46
|
-
describe('sourcePRLabels', () => {
|
|
47
|
-
it('should handle all variations', () => {
|
|
48
|
-
const argv = [
|
|
49
|
-
'--sourcePRLabel',
|
|
50
|
-
'label a',
|
|
51
|
-
'--sourcePrLabel',
|
|
52
|
-
'label b',
|
|
53
|
-
'--source-pr-label',
|
|
54
|
-
'label c',
|
|
55
|
-
];
|
|
56
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
57
|
-
expect(res.sourcePRLabels).toEqual(['label a', 'label b', 'label c']);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
describe('pullNumber', () => {
|
|
61
|
-
it('should accept `--pr` alias but only return the full representation (`pullNumber`)', () => {
|
|
62
|
-
const argv = ['--pr', '1337'];
|
|
63
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
64
|
-
expect(res.pullNumber).toEqual(1337);
|
|
65
|
-
//@ts-expect-error
|
|
66
|
-
expect(res.pr).toBe(undefined);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
describe('assignees', () => {
|
|
70
|
-
it('--assignee', () => {
|
|
71
|
-
const argv = ['--assignee', 'john'];
|
|
72
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
73
|
-
expect(res.assignees).toEqual(['john']);
|
|
74
|
-
});
|
|
75
|
-
it('--assign', () => {
|
|
76
|
-
const argv = ['--assign', 'john'];
|
|
77
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
78
|
-
expect(res.assignees).toEqual(['john']);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
describe('multipleBranches', () => {
|
|
82
|
-
it('should be undefined by default', () => {
|
|
83
|
-
const argv = [];
|
|
84
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
85
|
-
expect(res.multipleBranches).toBe(undefined);
|
|
86
|
-
});
|
|
87
|
-
it('should set to true', () => {
|
|
88
|
-
const argv = ['--multiple-branches', 'true'];
|
|
89
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
90
|
-
expect(res.multipleBranches).toBe(true);
|
|
91
|
-
});
|
|
92
|
-
it('should set to false', () => {
|
|
93
|
-
const argv = ['--multiple-branches', 'false'];
|
|
94
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
95
|
-
expect(res.multipleBranches).toBe(false);
|
|
96
|
-
});
|
|
97
|
-
it('should respect `multiple` option', () => {
|
|
98
|
-
const argv = ['--multiple'];
|
|
99
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
100
|
-
expect(res.multipleBranches).toBe(true);
|
|
101
|
-
});
|
|
102
|
-
it('should conflict when using both', () => {
|
|
103
|
-
const argv = ['--multiple', '--multiple-branches', 'false'];
|
|
104
|
-
expect(() => (0, cliArgs_1.getOptionsFromCliArgs)(argv, { exitOnError: false })).toThrow('Arguments multiple and multipleBranches are mutually exclusive');
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
describe('noVerify', () => {
|
|
108
|
-
it('should be undefined by default', () => {
|
|
109
|
-
const argv = [];
|
|
110
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
111
|
-
expect(res.noVerify).toBe(undefined);
|
|
112
|
-
});
|
|
113
|
-
it('should set to false', () => {
|
|
114
|
-
const argv = ['--no-verify', 'false'];
|
|
115
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
116
|
-
expect(res.noVerify).toBe(false);
|
|
117
|
-
});
|
|
118
|
-
it('should set to true', () => {
|
|
119
|
-
const argv = ['--no-verify', 'true'];
|
|
120
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
121
|
-
expect(res.noVerify).toBe(true);
|
|
122
|
-
});
|
|
123
|
-
it('should be enabled by `verify`', () => {
|
|
124
|
-
const argv = ['--verify'];
|
|
125
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
126
|
-
expect(res.noVerify).toBe(true);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
describe('mainline', () => {
|
|
130
|
-
it('should default to 1', () => {
|
|
131
|
-
const argv = ['--mainline'];
|
|
132
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
133
|
-
expect(res.mainline).toEqual(1);
|
|
134
|
-
});
|
|
135
|
-
it('should accept numbers', () => {
|
|
136
|
-
const argv = ['--mainline', '2'];
|
|
137
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
138
|
-
expect(res.mainline).toEqual(2);
|
|
139
|
-
});
|
|
140
|
-
it('should throw on invalid values', () => {
|
|
141
|
-
const argv = ['--mainline', 'foo'];
|
|
142
|
-
expect(() => (0, cliArgs_1.getOptionsFromCliArgs)(argv, { exitOnError: false })).toThrowError('--mainline must be an integer. Received: NaN');
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
describe('targetBranches', () => {
|
|
146
|
-
it('should not coerce 6.0 to 6', () => {
|
|
147
|
-
const argv = ['-b', '6.0'];
|
|
148
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
149
|
-
expect(res.targetBranches).toEqual(['6.0']);
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
const fs = __importStar(require("../../services/fs-promisified"));
|
|
23
|
-
const mockConfigFiles_1 = require("../../test/mockConfigFiles");
|
|
24
|
-
const config_1 = require("./config");
|
|
25
|
-
describe('getOptionsFromConfigFiles', () => {
|
|
26
|
-
let res;
|
|
27
|
-
beforeEach(async () => {
|
|
28
|
-
jest.spyOn(fs, 'writeFile').mockResolvedValueOnce(undefined);
|
|
29
|
-
jest.spyOn(fs, 'chmod').mockResolvedValue();
|
|
30
|
-
(0, mockConfigFiles_1.mockConfigFiles)({
|
|
31
|
-
globalConfig: { accessToken: 'abc', editor: 'vim' },
|
|
32
|
-
projectConfig: { repoName: 'kibana', repoOwner: 'elastic' },
|
|
33
|
-
});
|
|
34
|
-
res = await (0, config_1.getOptionsFromConfigFiles)({
|
|
35
|
-
optionsFromCliArgs: {},
|
|
36
|
-
optionsFromModule: {},
|
|
37
|
-
defaultConfigOptions: { ci: false },
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
it('should return values from config files', () => {
|
|
41
|
-
expect(res).toEqual({
|
|
42
|
-
accessToken: 'abc',
|
|
43
|
-
editor: 'vim',
|
|
44
|
-
repoName: 'kibana',
|
|
45
|
-
repoOwner: 'elastic',
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOptionsFromGit = void 0;
|
|
4
|
-
const git_1 = require("../../services/git");
|
|
5
|
-
async function getOptionsFromGit() {
|
|
6
|
-
return (0, git_1.getRepoOwnerAndNameFromGitRemote)();
|
|
7
|
-
}
|
|
8
|
-
exports.getOptionsFromGit = getOptionsFromGit;
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const os_1 = __importDefault(require("os"));
|
|
26
|
-
const make_dir_1 = __importDefault(require("make-dir"));
|
|
27
|
-
const fs = __importStar(require("../../services/fs-promisified"));
|
|
28
|
-
const globalConfig_1 = require("./globalConfig");
|
|
29
|
-
describe('config', () => {
|
|
30
|
-
afterEach(() => jest.clearAllMocks());
|
|
31
|
-
beforeEach(() => {
|
|
32
|
-
jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
|
|
33
|
-
});
|
|
34
|
-
describe('getGlobalConfig', () => {
|
|
35
|
-
let res;
|
|
36
|
-
beforeEach(async () => {
|
|
37
|
-
jest.spyOn(fs, 'chmod').mockResolvedValueOnce();
|
|
38
|
-
jest.spyOn(fs, 'writeFile').mockResolvedValueOnce();
|
|
39
|
-
jest.spyOn(fs, 'readFile').mockResolvedValueOnce(JSON.stringify({
|
|
40
|
-
accessToken: 'myAccessToken',
|
|
41
|
-
}));
|
|
42
|
-
res = await (0, globalConfig_1.getGlobalConfig)();
|
|
43
|
-
});
|
|
44
|
-
it("should create config if it doesn't exist", () => {
|
|
45
|
-
expect(fs.writeFile).toHaveBeenCalledWith('/myHomeDir/.backport/config.json', expect.any(String), { flag: 'wx', mode: 384 });
|
|
46
|
-
});
|
|
47
|
-
it("should create .backport folder if it doesn't exist", () => {
|
|
48
|
-
expect(make_dir_1.default).toHaveBeenCalledWith('/myHomeDir/.backport');
|
|
49
|
-
});
|
|
50
|
-
it('should load config', () => {
|
|
51
|
-
expect(fs.readFile).toHaveBeenCalledWith('/myHomeDir/.backport/config.json', 'utf8');
|
|
52
|
-
});
|
|
53
|
-
it('should return config', () => {
|
|
54
|
-
expect(res).toEqual({
|
|
55
|
-
accessToken: 'myAccessToken',
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
describe('createGlobalConfigIfNotExist', () => {
|
|
60
|
-
it("should create config if it does't exist", async () => {
|
|
61
|
-
jest.spyOn(fs, 'writeFile').mockResolvedValueOnce(undefined);
|
|
62
|
-
const didCreate = await (0, globalConfig_1.createGlobalConfigIfNotExist)('/path/to/globalConfig', 'myConfigTemplate');
|
|
63
|
-
expect(didCreate).toEqual(true);
|
|
64
|
-
expect(fs.writeFile).toHaveBeenCalledWith('/path/to/globalConfig', expect.stringContaining('myConfigTemplate'), { flag: 'wx', mode: 384 });
|
|
65
|
-
});
|
|
66
|
-
it('should not fail if config already exists', async () => {
|
|
67
|
-
const err = new Error();
|
|
68
|
-
err.code = 'EEXIST';
|
|
69
|
-
jest.spyOn(fs, 'writeFile').mockRejectedValueOnce(err);
|
|
70
|
-
const didCreate = await (0, globalConfig_1.createGlobalConfigIfNotExist)('/path/to/global/config.json', 'myConfigTemplate');
|
|
71
|
-
expect(didCreate).toEqual(false);
|
|
72
|
-
});
|
|
73
|
-
it("should fail gracefully if .backport folder doesn't exist", async () => {
|
|
74
|
-
const err = new Error();
|
|
75
|
-
err.code = 'ENOENT';
|
|
76
|
-
jest.spyOn(fs, 'writeFile').mockRejectedValueOnce(err);
|
|
77
|
-
await expect(() => (0, globalConfig_1.createGlobalConfigIfNotExist)('/path/to/global/config.json', 'myConfigTemplate')).rejects.toThrowError('The .backport folder (/path/to/global/config.json) does not exist.');
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const find_up_1 = __importDefault(require("find-up"));
|
|
26
|
-
const fs = __importStar(require("../../services/fs-promisified"));
|
|
27
|
-
const projectConfig_1 = require("./projectConfig");
|
|
28
|
-
describe('getProjectConfig', () => {
|
|
29
|
-
afterEach(() => jest.clearAllMocks());
|
|
30
|
-
describe('deprecations', () => {
|
|
31
|
-
describe('when specifying deprecated `branches`', () => {
|
|
32
|
-
it('is returned as `targetBranchChoices`', async () => {
|
|
33
|
-
jest.spyOn(fs, 'readFile').mockResolvedValueOnce(JSON.stringify({
|
|
34
|
-
repoName: 'kibana',
|
|
35
|
-
repoOwner: 'elastic',
|
|
36
|
-
branches: ['6.x'],
|
|
37
|
-
}));
|
|
38
|
-
const projectConfig = await (0, projectConfig_1.getProjectConfig)({ configFile: undefined });
|
|
39
|
-
expect(projectConfig?.targetBranchChoices).toEqual(['6.x']);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
describe('when specifying deprecated `labels`', () => {
|
|
43
|
-
it('is returned as `targetPRLabels`', async () => {
|
|
44
|
-
jest.spyOn(fs, 'readFile').mockResolvedValueOnce(JSON.stringify({
|
|
45
|
-
labels: ['backport'],
|
|
46
|
-
}));
|
|
47
|
-
const projectConfig = await (0, projectConfig_1.getProjectConfig)({ configFile: undefined });
|
|
48
|
-
expect(projectConfig?.targetPRLabels).toEqual(['backport']);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
describe('when specifying deprecated `upstream`', () => {
|
|
52
|
-
it('is split into `repoOwner` and `repoName`', async () => {
|
|
53
|
-
jest.spyOn(fs, 'readFile').mockResolvedValueOnce(JSON.stringify({
|
|
54
|
-
upstream: 'elastic/kibana',
|
|
55
|
-
}));
|
|
56
|
-
const projectConfig = await (0, projectConfig_1.getProjectConfig)({ configFile: undefined });
|
|
57
|
-
expect(projectConfig?.repoOwner).toEqual('elastic');
|
|
58
|
-
expect(projectConfig?.repoName).toEqual('kibana');
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
describe('when projectConfig is valid', () => {
|
|
62
|
-
let projectConfig;
|
|
63
|
-
beforeEach(async () => {
|
|
64
|
-
jest.spyOn(fs, 'readFile').mockResolvedValueOnce(JSON.stringify({
|
|
65
|
-
repoName: 'kibana',
|
|
66
|
-
repoOwner: 'elastic',
|
|
67
|
-
targetBranchChoices: ['6.x'],
|
|
68
|
-
targetPRLabels: ['backport'],
|
|
69
|
-
}));
|
|
70
|
-
projectConfig = await (0, projectConfig_1.getProjectConfig)({ configFile: undefined });
|
|
71
|
-
});
|
|
72
|
-
it('should call findUp', () => {
|
|
73
|
-
expect(find_up_1.default).toHaveBeenCalledWith('.backportrc.json');
|
|
74
|
-
});
|
|
75
|
-
it('should return config', () => {
|
|
76
|
-
expect(projectConfig).toEqual({
|
|
77
|
-
repoName: 'kibana',
|
|
78
|
-
repoOwner: 'elastic',
|
|
79
|
-
targetBranchChoices: ['6.x'],
|
|
80
|
-
targetPRLabels: ['backport'],
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
describe('when specifying a path to project config', () => {
|
|
85
|
-
let projectConfig;
|
|
86
|
-
let spy;
|
|
87
|
-
beforeEach(async () => {
|
|
88
|
-
spy = jest.spyOn(fs, 'readFile').mockResolvedValueOnce(JSON.stringify({
|
|
89
|
-
repoName: 'kibana',
|
|
90
|
-
repoOwner: 'elastic',
|
|
91
|
-
targetBranchChoices: ['6.x'],
|
|
92
|
-
targetPRLabels: ['backport'],
|
|
93
|
-
}));
|
|
94
|
-
projectConfig = await (0, projectConfig_1.getProjectConfig)({
|
|
95
|
-
configFile: '/custom/path/to/project/.backportrc.json',
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
it('should not call findUp', () => {
|
|
99
|
-
expect(find_up_1.default).not.toHaveBeenCalled();
|
|
100
|
-
});
|
|
101
|
-
it('should retrieve config via custom config path', () => {
|
|
102
|
-
expect(spy).toHaveBeenCalledWith('/custom/path/to/project/.backportrc.json', 'utf8');
|
|
103
|
-
});
|
|
104
|
-
it('should return config', () => {
|
|
105
|
-
expect(projectConfig).toEqual({
|
|
106
|
-
repoName: 'kibana',
|
|
107
|
-
repoOwner: 'elastic',
|
|
108
|
-
targetBranchChoices: ['6.x'],
|
|
109
|
-
targetPRLabels: ['backport'],
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
describe('when projectConfig is empty', () => {
|
|
115
|
-
it('should return empty config', async () => {
|
|
116
|
-
jest.spyOn(fs, 'readFile').mockResolvedValueOnce('{}');
|
|
117
|
-
const projectConfig = await (0, projectConfig_1.getProjectConfig)({ configFile: undefined });
|
|
118
|
-
expect(projectConfig).toEqual({});
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
describe('when projectConfig is missing', () => {
|
|
122
|
-
it('should return empty config', async () => {
|
|
123
|
-
find_up_1.default.mockReturnValueOnce(undefined);
|
|
124
|
-
const projectConfig = await (0, projectConfig_1.getProjectConfig)({ configFile: undefined });
|
|
125
|
-
expect(projectConfig).toEqual(undefined);
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { OptionsFromCliArgs } from './cliArgs';
|
|
2
|
-
export declare type ValidatedOptions = ReturnType<typeof getValidatedOptions>;
|
|
3
|
-
export declare function getValidatedOptions({ upstream, ...options }: OptionsFromCliArgs): {
|
|
4
|
-
accessToken: string;
|
|
5
|
-
username: string;
|
|
6
|
-
repoName: string;
|
|
7
|
-
repoOwner: string;
|
|
8
|
-
author: string;
|
|
9
|
-
all: boolean;
|
|
10
|
-
autoFixConflicts: (({ files, directory, logger, targetBranch, }: {
|
|
11
|
-
files: string[];
|
|
12
|
-
directory: string;
|
|
13
|
-
logger: {
|
|
14
|
-
error: (message: string, meta?: unknown) => void;
|
|
15
|
-
warn: (message: string, meta?: unknown) => void;
|
|
16
|
-
info: (message: string, meta?: unknown) => void;
|
|
17
|
-
verbose: (message: string, meta?: unknown) => void;
|
|
18
|
-
debug: (message: string, meta?: unknown) => void;
|
|
19
|
-
};
|
|
20
|
-
targetBranch: string;
|
|
21
|
-
}) => boolean | Promise<boolean>) | undefined;
|
|
22
|
-
assignees: string[];
|
|
23
|
-
branchLabelMapping: Record<string, string> | undefined;
|
|
24
|
-
multipleBranches: boolean;
|
|
25
|
-
multipleCommits: boolean;
|
|
26
|
-
noVerify: boolean;
|
|
27
|
-
targetBranchChoices: import("./ConfigOptions").BranchChoice[];
|
|
28
|
-
ci: boolean;
|
|
29
|
-
dryRun: boolean;
|
|
30
|
-
editor: string | undefined;
|
|
31
|
-
fork: boolean;
|
|
32
|
-
gitHostname: string;
|
|
33
|
-
githubApiBaseUrlV3: string;
|
|
34
|
-
githubApiBaseUrlV4: string;
|
|
35
|
-
mainline: number | undefined;
|
|
36
|
-
maxNumber: number;
|
|
37
|
-
path: string | undefined;
|
|
38
|
-
prTitle: string;
|
|
39
|
-
prDescription: string | undefined;
|
|
40
|
-
prFilter: string | undefined;
|
|
41
|
-
pullNumber: number | undefined;
|
|
42
|
-
resetAuthor: boolean;
|
|
43
|
-
sha: string | undefined;
|
|
44
|
-
sourceBranch: string | undefined;
|
|
45
|
-
sourcePRLabels: string[];
|
|
46
|
-
targetBranches: string[];
|
|
47
|
-
targetPRLabels: string[];
|
|
48
|
-
verbose: boolean;
|
|
49
|
-
};
|