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
|
@@ -1,96 +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.CommitPrompt = void 0;
|
|
26
|
-
const ink_multi_select_1 = __importDefault(require("ink-multi-select"));
|
|
27
|
-
const react_1 = __importStar(require("react"));
|
|
28
|
-
const fetchCommitByPullNumber_1 = require("../../services/github/v4/fetchCommits/fetchCommitByPullNumber");
|
|
29
|
-
const fetchCommitBySha_1 = require("../../services/github/v4/fetchCommits/fetchCommitBySha");
|
|
30
|
-
const fetchCommitsByAuthor_1 = require("../../services/github/v4/fetchCommits/fetchCommitsByAuthor");
|
|
31
|
-
const fetchPullRequestBySearchQuery_1 = require("../../services/github/v4/fetchCommits/fetchPullRequestBySearchQuery");
|
|
32
|
-
const logger_1 = require("../../services/logger");
|
|
33
|
-
const BackportStateContext_1 = require("../BackportStateContext");
|
|
34
|
-
const useAsync_1 = require("../hooks/useAsync");
|
|
35
|
-
function CommitPrompt({ options, optionsStatus, optionsError, }) {
|
|
36
|
-
const { setBackportState } = (0, BackportStateContext_1.useBackportStateContext)();
|
|
37
|
-
const [choices, setChoices] = (0, react_1.useState)([]);
|
|
38
|
-
const [loadingStatus, setLoadingStatus] = (0, react_1.useState)('loading');
|
|
39
|
-
const [error, setError] = (0, react_1.useState)(null);
|
|
40
|
-
(0, react_1.useEffect)(() => {
|
|
41
|
-
async function fetch() {
|
|
42
|
-
if (!options) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const commit = await getCommit(options);
|
|
46
|
-
if (commit) {
|
|
47
|
-
setBackportState({
|
|
48
|
-
view: 'target-branches-prompt',
|
|
49
|
-
commits: [commit],
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
const commitChoices = options.prFilter
|
|
54
|
-
? await (0, fetchPullRequestBySearchQuery_1.fetchPullRequestBySearchQuery)(options)
|
|
55
|
-
: await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)(options);
|
|
56
|
-
setChoices(commitChoices);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
fetch()
|
|
60
|
-
.then(() => {
|
|
61
|
-
setLoadingStatus('success');
|
|
62
|
-
})
|
|
63
|
-
.catch((e) => {
|
|
64
|
-
setLoadingStatus('failure');
|
|
65
|
-
setError(e);
|
|
66
|
-
});
|
|
67
|
-
}, [options]);
|
|
68
|
-
// console.log({ optionsStatus, loadingStatus });
|
|
69
|
-
if (optionsStatus !== 'success') {
|
|
70
|
-
return (react_1.default.createElement(useAsync_1.ShowAsyncStatus, { text: "Initializing", status: optionsStatus, error: optionsError }));
|
|
71
|
-
}
|
|
72
|
-
if (loadingStatus !== 'success') {
|
|
73
|
-
return (react_1.default.createElement(useAsync_1.ShowAsyncStatus, { text: "Loading commits", status: loadingStatus, error: error }));
|
|
74
|
-
}
|
|
75
|
-
logger_1.logger.info(`tester: ${optionsStatus}, ${loadingStatus}, ${choices.length}`);
|
|
76
|
-
const handleSubmit = (items) => {
|
|
77
|
-
console.log(items);
|
|
78
|
-
};
|
|
79
|
-
const items = choices.map((c) => ({
|
|
80
|
-
label: c.originalMessage,
|
|
81
|
-
value: c.originalMessage,
|
|
82
|
-
}));
|
|
83
|
-
return react_1.default.createElement(ink_multi_select_1.default, { items: items, onSubmit: handleSubmit });
|
|
84
|
-
}
|
|
85
|
-
exports.CommitPrompt = CommitPrompt;
|
|
86
|
-
function getCommit(options) {
|
|
87
|
-
if (options.sha) {
|
|
88
|
-
return (0, fetchCommitBySha_1.fetchCommitBySha)({ ...options, sha: options.sha });
|
|
89
|
-
}
|
|
90
|
-
if (options.pullNumber) {
|
|
91
|
-
return (0, fetchCommitByPullNumber_1.fetchCommitByPullNumber)({
|
|
92
|
-
...options,
|
|
93
|
-
pullNumber: options.pullNumber, // must extract pullNumber to satisfy the ts gods
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ListedItem, SelectedItem } from 'ink-multi-select';
|
|
3
|
-
export declare function ItemComponent({ isHighlighted, label, }: {
|
|
4
|
-
isHighlighted?: boolean;
|
|
5
|
-
label: string;
|
|
6
|
-
}): JSX.Element;
|
|
7
|
-
export declare function CustomSelect({ defaultSelected, items, onMultiSubmit, onSingleSelect, isMultiSelect, }: {
|
|
8
|
-
defaultSelected?: SelectedItem[];
|
|
9
|
-
items: ListedItem[];
|
|
10
|
-
onMultiSubmit: (item: ListedItem[]) => void;
|
|
11
|
-
onSingleSelect: (item: ListedItem) => void;
|
|
12
|
-
isMultiSelect: boolean;
|
|
13
|
-
}): JSX.Element;
|
|
@@ -1,21 +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.CustomSelect = exports.ItemComponent = void 0;
|
|
7
|
-
const ink_1 = require("ink");
|
|
8
|
-
const ink_multi_select_1 = __importDefault(require("ink-multi-select"));
|
|
9
|
-
const ink_select_input_1 = __importDefault(require("ink-select-input"));
|
|
10
|
-
const react_1 = __importDefault(require("react"));
|
|
11
|
-
function ItemComponent({ isHighlighted, label, }) {
|
|
12
|
-
return react_1.default.createElement(ink_1.Text, { color: isHighlighted ? 'cyanBright' : undefined }, label);
|
|
13
|
-
}
|
|
14
|
-
exports.ItemComponent = ItemComponent;
|
|
15
|
-
function CustomSelect({ defaultSelected, items, onMultiSubmit, onSingleSelect, isMultiSelect, }) {
|
|
16
|
-
if (isMultiSelect) {
|
|
17
|
-
return (react_1.default.createElement(ink_multi_select_1.default, { itemComponent: ItemComponent, defaultSelected: defaultSelected, items: items, onSubmit: onMultiSubmit }));
|
|
18
|
-
}
|
|
19
|
-
return (react_1.default.createElement(ink_select_input_1.default, { itemComponent: ItemComponent, items: items.map(({ label, value }) => ({ label, value })), onSelect: onSingleSelect }));
|
|
20
|
-
}
|
|
21
|
-
exports.CustomSelect = CustomSelect;
|
|
@@ -1,12 +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.CustomMultiSelectItem = void 0;
|
|
7
|
-
const ink_1 = require("ink");
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
function CustomMultiSelectItem({ isHighlighted, label, }) {
|
|
10
|
-
return react_1.default.createElement(ink_1.Text, { color: isHighlighted ? 'cyanBright' : undefined }, label);
|
|
11
|
-
}
|
|
12
|
-
exports.CustomMultiSelectItem = CustomMultiSelectItem;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { SelectedItem } from 'ink-multi-select';
|
|
3
|
-
export declare type SelectItem<V> = {
|
|
4
|
-
label: string;
|
|
5
|
-
value: V;
|
|
6
|
-
key?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare function CustomSelect<V>({ defaultSelected, items, onMultiSubmit, onSingleSelect, isMultiSelect, }: {
|
|
9
|
-
defaultSelected?: SelectedItem[];
|
|
10
|
-
items: SelectItem<V>[];
|
|
11
|
-
onMultiSubmit: (item: SelectItem<V>[]) => void;
|
|
12
|
-
onSingleSelect: (item: SelectItem<V>) => void;
|
|
13
|
-
isMultiSelect: boolean;
|
|
14
|
-
}): JSX.Element;
|
|
@@ -1,34 +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.CustomSelect = void 0;
|
|
7
|
-
const figures_1 = __importDefault(require("figures"));
|
|
8
|
-
const ink_1 = require("ink");
|
|
9
|
-
const ink_link_1 = __importDefault(require("ink-link"));
|
|
10
|
-
const ink_multi_select_1 = __importDefault(require("ink-multi-select"));
|
|
11
|
-
const ink_select_input_1 = __importDefault(require("ink-select-input"));
|
|
12
|
-
const react_1 = __importDefault(require("react"));
|
|
13
|
-
function IndicatorComponent({ isSelected = false }) {
|
|
14
|
-
return (react_1.default.createElement(ink_1.Box, { marginRight: 1 }, isSelected ? (react_1.default.createElement(ink_1.Text, { color: "greenBright" }, figures_1.default.pointer)) : (react_1.default.createElement(ink_1.Text, null, " "))));
|
|
15
|
-
}
|
|
16
|
-
function IndicatorComponentMulti({ isHighlighted = false, }) {
|
|
17
|
-
return IndicatorComponent({ isSelected: isHighlighted });
|
|
18
|
-
}
|
|
19
|
-
function ItemComponent({ isHighlighted, label, value, }) {
|
|
20
|
-
return (react_1.default.createElement(ink_1.Box, { flexDirection: "column", marginBottom: 1 },
|
|
21
|
-
react_1.default.createElement(ink_1.Text, { color: isHighlighted ? 'greenBright' : undefined }, label),
|
|
22
|
-
react_1.default.createElement(ink_link_1.default, { url: value.pullUrl },
|
|
23
|
-
"My ",
|
|
24
|
-
react_1.default.createElement(ink_1.Text, { color: "cyan" }, "Website"))));
|
|
25
|
-
}
|
|
26
|
-
function CustomSelect({ defaultSelected, items, onMultiSubmit, onSingleSelect, isMultiSelect, }) {
|
|
27
|
-
if (isMultiSelect) {
|
|
28
|
-
return (react_1.default.createElement(ink_multi_select_1.default, { indicatorComponent: IndicatorComponentMulti, itemComponent: ItemComponent, defaultSelected: defaultSelected, items: items,
|
|
29
|
-
//@ts-expect-error
|
|
30
|
-
onSubmit: onMultiSubmit }));
|
|
31
|
-
}
|
|
32
|
-
return (react_1.default.createElement(ink_select_input_1.default, { limit: 5, indicatorComponent: IndicatorComponent, itemComponent: ItemComponent, items: items, onSelect: onSingleSelect }));
|
|
33
|
-
}
|
|
34
|
-
exports.CustomSelect = CustomSelect;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React, { Component, ErrorInfo, ReactNode } from 'react';
|
|
2
|
-
interface Props {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
}
|
|
5
|
-
interface State {
|
|
6
|
-
hasError: boolean;
|
|
7
|
-
error: Error | null;
|
|
8
|
-
}
|
|
9
|
-
declare class ErrorBoundary extends Component<Props, State> {
|
|
10
|
-
state: State;
|
|
11
|
-
static getDerivedStateFromError(error: Error): State;
|
|
12
|
-
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
13
|
-
render(): React.ReactNode;
|
|
14
|
-
}
|
|
15
|
-
export default ErrorBoundary;
|
|
@@ -1,53 +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 ink_1 = require("ink");
|
|
23
|
-
const react_1 = __importStar(require("react"));
|
|
24
|
-
const logger_1 = require("../services/logger");
|
|
25
|
-
class ErrorBoundary extends react_1.Component {
|
|
26
|
-
constructor() {
|
|
27
|
-
super(...arguments);
|
|
28
|
-
this.state = {
|
|
29
|
-
hasError: false,
|
|
30
|
-
error: null,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
static getDerivedStateFromError(error) {
|
|
34
|
-
// Update state so the next render will show the fallback UI.
|
|
35
|
-
return { hasError: true, error };
|
|
36
|
-
}
|
|
37
|
-
componentDidCatch(error, errorInfo) {
|
|
38
|
-
logger_1.logger.error('Uncaught error:', error);
|
|
39
|
-
logger_1.logger.error('Error details', errorInfo);
|
|
40
|
-
}
|
|
41
|
-
render() {
|
|
42
|
-
if (this.state.error) {
|
|
43
|
-
if (process.env.NODE_ENV === 'development') {
|
|
44
|
-
throw this.state.error;
|
|
45
|
-
}
|
|
46
|
-
return react_1.default.createElement(ink_1.Text, null,
|
|
47
|
-
"Sorry.. there was an error: ",
|
|
48
|
-
this.state.error.stack);
|
|
49
|
-
}
|
|
50
|
-
return this.props.children;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.default = ErrorBoundary;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ListedItem, SelectedItem } from 'ink-multi-select';
|
|
3
|
-
export declare function CustomMultiSelect({ defaultSelected, items, onSubmit, }: {
|
|
4
|
-
defaultSelected?: SelectedItem[];
|
|
5
|
-
items: ListedItem[] | undefined;
|
|
6
|
-
onSubmit: (item: ListedItem[]) => void;
|
|
7
|
-
}): JSX.Element;
|
|
@@ -1,16 +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.CustomMultiSelect = void 0;
|
|
7
|
-
const ink_1 = require("ink");
|
|
8
|
-
const ink_multi_select_1 = __importDefault(require("ink-multi-select"));
|
|
9
|
-
const react_1 = __importDefault(require("react"));
|
|
10
|
-
function Item({ isHighlighted, label, }) {
|
|
11
|
-
return react_1.default.createElement(ink_1.Text, { color: isHighlighted ? 'cyanBright' : undefined }, label);
|
|
12
|
-
}
|
|
13
|
-
function CustomMultiSelect({ defaultSelected, items, onSubmit, }) {
|
|
14
|
-
return (react_1.default.createElement(ink_multi_select_1.default, { itemComponent: Item, defaultSelected: defaultSelected, items: items, onSubmit: onSubmit }));
|
|
15
|
-
}
|
|
16
|
-
exports.CustomMultiSelect = CustomMultiSelect;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare type AsyncStatus = 'loading' | 'success' | 'failure';
|
|
3
|
-
export declare function useAsync<T>(fn: () => Promise<T>): {
|
|
4
|
-
data: T | undefined;
|
|
5
|
-
status: AsyncStatus;
|
|
6
|
-
error: Error | null;
|
|
7
|
-
};
|
|
8
|
-
export declare function ShowAsyncStatus({ status, text, error, }: {
|
|
9
|
-
status: AsyncStatus;
|
|
10
|
-
text: string;
|
|
11
|
-
error: Error | null;
|
|
12
|
-
}): JSX.Element;
|
|
@@ -1,73 +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.ShowAsyncStatus = exports.useAsync = 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
|
-
function useAsync(fn) {
|
|
30
|
-
const [error, setError] = (0, react_1.useState)(null);
|
|
31
|
-
const [data, setData] = (0, react_1.useState)();
|
|
32
|
-
const [status, setStatus] = (0, react_1.useState)('loading');
|
|
33
|
-
(0, react_1.useEffect)(() => {
|
|
34
|
-
async function fetch() {
|
|
35
|
-
try {
|
|
36
|
-
const data = await fn();
|
|
37
|
-
setStatus('success');
|
|
38
|
-
setData(data);
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
setStatus('failure');
|
|
42
|
-
setError(e);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
fetch();
|
|
46
|
-
}, []);
|
|
47
|
-
return { data, status, error };
|
|
48
|
-
}
|
|
49
|
-
exports.useAsync = useAsync;
|
|
50
|
-
function ShowAsyncStatus({ status, text, error, }) {
|
|
51
|
-
if (status === 'loading') {
|
|
52
|
-
return (react_1.default.createElement(ink_1.Text, null,
|
|
53
|
-
react_1.default.createElement(ink_1.Text, { color: "green" },
|
|
54
|
-
react_1.default.createElement(ink_spinner_1.default, { type: "dots" })),
|
|
55
|
-
"\u00A0",
|
|
56
|
-
text));
|
|
57
|
-
}
|
|
58
|
-
if (status === 'success') {
|
|
59
|
-
return (react_1.default.createElement(ink_1.Text, null,
|
|
60
|
-
react_1.default.createElement(ink_1.Text, { color: "green" }, "\u2705"),
|
|
61
|
-
"\u00A0",
|
|
62
|
-
text));
|
|
63
|
-
}
|
|
64
|
-
return (react_1.default.createElement(ink_1.Text, null,
|
|
65
|
-
react_1.default.createElement(ink_1.Text, { color: "green" }, "\u274C"),
|
|
66
|
-
"\u00A0",
|
|
67
|
-
text,
|
|
68
|
-
react_1.default.createElement(ink_1.Newline, null),
|
|
69
|
-
react_1.default.createElement(ink_1.Newline, null),
|
|
70
|
-
react_1.default.createElement(ink_1.Text, null, error?.message)));
|
|
71
|
-
}
|
|
72
|
-
exports.ShowAsyncStatus = ShowAsyncStatus;
|
|
73
|
-
// render(<TaskStatus status="failed" text="Loading..." />);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,195 +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 lodash_1 = require("lodash");
|
|
27
|
-
const nock_1 = __importDefault(require("nock"));
|
|
28
|
-
const runSequentially_1 = require("./runSequentially");
|
|
29
|
-
const childProcess = __importStar(require("./services/child-process-promisified"));
|
|
30
|
-
const nockHelpers_1 = require("./test/nockHelpers");
|
|
31
|
-
jest.mock('./services/child-process-promisified', () => {
|
|
32
|
-
return {
|
|
33
|
-
exec: jest.fn(async (cmd) => {
|
|
34
|
-
throw new Error(`Mock required for exec with cmd: "${cmd}"`);
|
|
35
|
-
}),
|
|
36
|
-
execAsCallback: jest.fn((...args) => {
|
|
37
|
-
(0, lodash_1.last)(args)();
|
|
38
|
-
return {
|
|
39
|
-
stderr: {
|
|
40
|
-
on: () => null,
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
}),
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
describe('runSequentially', () => {
|
|
47
|
-
let rpcExecMock;
|
|
48
|
-
let rpcExecOriginalMock;
|
|
49
|
-
let res;
|
|
50
|
-
let createPullRequestCalls;
|
|
51
|
-
afterEach(() => {
|
|
52
|
-
jest.clearAllMocks();
|
|
53
|
-
nock_1.default.cleanAll();
|
|
54
|
-
});
|
|
55
|
-
beforeEach(async () => {
|
|
56
|
-
jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
|
|
57
|
-
const options = {
|
|
58
|
-
accessToken: 'myAccessToken',
|
|
59
|
-
assignees: [],
|
|
60
|
-
authenticatedUsername: 'sqren_authenticated',
|
|
61
|
-
author: 'sqren',
|
|
62
|
-
autoAssign: false,
|
|
63
|
-
autoFixConflicts: undefined,
|
|
64
|
-
autoMerge: false,
|
|
65
|
-
autoMergeMethod: 'merge',
|
|
66
|
-
backportBinary: 'node scripts/backport',
|
|
67
|
-
branchLabelMapping: undefined,
|
|
68
|
-
cherrypickRef: true,
|
|
69
|
-
ci: false,
|
|
70
|
-
commitPaths: [],
|
|
71
|
-
dateSince: null,
|
|
72
|
-
dateUntil: null,
|
|
73
|
-
details: false,
|
|
74
|
-
editor: 'code',
|
|
75
|
-
fork: true,
|
|
76
|
-
gitHostname: 'github.com',
|
|
77
|
-
githubApiBaseUrlV3: 'https://api.github.com',
|
|
78
|
-
githubApiBaseUrlV4: 'http://localhost/graphql',
|
|
79
|
-
historicalBranchLabelMappings: [],
|
|
80
|
-
mainline: undefined,
|
|
81
|
-
maxNumber: 10,
|
|
82
|
-
multipleBranches: false,
|
|
83
|
-
multipleCommits: false,
|
|
84
|
-
noVerify: true,
|
|
85
|
-
prFilter: undefined,
|
|
86
|
-
publishStatusComment: true,
|
|
87
|
-
pullNumber: undefined,
|
|
88
|
-
repoName: 'kibana',
|
|
89
|
-
repoOwner: 'elastic',
|
|
90
|
-
resetAuthor: false,
|
|
91
|
-
reviewers: [],
|
|
92
|
-
sha: undefined,
|
|
93
|
-
skipRemoteConfig: undefined,
|
|
94
|
-
sourceBranch: 'my-source-branch-from-options',
|
|
95
|
-
sourcePRLabels: [],
|
|
96
|
-
targetBranches: [],
|
|
97
|
-
targetBranchChoices: [
|
|
98
|
-
{ name: '6.x' },
|
|
99
|
-
{ name: '6.0' },
|
|
100
|
-
{ name: '5.6' },
|
|
101
|
-
{ name: '5.5' },
|
|
102
|
-
{ name: '5.4' },
|
|
103
|
-
],
|
|
104
|
-
targetPRLabels: [],
|
|
105
|
-
verbose: false,
|
|
106
|
-
};
|
|
107
|
-
rpcExecMock = jest
|
|
108
|
-
.spyOn(childProcess, 'exec')
|
|
109
|
-
.mockResolvedValue({ stdout: 'success', stderr: '' });
|
|
110
|
-
rpcExecOriginalMock = jest.spyOn(childProcess, 'execAsCallback');
|
|
111
|
-
const scope = (0, nock_1.default)('https://api.github.com')
|
|
112
|
-
.post('/repos/elastic/kibana/pulls')
|
|
113
|
-
.reply(200, {
|
|
114
|
-
number: 1337,
|
|
115
|
-
html_url: 'myHtmlUrl',
|
|
116
|
-
});
|
|
117
|
-
createPullRequestCalls = (0, nockHelpers_1.listenForCallsToNockScope)(scope);
|
|
118
|
-
const commits = [
|
|
119
|
-
{
|
|
120
|
-
sha: 'abcd',
|
|
121
|
-
committedDate: '1',
|
|
122
|
-
expectedTargetPullRequests: [],
|
|
123
|
-
originalMessage: 'My commit message',
|
|
124
|
-
sourceBranch: 'master',
|
|
125
|
-
pullNumber: 55,
|
|
126
|
-
},
|
|
127
|
-
];
|
|
128
|
-
const targetBranches = ['7.x'];
|
|
129
|
-
res = await (0, runSequentially_1.runSequentially)({ options, commits, targetBranches });
|
|
130
|
-
scope.done();
|
|
131
|
-
});
|
|
132
|
-
it('returns pull request', () => {
|
|
133
|
-
expect(res).toEqual([
|
|
134
|
-
{
|
|
135
|
-
didUpdate: false,
|
|
136
|
-
pullRequestNumber: 1337,
|
|
137
|
-
pullRequestUrl: 'myHtmlUrl',
|
|
138
|
-
status: 'success',
|
|
139
|
-
targetBranch: '7.x',
|
|
140
|
-
},
|
|
141
|
-
]);
|
|
142
|
-
});
|
|
143
|
-
it('creates pull request', () => {
|
|
144
|
-
expect(createPullRequestCalls).toMatchInlineSnapshot(`
|
|
145
|
-
Array [
|
|
146
|
-
Object {
|
|
147
|
-
"base": "7.x",
|
|
148
|
-
"body": "# Backport
|
|
149
|
-
|
|
150
|
-
This is an automatic backport to \`7.x\` of:
|
|
151
|
-
- #55
|
|
152
|
-
|
|
153
|
-
### Questions ?
|
|
154
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
155
|
-
"head": "sqren_authenticated:backport/7.x/pr-55",
|
|
156
|
-
"title": "[7.x] My commit message",
|
|
157
|
-
},
|
|
158
|
-
]
|
|
159
|
-
`);
|
|
160
|
-
});
|
|
161
|
-
it('should run all commands in the correct directory', () => {
|
|
162
|
-
expect(rpcExecMock.mock.calls.every(
|
|
163
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
164
|
-
([cmd, opts]) => opts.cwd === '/myHomeDir/.backport/repositories/elastic/kibana')).toBe(true);
|
|
165
|
-
});
|
|
166
|
-
it('exec should be called with correct args', () => {
|
|
167
|
-
expect(rpcExecMock).toHaveBeenCalledTimes(10);
|
|
168
|
-
expect(rpcExecMock.mock.calls.map(([cmd]) => cmd)).toEqual([
|
|
169
|
-
'git remote rm origin',
|
|
170
|
-
'git remote rm sqren_authenticated',
|
|
171
|
-
'git remote add sqren_authenticated https://x-access-token:myAccessToken@github.com/sqren_authenticated/kibana.git',
|
|
172
|
-
'git remote rm elastic',
|
|
173
|
-
'git remote add elastic https://x-access-token:myAccessToken@github.com/elastic/kibana.git',
|
|
174
|
-
'git reset --hard && git clean -d --force && git fetch elastic 7.x && git checkout -B backport/7.x/pr-55 elastic/7.x --no-track',
|
|
175
|
-
'git fetch elastic master:master --force',
|
|
176
|
-
'git cherry-pick -x abcd',
|
|
177
|
-
'git push sqren_authenticated backport/7.x/pr-55:backport/7.x/pr-55 --force',
|
|
178
|
-
'git reset --hard && git checkout my-source-branch-from-options && git branch -D backport/7.x/pr-55',
|
|
179
|
-
]);
|
|
180
|
-
});
|
|
181
|
-
it('git clone should be called with correct args', () => {
|
|
182
|
-
expect(rpcExecOriginalMock).toHaveBeenCalledTimes(1);
|
|
183
|
-
expect(rpcExecOriginalMock.mock.calls).toMatchInlineSnapshot(`
|
|
184
|
-
Array [
|
|
185
|
-
Array [
|
|
186
|
-
"git clone https://x-access-token:myAccessToken@github.com/elastic/kibana.git /myHomeDir/.backport/repositories/elastic/kibana --progress",
|
|
187
|
-
Object {
|
|
188
|
-
"maxBuffer": 104857600,
|
|
189
|
-
},
|
|
190
|
-
[Function],
|
|
191
|
-
],
|
|
192
|
-
]
|
|
193
|
-
`);
|
|
194
|
-
});
|
|
195
|
-
});
|
package/dist/runWithOptions.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ValidConfigOptions } from './options/options';
|
|
2
|
-
export declare type Result = {
|
|
3
|
-
success: boolean;
|
|
4
|
-
targetBranch: string;
|
|
5
|
-
pullRequestUrl?: string;
|
|
6
|
-
errorMessage?: string;
|
|
7
|
-
error?: Error;
|
|
8
|
-
};
|
|
9
|
-
export declare function runWithOptions(options: ValidConfigOptions): Promise<Result[]>;
|
package/dist/runWithOptions.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runWithOptions = void 0;
|
|
4
|
-
const HandledError_1 = require("./services/HandledError");
|
|
5
|
-
const logger_1 = require("./services/logger");
|
|
6
|
-
const sequentially_1 = require("./services/sequentially");
|
|
7
|
-
const cherrypickAndCreateTargetPullRequest_1 = require("./ui/cherrypickAndCreateTargetPullRequest");
|
|
8
|
-
const getCommits_1 = require("./ui/getCommits");
|
|
9
|
-
const getTargetBranches_1 = require("./ui/getTargetBranches");
|
|
10
|
-
const maybeSetupRepo_1 = require("./ui/maybeSetupRepo");
|
|
11
|
-
async function runWithOptions(options) {
|
|
12
|
-
logger_1.logger.verbose('Backport options', options);
|
|
13
|
-
const commits = await (0, getCommits_1.getCommits)(options);
|
|
14
|
-
const targetBranches = await (0, getTargetBranches_1.getTargetBranches)(options, commits);
|
|
15
|
-
await (0, maybeSetupRepo_1.maybeSetupRepo)(options);
|
|
16
|
-
const results = [];
|
|
17
|
-
await (0, sequentially_1.sequentially)(targetBranches, async (targetBranch) => {
|
|
18
|
-
logger_1.logger.info(`Backporting ${JSON.stringify(commits)} to ${targetBranch}`);
|
|
19
|
-
try {
|
|
20
|
-
const pullRequest = await (0, cherrypickAndCreateTargetPullRequest_1.cherrypickAndCreateTargetPullRequest)({
|
|
21
|
-
options,
|
|
22
|
-
commits,
|
|
23
|
-
targetBranch,
|
|
24
|
-
});
|
|
25
|
-
results.push({
|
|
26
|
-
targetBranch,
|
|
27
|
-
success: true,
|
|
28
|
-
pullRequestUrl: pullRequest.url,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
const isHandledError = e instanceof HandledError_1.HandledError;
|
|
33
|
-
const errorMessage = isHandledError
|
|
34
|
-
? (0, logger_1.redact)(e.message)
|
|
35
|
-
: 'An unhandled error occurred. Please consult the logs';
|
|
36
|
-
results.push({ targetBranch, success: false, errorMessage, error: e });
|
|
37
|
-
(0, logger_1.consoleLog)(errorMessage);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
// return the results for consumers to programatically read
|
|
41
|
-
return results;
|
|
42
|
-
}
|
|
43
|
-
exports.runWithOptions = runWithOptions;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|