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/README.md
CHANGED
|
@@ -201,12 +201,20 @@ console.log(commits);
|
|
|
201
201
|
|
|
202
202
|
/*
|
|
203
203
|
[{
|
|
204
|
-
|
|
204
|
+
soureCommit: {
|
|
205
|
+
committedDate: '2021-12-20T14:20:16Z',
|
|
206
|
+
sha: 'd421ddcf6157150596581c7885afa3690cec6339',
|
|
207
|
+
message: '[APM] Add note about synthtrace to APM docs (#121633)',
|
|
208
|
+
},
|
|
209
|
+
sourcePullRequest: {
|
|
210
|
+
number: 121633,
|
|
211
|
+
url: 'https://github.com/elastic/kibana/pull/121633'
|
|
212
|
+
mergeCommit: {
|
|
213
|
+
sha: 'd421ddcf6157150596581c7885afa3690cec6339',
|
|
214
|
+
message: '[APM] Add note about synthtrace to APM docs (#121633)',
|
|
215
|
+
}
|
|
216
|
+
},
|
|
205
217
|
sourceBranch: 'main',
|
|
206
|
-
sha: 'd421ddcf6157150596581c7885afa3690cec6339',
|
|
207
|
-
originalMessage: '[APM] Add note about synthtrace to APM docs (#121633)',
|
|
208
|
-
pullNumber: 121633,
|
|
209
|
-
pullUrl: 'https://github.com/elastic/kibana/pull/121633',
|
|
210
218
|
expectedTargetPullRequests: [
|
|
211
219
|
{
|
|
212
220
|
url: 'https://github.com/elastic/kibana/pull/121643',
|
package/dist/backportRun.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ConfigFileOptions } from './options/ConfigOptions';
|
|
2
2
|
import { Result } from './runSequentially';
|
|
3
|
+
import { HandledError } from './services/HandledError';
|
|
3
4
|
import { Commit } from './services/sourceCommit/parseSourceCommit';
|
|
4
5
|
export declare type BackportResponse = {
|
|
5
6
|
status: 'success';
|
|
@@ -8,7 +9,6 @@ export declare type BackportResponse = {
|
|
|
8
9
|
} | {
|
|
9
10
|
status: 'failure';
|
|
10
11
|
commits: Commit[];
|
|
11
|
-
|
|
12
|
-
error: Error;
|
|
12
|
+
error: Error | HandledError;
|
|
13
13
|
};
|
|
14
14
|
export declare function backportRun(processArgs: string[], optionsFromModule?: ConfigFileOptions): Promise<BackportResponse>;
|
package/dist/backportRun.js
CHANGED
|
@@ -6,21 +6,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.backportRun = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const ora_1 = __importDefault(require("ora"));
|
|
9
|
-
const
|
|
9
|
+
const yargs_parser_1 = __importDefault(require("yargs-parser"));
|
|
10
10
|
const options_1 = require("./options/options");
|
|
11
11
|
const runSequentially_1 = require("./runSequentially");
|
|
12
12
|
const HandledError_1 = require("./services/HandledError");
|
|
13
13
|
const env_1 = require("./services/env");
|
|
14
14
|
const createStatusComment_1 = require("./services/github/v3/createStatusComment");
|
|
15
|
+
const apiRequestV4_1 = require("./services/github/v4/apiRequestV4");
|
|
15
16
|
const logger_1 = require("./services/logger");
|
|
16
17
|
const getCommits_1 = require("./ui/getCommits");
|
|
17
18
|
const getTargetBranches_1 = require("./ui/getTargetBranches");
|
|
18
19
|
async function backportRun(processArgs, optionsFromModule = {}) {
|
|
19
|
-
const argv = (0,
|
|
20
|
+
const argv = (0, yargs_parser_1.default)(processArgs);
|
|
20
21
|
const ci = argv.ci ?? optionsFromModule.ci;
|
|
21
22
|
const logFilePath = argv.logFilePath ?? optionsFromModule.logFilePath;
|
|
22
23
|
(0, logger_1.initLogger)({ ci, logFilePath });
|
|
23
|
-
|
|
24
|
+
// don't show spinner for yargs commands that exit the process without stopping the spinner first
|
|
25
|
+
const spinner = (0, ora_1.default)();
|
|
26
|
+
if (!argv.help && !argv.version) {
|
|
27
|
+
spinner.start('Initializing...');
|
|
28
|
+
}
|
|
24
29
|
let options = null;
|
|
25
30
|
let commits = [];
|
|
26
31
|
try {
|
|
@@ -45,7 +50,6 @@ async function backportRun(processArgs, optionsFromModule = {}) {
|
|
|
45
50
|
const backportResponse = {
|
|
46
51
|
status: 'failure',
|
|
47
52
|
commits,
|
|
48
|
-
errorMessage: e.message,
|
|
49
53
|
error: e,
|
|
50
54
|
};
|
|
51
55
|
if (options) {
|
|
@@ -54,19 +58,19 @@ async function backportRun(processArgs, optionsFromModule = {}) {
|
|
|
54
58
|
backportResponse,
|
|
55
59
|
});
|
|
56
60
|
}
|
|
57
|
-
if (e instanceof HandledError_1.HandledError) {
|
|
61
|
+
if (e instanceof HandledError_1.HandledError || e instanceof apiRequestV4_1.GithubV4Exception) {
|
|
58
62
|
(0, logger_1.consoleLog)(e.message);
|
|
59
63
|
}
|
|
60
64
|
else if (e instanceof Error) {
|
|
61
65
|
// output
|
|
62
66
|
(0, logger_1.consoleLog)('\n');
|
|
63
67
|
(0, logger_1.consoleLog)(chalk_1.default.bold('⚠️ Ouch! An unhandled error occured 😿'));
|
|
64
|
-
(0, logger_1.consoleLog)(
|
|
68
|
+
(0, logger_1.consoleLog)(e.stack ? e.stack : e.message);
|
|
65
69
|
(0, logger_1.consoleLog)('Please open an issue in https://github.com/sqren/backport/issues or contact me directly on https://twitter.com/sorenlouv');
|
|
66
70
|
(0, logger_1.consoleLog)(chalk_1.default.italic(`For additional details see the logs: ${(0, env_1.getLogfilePath)({
|
|
67
71
|
logFilePath,
|
|
68
72
|
})}`));
|
|
69
|
-
// log
|
|
73
|
+
// write to log
|
|
70
74
|
logger_1.logger.info('Unknown error:', e);
|
|
71
75
|
}
|
|
72
76
|
return backportResponse;
|
package/dist/entrypoint.cli.js
CHANGED
|
File without changes
|
|
@@ -25,7 +25,7 @@ processArgs = []) {
|
|
|
25
25
|
}
|
|
26
26
|
exports.backportRun = backportRun;
|
|
27
27
|
async function getCommits(options) {
|
|
28
|
-
(0, logger_1.initLogger)({ ci: true });
|
|
28
|
+
(0, logger_1.initLogger)({ ci: true, accessToken: options.accessToken });
|
|
29
29
|
const optionsFromGithub = await (0, getOptionsFromGithub_1.getOptionsFromGithub)(options);
|
|
30
30
|
if (options.pullNumber) {
|
|
31
31
|
return [
|
|
@@ -55,6 +55,8 @@ declare type Options = Partial<{
|
|
|
55
55
|
verbose: boolean;
|
|
56
56
|
}>;
|
|
57
57
|
export declare type ConfigFileOptions = Options & Partial<{
|
|
58
|
+
help: boolean;
|
|
59
|
+
version: boolean;
|
|
58
60
|
branchLabelMapping: Record<string, string>;
|
|
59
61
|
/**
|
|
60
62
|
* @deprecated Replaced by `repoOwner` and `repoName`
|
package/dist/options/cliArgs.js
CHANGED
|
@@ -58,6 +58,7 @@ function getOptionsFromCliArgs(processArgs, { exitOnError = true } = {}) {
|
|
|
58
58
|
conflicts: ['noCherrypickRef'],
|
|
59
59
|
})
|
|
60
60
|
.option('configFile', {
|
|
61
|
+
alias: 'config',
|
|
61
62
|
description: 'Path to project config',
|
|
62
63
|
type: 'string',
|
|
63
64
|
})
|
|
@@ -292,8 +293,8 @@ function getOptionsFromCliArgs(processArgs, { exitOnError = true } = {}) {
|
|
|
292
293
|
...restOptions,
|
|
293
294
|
// filters
|
|
294
295
|
author: all ? null : author,
|
|
295
|
-
dateSince: since,
|
|
296
|
-
dateUntil: until,
|
|
296
|
+
dateSince: since ? new Date(since).toISOString() : undefined,
|
|
297
|
+
dateUntil: until ? new Date(until).toISOString() : undefined,
|
|
297
298
|
// `multiple` is a cli-only flag to override `multipleBranches` and `multipleCommits`
|
|
298
299
|
multipleBranches: multiple ?? multipleBranches,
|
|
299
300
|
multipleCommits: multiple ?? multipleCommits,
|
|
@@ -59,6 +59,8 @@ export declare function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsF
|
|
|
59
59
|
targetBranches?: string[] | undefined;
|
|
60
60
|
targetPRLabels?: string[] | undefined;
|
|
61
61
|
verbose?: boolean | undefined;
|
|
62
|
+
help?: boolean | undefined;
|
|
63
|
+
version?: boolean | undefined;
|
|
62
64
|
branchLabelMapping?: Record<string, string> | undefined;
|
|
63
65
|
upstream?: string | undefined;
|
|
64
66
|
branches?: import("../ConfigOptions").TargetBranchChoiceOrString[] | undefined;
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getOptionsFromConfigFiles = void 0;
|
|
4
|
-
const getOptionsFromGit_1 = require("./getOptionsFromGit");
|
|
5
4
|
const globalConfig_1 = require("./globalConfig");
|
|
6
5
|
const projectConfig_1 = require("./projectConfig");
|
|
7
6
|
async function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsFromModule, defaultConfigOptions, }) {
|
|
8
7
|
// ci: cli and module only flag
|
|
9
8
|
const ci = optionsFromCliArgs.ci ?? optionsFromModule.ci ?? defaultConfigOptions.ci;
|
|
10
9
|
// ci: cli and module only flag
|
|
11
|
-
const configFile = optionsFromCliArgs.configFile ??
|
|
12
|
-
|
|
13
|
-
defaultConfigOptions.configFile;
|
|
14
|
-
const [gitConfig, projectConfig, globalConfig] = await Promise.all([
|
|
15
|
-
(0, getOptionsFromGit_1.getOptionsFromGit)(),
|
|
10
|
+
const configFile = optionsFromCliArgs.configFile ?? optionsFromModule.configFile;
|
|
11
|
+
const [projectConfig, globalConfig] = await Promise.all([
|
|
16
12
|
(0, projectConfig_1.getProjectConfig)({ configFile }),
|
|
17
13
|
ci ? undefined : (0, globalConfig_1.getGlobalConfig)(),
|
|
18
14
|
]);
|
|
19
15
|
return {
|
|
20
|
-
...gitConfig,
|
|
21
16
|
...globalConfig,
|
|
22
17
|
...projectConfig,
|
|
23
18
|
...optionsFromModule,
|
|
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createGlobalConfigIfNotExist = exports.createGlobalConfigAndFolderIfNotExist = exports.getGlobalConfig = void 0;
|
|
7
|
+
const promises_1 = require("fs/promises");
|
|
7
8
|
const make_dir_1 = __importDefault(require("make-dir"));
|
|
8
9
|
const HandledError_1 = require("../../services/HandledError");
|
|
9
10
|
const env_1 = require("../../services/env");
|
|
10
|
-
const fs_promisified_1 = require("../../services/fs-promisified");
|
|
11
11
|
const readConfigFile_1 = require("./readConfigFile");
|
|
12
12
|
async function getGlobalConfig() {
|
|
13
13
|
const globalConfigPath = (0, env_1.getGlobalConfigPath)();
|
|
@@ -25,11 +25,11 @@ async function createGlobalConfigAndFolderIfNotExist(globalConfigPath) {
|
|
|
25
25
|
}
|
|
26
26
|
exports.createGlobalConfigAndFolderIfNotExist = createGlobalConfigAndFolderIfNotExist;
|
|
27
27
|
function ensureCorrectPermissions(globalConfigPath) {
|
|
28
|
-
return (0,
|
|
28
|
+
return (0, promises_1.chmod)(globalConfigPath, '600');
|
|
29
29
|
}
|
|
30
30
|
async function createGlobalConfigIfNotExist(globalConfigPath, configTemplate) {
|
|
31
31
|
try {
|
|
32
|
-
await (0,
|
|
32
|
+
await (0, promises_1.writeFile)(globalConfigPath, configTemplate, {
|
|
33
33
|
flag: 'wx',
|
|
34
34
|
mode: 0o600, // give the owner read-write privleges, no access for others
|
|
35
35
|
});
|
|
@@ -3,6 +3,7 @@ export declare function readConfigFile(filepath: string): Promise<ConfigFileOpti
|
|
|
3
3
|
export declare function withConfigMigrations({ upstream, labels, branches, ...config }: ConfigFileOptions): {
|
|
4
4
|
fork?: boolean | undefined;
|
|
5
5
|
dir?: string | undefined;
|
|
6
|
+
help?: boolean | undefined;
|
|
6
7
|
verbose?: boolean | undefined;
|
|
7
8
|
accessToken?: string | undefined;
|
|
8
9
|
author?: string | null | undefined;
|
|
@@ -34,6 +35,7 @@ export declare function withConfigMigrations({ upstream, labels, branches, ...co
|
|
|
34
35
|
repoOwner?: string | undefined;
|
|
35
36
|
repoName?: string | undefined;
|
|
36
37
|
sourceBranch?: string | undefined;
|
|
38
|
+
version?: boolean | undefined;
|
|
37
39
|
commitPaths?: string[] | undefined;
|
|
38
40
|
reviewers?: string[] | undefined;
|
|
39
41
|
sourcePRLabels?: string[] | undefined;
|
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.withConfigMigrations = exports.readConfigFile = void 0;
|
|
7
|
+
const promises_1 = require("fs/promises");
|
|
7
8
|
const strip_json_comments_1 = __importDefault(require("strip-json-comments"));
|
|
8
9
|
const HandledError_1 = require("../../services/HandledError");
|
|
9
|
-
const fs_promisified_1 = require("../../services/fs-promisified");
|
|
10
10
|
const excludeUndefined_1 = require("../../utils/excludeUndefined");
|
|
11
11
|
async function readConfigFile(filepath) {
|
|
12
|
-
const fileContents = await (0,
|
|
12
|
+
const fileContents = await (0, promises_1.readFile)(filepath, 'utf8');
|
|
13
13
|
const configWithoutComments = (0, strip_json_comments_1.default)(fileContents);
|
|
14
14
|
try {
|
|
15
15
|
return withConfigMigrations(JSON.parse(configWithoutComments));
|
|
@@ -1,31 +1,5 @@
|
|
|
1
1
|
import { ConfigFileOptions, TargetBranchChoiceOrString } from './ConfigOptions';
|
|
2
2
|
export declare type ValidConfigOptions = Readonly<Awaited<ReturnType<typeof getOptions>>>;
|
|
3
|
-
export declare const defaultConfigOptions: {
|
|
4
|
-
assignees: string[];
|
|
5
|
-
autoAssign: boolean;
|
|
6
|
-
autoMerge: boolean;
|
|
7
|
-
autoMergeMethod: string;
|
|
8
|
-
backportBinary: string;
|
|
9
|
-
cherrypickRef: boolean;
|
|
10
|
-
ci: boolean;
|
|
11
|
-
commitPaths: string[];
|
|
12
|
-
dateSince: null;
|
|
13
|
-
dateUntil: null;
|
|
14
|
-
details: boolean;
|
|
15
|
-
fork: boolean;
|
|
16
|
-
maxNumber: number;
|
|
17
|
-
multipleBranches: boolean;
|
|
18
|
-
multipleCommits: boolean;
|
|
19
|
-
noVerify: boolean;
|
|
20
|
-
publishStatusComment: boolean;
|
|
21
|
-
resetAuthor: boolean;
|
|
22
|
-
reviewers: string[];
|
|
23
|
-
sourcePRLabels: string[];
|
|
24
|
-
targetBranchChoices: TargetBranchChoiceOrString[];
|
|
25
|
-
targetBranches: string[];
|
|
26
|
-
targetPRLabels: string[];
|
|
27
|
-
verbose: boolean;
|
|
28
|
-
};
|
|
29
3
|
export declare function getOptions(processArgs: string[], optionsFromModule: ConfigFileOptions): Promise<{
|
|
30
4
|
accessToken: string;
|
|
31
5
|
repoName: string;
|
|
@@ -44,7 +18,7 @@ export declare function getOptions(processArgs: string[], optionsFromModule: Con
|
|
|
44
18
|
details: boolean;
|
|
45
19
|
editor?: string | undefined;
|
|
46
20
|
skipRemoteConfig?: boolean | undefined;
|
|
47
|
-
gitHostname
|
|
21
|
+
gitHostname: string;
|
|
48
22
|
githubApiBaseUrlV3?: string | undefined;
|
|
49
23
|
githubApiBaseUrlV4?: string | undefined;
|
|
50
24
|
logFilePath?: string | undefined;
|
|
@@ -87,9 +61,12 @@ export declare function getOptions(processArgs: string[], optionsFromModule: Con
|
|
|
87
61
|
}) => boolean | Promise<boolean>) | undefined;
|
|
88
62
|
backportBinary: string;
|
|
89
63
|
multiple?: boolean | undefined;
|
|
64
|
+
help?: boolean | undefined;
|
|
65
|
+
version?: boolean | undefined;
|
|
90
66
|
branchLabelMapping?: Record<string, string> | undefined;
|
|
91
67
|
upstream?: string | undefined;
|
|
92
68
|
branches?: TargetBranchChoiceOrString[] | undefined;
|
|
93
69
|
labels?: string[] | undefined;
|
|
94
70
|
authenticatedUsername: string;
|
|
71
|
+
cwd: string;
|
|
95
72
|
}>;
|
package/dist/options/options.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOptions =
|
|
3
|
+
exports.getOptions = void 0;
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
5
|
const HandledError_1 = require("../services/HandledError");
|
|
6
6
|
const env_1 = require("../services/env");
|
|
7
7
|
const getOptionsFromGithub_1 = require("../services/github/v4/getOptionsFromGithub/getOptionsFromGithub");
|
|
8
|
+
const getRepoOwnerAndNameFromGitRemotes_1 = require("../services/github/v4/getRepoOwnerAndNameFromGitRemotes");
|
|
8
9
|
const logger_1 = require("./../services/logger");
|
|
9
10
|
const cliArgs_1 = require("./cliArgs");
|
|
10
11
|
const config_1 = require("./config/config");
|
|
11
12
|
const PROJECT_CONFIG_DOCS_LINK = 'https://github.com/sqren/backport/blob/main/docs/configuration.md#project-config-backportrcjson';
|
|
12
13
|
const GLOBAL_CONFIG_DOCS_LINK = 'https://github.com/sqren/backport/blob/main/docs/configuration.md#global-config-backportconfigjson';
|
|
13
|
-
|
|
14
|
+
const defaultConfigOptions = {
|
|
14
15
|
assignees: [],
|
|
15
16
|
autoAssign: false,
|
|
16
17
|
autoMerge: false,
|
|
@@ -19,10 +20,12 @@ exports.defaultConfigOptions = {
|
|
|
19
20
|
cherrypickRef: true,
|
|
20
21
|
ci: false,
|
|
21
22
|
commitPaths: [],
|
|
23
|
+
cwd: process.cwd(),
|
|
22
24
|
dateSince: null,
|
|
23
25
|
dateUntil: null,
|
|
24
26
|
details: false,
|
|
25
27
|
fork: true,
|
|
28
|
+
gitHostname: 'github.com',
|
|
26
29
|
maxNumber: 10,
|
|
27
30
|
multipleBranches: true,
|
|
28
31
|
multipleCommits: false,
|
|
@@ -41,22 +44,19 @@ async function getOptions(processArgs, optionsFromModule) {
|
|
|
41
44
|
const optionsFromConfigFiles = await (0, config_1.getOptionsFromConfigFiles)({
|
|
42
45
|
optionsFromCliArgs,
|
|
43
46
|
optionsFromModule,
|
|
44
|
-
defaultConfigOptions
|
|
47
|
+
defaultConfigOptions,
|
|
45
48
|
});
|
|
46
49
|
// combined options from cli and config files
|
|
47
50
|
const combined = getCombinedOptions({
|
|
48
51
|
optionsFromConfigFiles,
|
|
49
52
|
optionsFromCliArgs,
|
|
50
53
|
});
|
|
54
|
+
const { accessToken, repoName, repoOwner } = await getRequiredOptions(combined);
|
|
51
55
|
// update logger
|
|
52
|
-
(0, logger_1.updateLogger)(combined);
|
|
53
|
-
// required
|
|
54
|
-
const accessToken = requireAccessToken(combined);
|
|
55
|
-
const repoName = requireRepoName(combined);
|
|
56
|
-
const repoOwner = requireRepoOwner(combined);
|
|
56
|
+
(0, logger_1.updateLogger)({ accessToken, verbose: combined.verbose });
|
|
57
57
|
const optionsFromGithub = await (0, getOptionsFromGithub_1.getOptionsFromGithub)({
|
|
58
58
|
...combined,
|
|
59
|
-
// required
|
|
59
|
+
// required options
|
|
60
60
|
accessToken,
|
|
61
61
|
repoName,
|
|
62
62
|
repoOwner,
|
|
@@ -65,7 +65,7 @@ async function getOptions(processArgs, optionsFromModule) {
|
|
|
65
65
|
// default author
|
|
66
66
|
author: optionsFromGithub.authenticatedUsername,
|
|
67
67
|
// default values have lowest precedence
|
|
68
|
-
...
|
|
68
|
+
...defaultConfigOptions,
|
|
69
69
|
// local config options override default options
|
|
70
70
|
...optionsFromConfigFiles,
|
|
71
71
|
// remote config options override local config options
|
|
@@ -81,32 +81,40 @@ async function getOptions(processArgs, optionsFromModule) {
|
|
|
81
81
|
return res;
|
|
82
82
|
}
|
|
83
83
|
exports.getOptions = getOptions;
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
function requireAccessToken(combinedOptions) {
|
|
92
|
-
// accessToken must be supplied in config or via cli args
|
|
93
|
-
if (!combinedOptions.accessToken) {
|
|
84
|
+
async function getRequiredOptions(combined) {
|
|
85
|
+
const { accessToken, repoName, repoOwner } = combined;
|
|
86
|
+
if (accessToken && repoName && repoOwner) {
|
|
87
|
+
return { accessToken, repoName, repoOwner };
|
|
88
|
+
}
|
|
89
|
+
// require access token
|
|
90
|
+
if (!accessToken) {
|
|
94
91
|
const globalConfigPath = (0, env_1.getGlobalConfigPath)();
|
|
95
92
|
throw new HandledError_1.HandledError(`Please update your config file: "${globalConfigPath}".\nIt must contain a valid "accessToken".\n\nRead more: ${GLOBAL_CONFIG_DOCS_LINK}`);
|
|
96
93
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
// attempt to retrieve repo-owner and repo-name from git remote
|
|
95
|
+
const gitRemote = await (0, getRepoOwnerAndNameFromGitRemotes_1.getRepoOwnerAndNameFromGitRemotes)({
|
|
96
|
+
cwd: combined.cwd,
|
|
97
|
+
githubApiBaseUrlV4: combined.githubApiBaseUrlV4,
|
|
98
|
+
accessToken,
|
|
99
|
+
});
|
|
100
|
+
if (!gitRemote.repoName) {
|
|
101
101
|
throw new HandledError_1.HandledError(`Please specify a repo name: "--repo-name kibana".\n\nRead more: ${PROJECT_CONFIG_DOCS_LINK}`);
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
function requireRepoOwner(combinedOptions) {
|
|
106
|
-
if (!combinedOptions.repoOwner) {
|
|
103
|
+
if (!gitRemote.repoOwner) {
|
|
107
104
|
throw new HandledError_1.HandledError(`Please specify a repo owner: "--repo-owner elastic".\n\nRead more: ${PROJECT_CONFIG_DOCS_LINK}`);
|
|
108
105
|
}
|
|
109
|
-
return
|
|
106
|
+
return {
|
|
107
|
+
accessToken,
|
|
108
|
+
repoName: gitRemote.repoName,
|
|
109
|
+
repoOwner: gitRemote.repoOwner,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function getCombinedOptions({ optionsFromConfigFiles, optionsFromCliArgs, }) {
|
|
113
|
+
return {
|
|
114
|
+
...defaultConfigOptions,
|
|
115
|
+
...optionsFromConfigFiles,
|
|
116
|
+
...optionsFromCliArgs,
|
|
117
|
+
};
|
|
110
118
|
}
|
|
111
119
|
function requireTargetBranch(config) {
|
|
112
120
|
// ensure `targetBranches` or `targetBranchChoices` are given
|
package/dist/runSequentially.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Commit } from './sourceCommit/parseSourceCommit';
|
|
2
|
-
declare type
|
|
3
|
-
|
|
2
|
+
declare type ErrorContext = {
|
|
3
|
+
code: 'merge-conflict-exception';
|
|
4
4
|
commitsWithoutBackports: {
|
|
5
5
|
formatted: string;
|
|
6
6
|
commit: Commit;
|
|
7
7
|
}[];
|
|
8
|
+
} | {
|
|
9
|
+
code: 'no-branches-exception' | 'abort-exception';
|
|
8
10
|
};
|
|
9
11
|
export declare class HandledError extends Error {
|
|
10
|
-
|
|
11
|
-
constructor(
|
|
12
|
+
errorContext?: ErrorContext;
|
|
13
|
+
constructor(errorContext: ErrorContext | string);
|
|
12
14
|
}
|
|
13
15
|
export {};
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HandledError = void 0;
|
|
4
|
+
function getMessage(errorContext) {
|
|
5
|
+
if (typeof errorContext === 'string') {
|
|
6
|
+
return errorContext;
|
|
7
|
+
}
|
|
8
|
+
switch (errorContext.code) {
|
|
9
|
+
case 'merge-conflict-exception':
|
|
10
|
+
return `Commit could not be cherrypicked due to conflicts`;
|
|
11
|
+
case 'no-branches-exception':
|
|
12
|
+
return 'There are no branches to backport to. Aborting.';
|
|
13
|
+
case 'abort-exception':
|
|
14
|
+
return 'Aborted';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
4
17
|
class HandledError extends Error {
|
|
5
|
-
constructor(
|
|
6
|
-
super(
|
|
18
|
+
constructor(errorContext) {
|
|
19
|
+
super(getMessage(errorContext));
|
|
7
20
|
Error.captureStackTrace(this, HandledError);
|
|
8
21
|
this.name = 'HandledError';
|
|
9
|
-
|
|
22
|
+
if (typeof errorContext !== 'string') {
|
|
23
|
+
this.errorContext = errorContext;
|
|
24
|
+
}
|
|
10
25
|
}
|
|
11
26
|
}
|
|
12
27
|
exports.HandledError = HandledError;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import child_process from 'child_process';
|
|
3
|
-
export declare function exec(cmd: string, options: child_process.ExecOptions
|
|
3
|
+
export declare function exec(cmd: string, options: child_process.ExecOptions & {
|
|
4
|
+
cwd: string;
|
|
5
|
+
}): Promise<{
|
|
4
6
|
stdout: string;
|
|
5
7
|
stderr: string;
|
|
6
8
|
}>;
|
package/dist/services/git.d.ts
CHANGED
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
import { ValidConfigOptions } from '../options/options';
|
|
2
2
|
import { ExpectedTargetPullRequest } from './sourceCommit/getExpectedTargetPullRequests';
|
|
3
3
|
import { Commit } from './sourceCommit/parseSourceCommit';
|
|
4
|
-
export declare function repoExists(options: ValidConfigOptions): Promise<boolean>;
|
|
5
|
-
export declare function deleteRepo(options: ValidConfigOptions): Promise<string[]>;
|
|
6
4
|
export declare function getRemoteUrl({ repoName, accessToken, gitHostname }: ValidConfigOptions, repoOwner: string): string;
|
|
7
|
-
export declare function cloneRepo(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export declare function
|
|
5
|
+
export declare function cloneRepo({ sourcePath, targetPath }: {
|
|
6
|
+
sourcePath: string;
|
|
7
|
+
targetPath: string;
|
|
8
|
+
}, onProgress: (progress: number) => void): Promise<void>;
|
|
9
|
+
export declare function getLocalConfigFileCommitDate({ cwd }: {
|
|
10
|
+
cwd: string;
|
|
11
|
+
}): Promise<number | undefined>;
|
|
12
|
+
export declare function isLocalConfigFileUntracked({ cwd }: {
|
|
13
|
+
cwd: string;
|
|
14
|
+
}): Promise<boolean | undefined>;
|
|
15
|
+
export declare function isLocalConfigFileModified({ cwd }: {
|
|
16
|
+
cwd: string;
|
|
17
|
+
}): Promise<boolean | undefined>;
|
|
18
|
+
export declare function getRepoInfoFromGitRemotes({ cwd }: {
|
|
19
|
+
cwd: string;
|
|
20
|
+
}): Promise<{
|
|
12
21
|
repoOwner: string;
|
|
13
22
|
repoName: string;
|
|
14
|
-
}
|
|
23
|
+
}[]>;
|
|
24
|
+
export declare function getGitProjectRoot({ cwd }: {
|
|
25
|
+
cwd: string;
|
|
26
|
+
}): Promise<string | undefined>;
|
|
15
27
|
export declare function getIsCommitInBranch(options: ValidConfigOptions, commitSha: string): Promise<boolean>;
|
|
16
28
|
export declare function deleteRemote(options: ValidConfigOptions, remoteName: string): Promise<void>;
|
|
17
29
|
export declare function addRemote(options: ValidConfigOptions, remoteName: string): Promise<void>;
|
|
18
30
|
export declare function fetchBranch(options: ValidConfigOptions, branch: string): Promise<void>;
|
|
19
|
-
export declare function cherrypick(options: ValidConfigOptions, sha:
|
|
31
|
+
export declare function cherrypick(options: ValidConfigOptions, sha: string, mergedTargetPullRequest?: ExpectedTargetPullRequest): Promise<{
|
|
20
32
|
conflictingFiles: {
|
|
21
33
|
absolute: string;
|
|
22
34
|
relative: string;
|
|
@@ -55,3 +67,4 @@ export declare function pushBackportBranch({ options, backportBranch, }: {
|
|
|
55
67
|
stdout: string;
|
|
56
68
|
stderr: string;
|
|
57
69
|
}>;
|
|
70
|
+
export declare function getSourceRepoPath(options: ValidConfigOptions): Promise<string>;
|