backport 6.2.0 → 6.3.0-beta-3
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 +15 -6
- package/dist/backportRun.d.ts +2 -2
- package/dist/backportRun.js +13 -8
- package/dist/{entrypoint.api.private.test.d.ts → entrypoint.cli.e2e.private.test.d.ts} +0 -0
- package/dist/entrypoint.cli.e2e.private.test.js +277 -0
- package/dist/entrypoint.cli.js +3 -5
- package/dist/{entrypoint.module.private.test.d.ts → entrypoint.cli.private.test.d.ts} +0 -0
- package/dist/{entrypoint.module.private.test.js → entrypoint.cli.private.test.js} +17 -8
- package/dist/entrypoint.module.d.ts +2 -2
- package/dist/entrypoint.module.js +4 -4
- package/dist/options/ConfigOptions.d.ts +7 -3
- package/dist/options/cliArgs.d.ts +16 -14
- package/dist/options/cliArgs.js +31 -5
- package/dist/options/cliArgs.test.js +28 -10
- package/dist/options/config/config.d.ts +11 -11
- package/dist/options/config/config.js +7 -6
- package/dist/options/config/config.test.js +11 -1
- package/dist/options/config/globalConfig.d.ts +1 -1
- package/dist/options/config/globalConfig.js +15 -9
- package/dist/options/config/globalConfig.test.js +17 -30
- package/dist/options/config/projectConfig.d.ts +3 -1
- package/dist/options/config/projectConfig.js +5 -2
- package/dist/options/config/projectConfig.test.js +41 -31
- package/dist/options/config/readConfigFile.d.ts +21 -23
- package/dist/options/config/readConfigFile.js +2 -2
- package/dist/options/options.d.ts +19 -46
- package/dist/options/options.js +40 -32
- package/dist/options/options.test.js +83 -50
- package/dist/runSequentially.d.ts +0 -1
- package/dist/runSequentially.js +1 -1
- package/dist/runSequentially.test.js +37 -18
- package/dist/scripts/postinstall.js +3 -3
- 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/env.d.ts +3 -1
- package/dist/services/env.js +4 -1
- package/dist/services/env.test.js +2 -2
- package/dist/services/git.d.ts +22 -9
- package/dist/services/git.integration.test.js +123 -24
- package/dist/services/git.js +66 -54
- package/dist/services/git.test.js +35 -20
- package/dist/services/github/commitFormatters.d.ts +0 -1
- package/dist/services/github/commitFormatters.js +1 -8
- package/dist/services/github/v3/createPullRequest.js +16 -10
- package/dist/services/github/v3/createPullRequest.test.js +248 -33
- package/dist/services/github/v3/createStatusComment.d.ts +1 -1
- package/dist/services/github/v3/createStatusComment.js +26 -15
- package/dist/services/github/v3/createStatusComment.test.js +132 -72
- package/dist/services/github/v3/getGithubV3ErrorMessage.d.ts +2 -1
- package/dist/{options/getValidatedOptions.test.d.ts → services/github/v3/index.d.ts} +0 -0
- package/dist/services/github/v3/index.js +61 -0
- 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 +46 -28
- package/dist/services/github/v4/apiRequestV4.test.js +4 -4
- 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/allFetchers.private.test.js +37 -19
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +17 -8
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +3 -3
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +23 -14
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +2 -2
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +4 -4
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +41 -19
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +1 -8
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +31 -14
- 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 +7 -9
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +48 -40
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +6 -0
- package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +15 -23
- package/dist/services/github/v4/getOptionsFromGithub/query.js +17 -25
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +29 -0
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.js +56 -0
- package/dist/{options/parseRequiredOptions.test.d.ts → services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.d.ts} +0 -0
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +71 -0
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +11 -11
- package/dist/services/github/v4/throwOnInvalidAccessToken.d.ts +4 -5
- package/dist/services/github/v4/throwOnInvalidAccessToken.js +10 -7
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +5 -5
- package/dist/services/logger.d.ts +11 -17
- package/dist/services/logger.js +29 -66
- package/dist/services/prompt.test.js +66 -19
- 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/services/sourceCommit/parseSourceCommit.test.js +18 -20
- package/dist/{runWithOptions.test.d.ts → test/backport-e2e.mutation.test.d.ts} +0 -0
- package/dist/test/{backport-e2e.private.test.js → backport-e2e.mutation.test.js} +136 -116
- package/dist/test/handleUnbackportedPullRequests.private.test.js +26 -12
- package/dist/test/mockConfigFiles.js +4 -20
- package/dist/test/mocks.d.ts +10 -0
- package/dist/test/mocks.js +23 -0
- package/dist/test/private/getDevAccessToken.js +5 -4
- package/dist/test/sandbox.d.ts +5 -0
- package/dist/{react-components/0-loadOptions.js → test/sandbox.js} +18 -20
- package/dist/test/setupFiles/automatic-mocks.d.ts +1 -0
- package/dist/test/setupFiles/automatic-mocks.js +27 -11
- package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +0 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +12 -13
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +50 -27
- package/dist/ui/getCommits.js +8 -14
- package/dist/ui/getCommitsWithoutBackports.js +6 -6
- package/dist/ui/getCommitsWithoutBackports.test.js +91 -39
- package/dist/ui/getTargetBranches.js +1 -1
- package/dist/ui/getTargetBranches.test.js +26 -8
- package/dist/ui/maybeSetupRepo.js +25 -5
- package/dist/ui/maybeSetupRepo.test.js +144 -18
- 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 +26 -21
- package/yarn.lock +165 -237
- package/dist/entrypoint.api.d.ts +0 -22
- package/dist/entrypoint.api.js +0 -57
- package/dist/entrypoint.api.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/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/getValidatedOptions.d.ts +0 -49
- package/dist/options/getValidatedOptions.js +0 -45
- package/dist/options/getValidatedOptions.test.js +0 -97
- package/dist/options/parseRequiredOptions.d.ts +0 -71
- package/dist/options/parseRequiredOptions.js +0 -68
- package/dist/options/parseRequiredOptions.test.js +0 -122
- package/dist/react-components/0-loadOptions.d.ts +0 -6
- 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/runWithOptions.d.ts +0 -9
- package/dist/runWithOptions.js +0 -43
- 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/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/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/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/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.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/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/getExistingTargetPullRequests.d.ts +0 -7
- package/dist/services/github/v4/getExistingTargetPullRequests.js +0 -45
- 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/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/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/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/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/backport-e2e.private.test.d.ts +0 -1
- package/dist/test/inquirer.private.test.d.ts +0 -1
- package/dist/test/inquirer.private.test.js +0 -168
- 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/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/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/utils/sequentially.d.ts +0 -1
- package/dist/utils/sequentially.js +0 -10
package/README.md
CHANGED
|
@@ -76,6 +76,7 @@ See [configuration.md](https://github.com/sqren/backport/blob/master/docs/config
|
|
|
76
76
|
| --auto-assign | | Assign current user to the target PR | false |
|
|
77
77
|
| --branch | -b | Target branch to backport to | |
|
|
78
78
|
| --ci | | Disable interactive prompts | false |
|
|
79
|
+
| --config-file | | Custom path to project config file (.backportrc.json) | |
|
|
79
80
|
| --dir | | Clone repository into custom directory | ~/.backport/repositories/ |
|
|
80
81
|
| --dry-run | | Perform backport without pushing to Github | false |
|
|
81
82
|
| --editor | | Editor (eg. `code`) to open and resolve conflicts | nano |
|
|
@@ -90,7 +91,7 @@ See [configuration.md](https://github.com/sqren/backport/blob/master/docs/config
|
|
|
90
91
|
| --no-status-comment | | Do not publish a status comment to Github with the results of the backport | false |
|
|
91
92
|
| --no-verify | | Bypass the pre-commit and commit-msg hooks | false |
|
|
92
93
|
| --path | -p | Filter commits by path | |
|
|
93
|
-
| --pr-description | --description |
|
|
94
|
+
| --pr-description | --description | Description for pull request | |
|
|
94
95
|
| --pr-filter | | Find PRs using [Github's search syntax][2] | |
|
|
95
96
|
| --pr-title | --title | Title of pull request | |
|
|
96
97
|
| --pull-number | --pr | Backport pull request by number | |
|
|
@@ -200,12 +201,20 @@ console.log(commits);
|
|
|
200
201
|
|
|
201
202
|
/*
|
|
202
203
|
[{
|
|
203
|
-
|
|
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
|
+
},
|
|
204
217
|
sourceBranch: 'main',
|
|
205
|
-
sha: 'd421ddcf6157150596581c7885afa3690cec6339',
|
|
206
|
-
originalMessage: '[APM] Add note about synthtrace to APM docs (#121633)',
|
|
207
|
-
pullNumber: 121633,
|
|
208
|
-
pullUrl: 'https://github.com/elastic/kibana/pull/121633',
|
|
209
218
|
expectedTargetPullRequests: [
|
|
210
219
|
{
|
|
211
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 {
|
|
@@ -38,6 +43,7 @@ async function backportRun(processArgs, optionsFromModule = {}) {
|
|
|
38
43
|
options,
|
|
39
44
|
backportResponse,
|
|
40
45
|
});
|
|
46
|
+
logger_1.logger.info('backportResponse', backportResponse);
|
|
41
47
|
return backportResponse;
|
|
42
48
|
}
|
|
43
49
|
catch (e) {
|
|
@@ -45,7 +51,6 @@ async function backportRun(processArgs, optionsFromModule = {}) {
|
|
|
45
51
|
const backportResponse = {
|
|
46
52
|
status: 'failure',
|
|
47
53
|
commits,
|
|
48
|
-
errorMessage: e.message,
|
|
49
54
|
error: e,
|
|
50
55
|
};
|
|
51
56
|
if (options) {
|
|
@@ -54,21 +59,21 @@ async function backportRun(processArgs, optionsFromModule = {}) {
|
|
|
54
59
|
backportResponse,
|
|
55
60
|
});
|
|
56
61
|
}
|
|
57
|
-
if (e instanceof HandledError_1.HandledError) {
|
|
62
|
+
if (e instanceof HandledError_1.HandledError || e instanceof apiRequestV4_1.GithubV4Exception) {
|
|
58
63
|
(0, logger_1.consoleLog)(e.message);
|
|
59
64
|
}
|
|
60
65
|
else if (e instanceof Error) {
|
|
61
66
|
// output
|
|
62
67
|
(0, logger_1.consoleLog)('\n');
|
|
63
68
|
(0, logger_1.consoleLog)(chalk_1.default.bold('⚠️ Ouch! An unhandled error occured 😿'));
|
|
64
|
-
(0, logger_1.consoleLog)(
|
|
69
|
+
(0, logger_1.consoleLog)(e.stack ? e.stack : e.message);
|
|
65
70
|
(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
71
|
(0, logger_1.consoleLog)(chalk_1.default.italic(`For additional details see the logs: ${(0, env_1.getLogfilePath)({
|
|
67
72
|
logFilePath,
|
|
68
73
|
})}`));
|
|
69
|
-
// log file
|
|
70
|
-
logger_1.logger.info('Unknown error:', e);
|
|
71
74
|
}
|
|
75
|
+
logger_1.logger.error('Unhandled exception', e);
|
|
76
|
+
process.exitCode = 1;
|
|
72
77
|
return backportResponse;
|
|
73
78
|
}
|
|
74
79
|
}
|
|
File without changes
|
|
@@ -0,0 +1,277 @@
|
|
|
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
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
9
|
+
const child_process_promisified_1 = require("./services/child-process-promisified");
|
|
10
|
+
const getDevAccessToken_1 = require("./test/private/getDevAccessToken");
|
|
11
|
+
const sandbox_1 = require("./test/sandbox");
|
|
12
|
+
const TIMEOUT_IN_SECONDS = 10;
|
|
13
|
+
jest.setTimeout(15000);
|
|
14
|
+
describe('inquirer cli', () => {
|
|
15
|
+
let devAccessToken;
|
|
16
|
+
beforeAll(async () => {
|
|
17
|
+
devAccessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
18
|
+
});
|
|
19
|
+
it('--version', async () => {
|
|
20
|
+
const res = await runBackportAsync([`--version`]);
|
|
21
|
+
expect(res).toContain(process.env.npm_package_version);
|
|
22
|
+
});
|
|
23
|
+
it('-v', async () => {
|
|
24
|
+
const res = await runBackportAsync([`-v`]);
|
|
25
|
+
expect(res).toContain(process.env.npm_package_version);
|
|
26
|
+
});
|
|
27
|
+
it('--help', async () => {
|
|
28
|
+
const res = await runBackportAsync([`--help`]);
|
|
29
|
+
expect(res).toMatchInlineSnapshot(`
|
|
30
|
+
"entrypoint.cli.ts [args]
|
|
31
|
+
Options:
|
|
32
|
+
-v, -V, --version Show version number [boolean]
|
|
33
|
+
--accessToken, --accesstoken Github access token [string]
|
|
34
|
+
-a, --all List all commits [boolean]
|
|
35
|
+
--assignee, --assign Add assignees to the target pull request [array]
|
|
36
|
+
--autoAssign Auto assign the target pull request to yourself [boolean]
|
|
37
|
+
--autoMerge Enable auto-merge for created pull requests [boolean]
|
|
38
|
+
--autoMergeMethod Sets auto-merge method when using --auto-merge. Default:
|
|
39
|
+
merge [string] [choices: \\"merge\\", \\"rebase\\", \\"squash\\"]
|
|
40
|
+
--ci Disable interactive prompts [boolean]
|
|
41
|
+
--cherrypickRef Append commit message with \\"(cherry picked from commit...)
|
|
42
|
+
[boolean]
|
|
43
|
+
--configFile, --config Path to project config [string]
|
|
44
|
+
--since ISO-8601 date for filtering commits [string]
|
|
45
|
+
--until ISO-8601 date for filtering commits [string]
|
|
46
|
+
--dir Location where the temporary repository will be stored
|
|
47
|
+
[string]
|
|
48
|
+
--details Show details about each commit [boolean]
|
|
49
|
+
--editor Editor to be opened during conflict resolution [string]
|
|
50
|
+
--skipRemoteConfig Use local .backportrc.json config instead of loading from
|
|
51
|
+
Github [boolean]
|
|
52
|
+
--fork Create backports in fork or origin repo [boolean]
|
|
53
|
+
--mainline Parent id of merge commit. Defaults to 1 when supplied
|
|
54
|
+
without arguments [number]
|
|
55
|
+
-n, --maxNumber, --number Number of commits to choose from [number]
|
|
56
|
+
--multiple Select multiple branches/commits [boolean]
|
|
57
|
+
--multipleBranches Backport to multiple branches [boolean]
|
|
58
|
+
--multipleCommits Backport multiple commits [boolean]
|
|
59
|
+
--noCherrypickRef Do not append commit message with \\"(cherry picked from
|
|
60
|
+
commit...)\\" [boolean]
|
|
61
|
+
--noStatusComment Don't publish status comment to Github [boolean]
|
|
62
|
+
--noVerify Bypass the pre-commit and commit-msg hooks [boolean]
|
|
63
|
+
--noFork Create backports in the origin repo [boolean]
|
|
64
|
+
-p, --path Only list commits touching files under the specified path
|
|
65
|
+
[array]
|
|
66
|
+
--prDescription, --description Description to be added to pull request [string]
|
|
67
|
+
--prTitle, --title Title of pull request [string]
|
|
68
|
+
--prFilter Filter source pull requests by a query [string]
|
|
69
|
+
--pullNumber, --pr Pull request to backport [number]
|
|
70
|
+
--resetAuthor Set yourself as commit author [boolean]
|
|
71
|
+
--reviewer Add reviewer to the target PR [array]
|
|
72
|
+
--repoOwner Repository owner [string]
|
|
73
|
+
--repoName Repository name [string]
|
|
74
|
+
--sha, --commit Commit sha to backport [string]
|
|
75
|
+
--sourceBranch Specify a non-default branch (normally \\"master\\") to backport
|
|
76
|
+
from [string]
|
|
77
|
+
--sourcePRLabel, --sourcePrLabel Add labels to the source (original) PR [array]
|
|
78
|
+
-b, --targetBranch, --branch Branch(es) to backport to [array]
|
|
79
|
+
--targetBranchChoice List branches to backport to [array]
|
|
80
|
+
-l, --targetPRLabel, --label Add labels to the target (backport) PR [array]
|
|
81
|
+
--verbose Show additional debug information [boolean]
|
|
82
|
+
--verify Opposite of no-verify [boolean]
|
|
83
|
+
--help Show help [boolean]
|
|
84
|
+
For bugs, feature requests or questions: https://github.com/sqren/backport/issues
|
|
85
|
+
Or contact me directly: https://twitter.com/sorenlouv"
|
|
86
|
+
`);
|
|
87
|
+
});
|
|
88
|
+
it('should return error when branch is missing', async () => {
|
|
89
|
+
const res = await runBackportAsync([
|
|
90
|
+
'--skip-remote-config',
|
|
91
|
+
'--repo-owner',
|
|
92
|
+
'backport-org',
|
|
93
|
+
'--repo-name',
|
|
94
|
+
'backport-e2e',
|
|
95
|
+
'--accessToken',
|
|
96
|
+
devAccessToken,
|
|
97
|
+
]);
|
|
98
|
+
expect(res).toMatchInlineSnapshot(`
|
|
99
|
+
"Please specify a target branch: \\"--branch 6.1\\".
|
|
100
|
+
Read more: https://github.com/sqren/backport/blob/main/docs/configuration.md#project-config-backportrcjson"
|
|
101
|
+
`);
|
|
102
|
+
});
|
|
103
|
+
it('should list commits based on .git/config when `repoOwner`/`repoName` is missing', async () => {
|
|
104
|
+
const sandboxPath = (0, sandbox_1.getSandboxPath)({ filename: __filename });
|
|
105
|
+
await (0, sandbox_1.resetSandbox)(sandboxPath);
|
|
106
|
+
await (0, child_process_promisified_1.exec)(`git init`, { cwd: sandboxPath });
|
|
107
|
+
await (0, child_process_promisified_1.exec)(`git remote add origin git@github.com:backport-org/backport-e2e.git`, { cwd: sandboxPath });
|
|
108
|
+
const res = await runBackportAsync(['--accessToken', devAccessToken], {
|
|
109
|
+
cwd: sandboxPath,
|
|
110
|
+
waitForString: 'Select commit',
|
|
111
|
+
});
|
|
112
|
+
expect(res).toMatchInlineSnapshot(`
|
|
113
|
+
"? Select commit (Use arrow keys)
|
|
114
|
+
❯ 1. Add sheep emoji (#9) 7.8
|
|
115
|
+
2. Change Ulysses to Gretha (conflict) (#8) 7.x
|
|
116
|
+
3. Add 🍏 emoji (#5) 7.x, 7.8
|
|
117
|
+
4. Add family emoji (#2) 7.x
|
|
118
|
+
5. Add \`backport\` dep
|
|
119
|
+
6. Merge pull request #1 from backport-org/add-heart-emoji
|
|
120
|
+
7. Add ❤️ emoji
|
|
121
|
+
8. Update .backportrc.json
|
|
122
|
+
9. Bump to 8.0.0
|
|
123
|
+
10.Add package.json"
|
|
124
|
+
`);
|
|
125
|
+
});
|
|
126
|
+
it('should return error when access token is invalid', async () => {
|
|
127
|
+
const res = await runBackportAsync([
|
|
128
|
+
'--branch',
|
|
129
|
+
'foo',
|
|
130
|
+
'--repo-owner',
|
|
131
|
+
'foo',
|
|
132
|
+
'--repo-name',
|
|
133
|
+
'bar',
|
|
134
|
+
'--accessToken',
|
|
135
|
+
'some-token',
|
|
136
|
+
]);
|
|
137
|
+
expect(res).toContain('Please check your access token and make sure it is valid');
|
|
138
|
+
});
|
|
139
|
+
it(`should return error when repo doesn't exist`, async () => {
|
|
140
|
+
const res = await runBackportAsync([
|
|
141
|
+
'--branch',
|
|
142
|
+
'foo',
|
|
143
|
+
'--repo-owner',
|
|
144
|
+
'foo',
|
|
145
|
+
'--repo-name',
|
|
146
|
+
'bar',
|
|
147
|
+
'--author',
|
|
148
|
+
'sqren',
|
|
149
|
+
'--accessToken',
|
|
150
|
+
devAccessToken,
|
|
151
|
+
]);
|
|
152
|
+
expect(res).toMatchInlineSnapshot(`"The repository \\"foo/bar\\" doesn't exist"`);
|
|
153
|
+
});
|
|
154
|
+
it(`should list commits from master`, async () => {
|
|
155
|
+
jest.setTimeout(TIMEOUT_IN_SECONDS * 1000 * 1.1);
|
|
156
|
+
const output = await runBackportAsync([
|
|
157
|
+
'--branch',
|
|
158
|
+
'foo',
|
|
159
|
+
'--repo-owner',
|
|
160
|
+
'backport-org',
|
|
161
|
+
'--repo-name',
|
|
162
|
+
'backport-e2e',
|
|
163
|
+
'--author',
|
|
164
|
+
'sqren',
|
|
165
|
+
'--accessToken',
|
|
166
|
+
devAccessToken,
|
|
167
|
+
'--max-number',
|
|
168
|
+
'6',
|
|
169
|
+
], { waitForString: 'Select commit' });
|
|
170
|
+
expect(output).toMatchInlineSnapshot(`
|
|
171
|
+
"? Select commit (Use arrow keys)
|
|
172
|
+
❯ 1. Add sheep emoji (#9) 7.8
|
|
173
|
+
2. Change Ulysses to Gretha (conflict) (#8) 7.x
|
|
174
|
+
3. Add 🍏 emoji (#5) 7.x, 7.8
|
|
175
|
+
4. Add family emoji (#2) 7.x
|
|
176
|
+
5. Add \`backport\` dep
|
|
177
|
+
6. Merge pull request #1 from backport-org/add-heart-emoji"
|
|
178
|
+
`);
|
|
179
|
+
});
|
|
180
|
+
it(`should limit commits by since and until`, async () => {
|
|
181
|
+
jest.setTimeout(TIMEOUT_IN_SECONDS * 1000 * 1.1);
|
|
182
|
+
const output = await runBackportAsync([
|
|
183
|
+
'--branch',
|
|
184
|
+
'foo',
|
|
185
|
+
'--repo-owner',
|
|
186
|
+
'backport-org',
|
|
187
|
+
'--repo-name',
|
|
188
|
+
'backport-e2e',
|
|
189
|
+
'--accessToken',
|
|
190
|
+
devAccessToken,
|
|
191
|
+
'--since',
|
|
192
|
+
'2020-08-15T00:00:00.000Z',
|
|
193
|
+
'--until',
|
|
194
|
+
'2020-08-15T14:00:00.000Z',
|
|
195
|
+
], { waitForString: 'Select commit' });
|
|
196
|
+
expect(output).toMatchInlineSnapshot(`
|
|
197
|
+
"? Select commit (Use arrow keys)
|
|
198
|
+
❯ 1. Add 🍏 emoji (#5) 7.x, 7.8
|
|
199
|
+
2. Add family emoji (#2) 7.x
|
|
200
|
+
3. Add \`backport\` dep
|
|
201
|
+
4. Merge pull request #1 from backport-org/add-heart-emoji
|
|
202
|
+
5. Add ❤️ emoji
|
|
203
|
+
6. Update .backportrc.json
|
|
204
|
+
7. Bump to 8.0.0
|
|
205
|
+
8. Add package.json
|
|
206
|
+
9. Update .backportrc.json
|
|
207
|
+
10.Create .backportrc.json"
|
|
208
|
+
`);
|
|
209
|
+
});
|
|
210
|
+
it(`should list commits from 7.x`, async () => {
|
|
211
|
+
const output = await runBackportAsync([
|
|
212
|
+
'--branch',
|
|
213
|
+
'foo',
|
|
214
|
+
'--repo-owner',
|
|
215
|
+
'backport-org',
|
|
216
|
+
'--repo-name',
|
|
217
|
+
'backport-e2e',
|
|
218
|
+
'--author',
|
|
219
|
+
'sqren',
|
|
220
|
+
'--accessToken',
|
|
221
|
+
devAccessToken,
|
|
222
|
+
'--max-number',
|
|
223
|
+
'6',
|
|
224
|
+
'--source-branch',
|
|
225
|
+
'7.x',
|
|
226
|
+
], { waitForString: 'Select commit' });
|
|
227
|
+
expect(output).toMatchInlineSnapshot(`
|
|
228
|
+
"? Select commit (Use arrow keys)
|
|
229
|
+
❯ 1. Add 🍏 emoji (#5) (#6)
|
|
230
|
+
2. Change Ulysses to Carol
|
|
231
|
+
3. Add family emoji (#2) (#4)
|
|
232
|
+
4. Update .backportrc.json
|
|
233
|
+
5. Branch off: 7.9.0 (7.x)
|
|
234
|
+
6. Bump to 8.0.0"
|
|
235
|
+
`);
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
function runBackportAsync(cliArgs, { waitForString, cwd, } = {}) {
|
|
239
|
+
const tsNodeBinary = path_1.default.resolve('./node_modules/.bin/ts-node');
|
|
240
|
+
const entrypointFile = path_1.default.resolve('./src/entrypoint.cli.ts');
|
|
241
|
+
const proc = (0, child_process_1.spawn)(tsNodeBinary, [
|
|
242
|
+
'--transpile-only',
|
|
243
|
+
entrypointFile,
|
|
244
|
+
'--log-file-path',
|
|
245
|
+
'/dev/null',
|
|
246
|
+
...cliArgs,
|
|
247
|
+
], { cwd });
|
|
248
|
+
const p = new Promise((resolve, reject) => {
|
|
249
|
+
let data = '';
|
|
250
|
+
// fail if expectations hasn't been found within 10 seconds
|
|
251
|
+
const timeout = setTimeout(() => {
|
|
252
|
+
reject(`Expectation '${waitForString}' not found within ${TIMEOUT_IN_SECONDS} seconds in:
|
|
253
|
+
'${data.toString()}'`);
|
|
254
|
+
}, TIMEOUT_IN_SECONDS * 1000);
|
|
255
|
+
proc.stdout.on('data', (chunk) => {
|
|
256
|
+
data += chunk;
|
|
257
|
+
const output = data.toString();
|
|
258
|
+
if (!waitForString || output.includes(waitForString)) {
|
|
259
|
+
clearTimeout(timeout);
|
|
260
|
+
// remove ansi codes and whitespace
|
|
261
|
+
const strippedOutput = (0, strip_ansi_1.default)(output).replace(/\s+$/gm, '');
|
|
262
|
+
resolve(strippedOutput);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
// for debugging only
|
|
266
|
+
// proc.stderr.on('data', (chunk) => {
|
|
267
|
+
// console.log('stderr', chunk.toString());
|
|
268
|
+
// });
|
|
269
|
+
proc.on('error', (err) => {
|
|
270
|
+
reject(`runBackportAsync failed with: ${err}`);
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
// kill child process
|
|
274
|
+
return p.finally(() => {
|
|
275
|
+
proc.kill();
|
|
276
|
+
});
|
|
277
|
+
}
|
package/dist/entrypoint.cli.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const args = process.argv.slice(2);
|
|
7
|
-
(0, logger_1.initLogger)();
|
|
4
|
+
const backportRun_1 = require("./backportRun");
|
|
5
|
+
const processArgs = process.argv.slice(2);
|
|
8
6
|
// this is the entrypoint when running from command line
|
|
9
|
-
(0,
|
|
7
|
+
(0, backportRun_1.backportRun)(processArgs);
|
|
File without changes
|
|
@@ -11,9 +11,22 @@ describe('entrypoint.module', () => {
|
|
|
11
11
|
repoOwner: 'backport-org',
|
|
12
12
|
pullNumber: 2,
|
|
13
13
|
});
|
|
14
|
-
|
|
14
|
+
const expectedCommits = [
|
|
15
15
|
{
|
|
16
|
-
|
|
16
|
+
sourceCommit: {
|
|
17
|
+
committedDate: '2020-08-15T10:44:04Z',
|
|
18
|
+
message: 'Add family emoji (#2)',
|
|
19
|
+
sha: '59d6ff1ca90a4ce210c0a4f0e159214875c19d60',
|
|
20
|
+
},
|
|
21
|
+
sourcePullRequest: {
|
|
22
|
+
number: 2,
|
|
23
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/2',
|
|
24
|
+
mergeCommit: {
|
|
25
|
+
message: 'Add family emoji (#2)',
|
|
26
|
+
sha: '59d6ff1ca90a4ce210c0a4f0e159214875c19d60',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
sourceBranch: 'master',
|
|
17
30
|
expectedTargetPullRequests: [
|
|
18
31
|
{
|
|
19
32
|
branch: '7.x',
|
|
@@ -26,12 +39,8 @@ describe('entrypoint.module', () => {
|
|
|
26
39
|
},
|
|
27
40
|
},
|
|
28
41
|
],
|
|
29
|
-
originalMessage: 'Add family emoji (#2)',
|
|
30
|
-
pullNumber: 2,
|
|
31
|
-
pullUrl: 'https://github.com/backport-org/backport-e2e/pull/2',
|
|
32
|
-
sha: '59d6ff1ca90a4ce210c0a4f0e159214875c19d60',
|
|
33
|
-
sourceBranch: 'master',
|
|
34
42
|
},
|
|
35
|
-
]
|
|
43
|
+
];
|
|
44
|
+
expect(commits).toEqual(expectedCommits);
|
|
36
45
|
});
|
|
37
46
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ConfigFileOptions } from './options/ConfigOptions';
|
|
2
2
|
import { ValidConfigOptions } from './options/options';
|
|
3
|
-
export { BackportResponse } from './
|
|
3
|
+
export { BackportResponse } from './backportRun';
|
|
4
4
|
export { ConfigFileOptions } from './options/ConfigOptions';
|
|
5
5
|
export { Commit } from './services/sourceCommit/parseSourceCommit';
|
|
6
6
|
export { fetchRemoteProjectConfig as getRemoteProjectConfig } from './services/github/v4/fetchRemoteProjectConfig';
|
|
7
7
|
export { getGlobalConfig as getLocalGlobalConfig } from './options/config/globalConfig';
|
|
8
|
-
export declare function backportRun(options: ConfigFileOptions,
|
|
8
|
+
export declare function backportRun(options: ConfigFileOptions, processArgs?: string[]): Promise<import("./backportRun").BackportResponse>;
|
|
9
9
|
export declare function getCommits(options: {
|
|
10
10
|
accessToken: string;
|
|
11
11
|
repoName: string;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCommits = exports.backportRun = exports.getLocalGlobalConfig = exports.getRemoteProjectConfig = void 0;
|
|
4
|
-
const
|
|
4
|
+
const backportRun_1 = require("./backportRun");
|
|
5
5
|
const fetchCommitByPullNumber_1 = require("./services/github/v4/fetchCommits/fetchCommitByPullNumber");
|
|
6
6
|
const fetchCommitBySha_1 = require("./services/github/v4/fetchCommits/fetchCommitBySha");
|
|
7
7
|
const fetchCommitsByAuthor_1 = require("./services/github/v4/fetchCommits/fetchCommitsByAuthor");
|
|
8
8
|
const getOptionsFromGithub_1 = require("./services/github/v4/getOptionsFromGithub/getOptionsFromGithub");
|
|
9
9
|
const logger_1 = require("./services/logger");
|
|
10
10
|
const excludeUndefined_1 = require("./utils/excludeUndefined");
|
|
11
|
-
(0, logger_1.initLogger)();
|
|
12
11
|
var fetchRemoteProjectConfig_1 = require("./services/github/v4/fetchRemoteProjectConfig");
|
|
13
12
|
Object.defineProperty(exports, "getRemoteProjectConfig", { enumerable: true, get: function () { return fetchRemoteProjectConfig_1.fetchRemoteProjectConfig; } });
|
|
14
13
|
var globalConfig_1 = require("./options/config/globalConfig");
|
|
@@ -21,11 +20,12 @@ function backportRun(options,
|
|
|
21
20
|
// const args = process.argv.slice(2);
|
|
22
21
|
// backportRun(options, args)
|
|
23
22
|
//
|
|
24
|
-
|
|
25
|
-
return (0,
|
|
23
|
+
processArgs = []) {
|
|
24
|
+
return (0, backportRun_1.backportRun)(processArgs, (0, excludeUndefined_1.excludeUndefined)(options));
|
|
26
25
|
}
|
|
27
26
|
exports.backportRun = backportRun;
|
|
28
27
|
async function getCommits(options) {
|
|
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 [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import winston from 'winston';
|
|
2
2
|
export interface TargetBranchChoice {
|
|
3
3
|
name: string;
|
|
4
4
|
checked?: boolean;
|
|
@@ -7,7 +7,7 @@ export declare type TargetBranchChoiceOrString = string | TargetBranchChoice;
|
|
|
7
7
|
declare type AutoFixConflictsHandler = ({ files, directory, logger, targetBranch, }: {
|
|
8
8
|
files: string[];
|
|
9
9
|
directory: string;
|
|
10
|
-
logger: Logger;
|
|
10
|
+
logger: winston.Logger;
|
|
11
11
|
targetBranch: string;
|
|
12
12
|
}) => boolean | Promise<boolean>;
|
|
13
13
|
declare type Options = Partial<{
|
|
@@ -22,13 +22,15 @@ declare type Options = Partial<{
|
|
|
22
22
|
cherrypickRef: boolean;
|
|
23
23
|
ci: boolean;
|
|
24
24
|
commitPaths: string[];
|
|
25
|
-
|
|
25
|
+
configFile: string;
|
|
26
26
|
details: boolean;
|
|
27
|
+
dir: string;
|
|
27
28
|
editor: string;
|
|
28
29
|
fork: boolean;
|
|
29
30
|
gitHostname: string;
|
|
30
31
|
githubApiBaseUrlV3: string;
|
|
31
32
|
githubApiBaseUrlV4: string;
|
|
33
|
+
logFilePath: string;
|
|
32
34
|
maxNumber: number;
|
|
33
35
|
multiple: boolean;
|
|
34
36
|
multipleBranches: boolean;
|
|
@@ -53,6 +55,8 @@ declare type Options = Partial<{
|
|
|
53
55
|
verbose: boolean;
|
|
54
56
|
}>;
|
|
55
57
|
export declare type ConfigFileOptions = Options & Partial<{
|
|
58
|
+
help: boolean;
|
|
59
|
+
version: boolean;
|
|
56
60
|
branchLabelMapping: Record<string, string>;
|
|
57
61
|
/**
|
|
58
62
|
* @deprecated Replaced by `repoOwner` and `repoName`
|
|
@@ -1,45 +1,47 @@
|
|
|
1
1
|
export declare type OptionsFromCliArgs = ReturnType<typeof getOptionsFromCliArgs>;
|
|
2
|
-
export declare function getOptionsFromCliArgs(
|
|
2
|
+
export declare function getOptionsFromCliArgs(processArgs: readonly string[], { exitOnError }?: {
|
|
3
3
|
exitOnError?: boolean;
|
|
4
4
|
}): {
|
|
5
5
|
fork?: boolean | undefined;
|
|
6
6
|
dir?: string | undefined;
|
|
7
7
|
verbose?: boolean | undefined;
|
|
8
|
-
ci?: boolean | undefined;
|
|
9
8
|
accessToken?: string | undefined;
|
|
10
|
-
assignees?: string[] | undefined;
|
|
11
9
|
author?: string | null | undefined;
|
|
12
10
|
autoAssign?: boolean | undefined;
|
|
11
|
+
assignees?: string[] | undefined;
|
|
13
12
|
autoMerge?: boolean | undefined;
|
|
14
13
|
autoMergeMethod?: string | undefined;
|
|
14
|
+
ci?: boolean | undefined;
|
|
15
15
|
cherrypickRef?: boolean | undefined;
|
|
16
|
-
|
|
16
|
+
configFile?: string | undefined;
|
|
17
17
|
details?: boolean | undefined;
|
|
18
18
|
editor?: string | undefined;
|
|
19
|
+
skipRemoteConfig?: boolean | undefined;
|
|
19
20
|
gitHostname?: string | undefined;
|
|
20
21
|
githubApiBaseUrlV3?: string | undefined;
|
|
21
22
|
githubApiBaseUrlV4?: string | undefined;
|
|
23
|
+
logFilePath?: string | undefined;
|
|
24
|
+
mainline?: number | undefined;
|
|
22
25
|
maxNumber?: number | undefined;
|
|
23
26
|
multipleBranches?: boolean | undefined;
|
|
24
27
|
multipleCommits?: boolean | undefined;
|
|
25
28
|
noVerify?: boolean | undefined;
|
|
26
29
|
prDescription?: string | undefined;
|
|
27
|
-
prFilter?: string | undefined;
|
|
28
30
|
prTitle?: string | undefined;
|
|
29
|
-
|
|
31
|
+
prFilter?: string | undefined;
|
|
30
32
|
pullNumber?: number | undefined;
|
|
31
|
-
repoName?: string | undefined;
|
|
32
|
-
repoOwner?: string | undefined;
|
|
33
|
-
resetAuthor?: boolean | undefined;
|
|
34
|
-
reviewers?: string[] | undefined;
|
|
35
33
|
sha?: string | undefined;
|
|
36
|
-
|
|
34
|
+
resetAuthor?: boolean | undefined;
|
|
35
|
+
repoOwner?: string | undefined;
|
|
36
|
+
repoName?: string | undefined;
|
|
37
37
|
sourceBranch?: string | undefined;
|
|
38
|
+
dateSince?: string | undefined;
|
|
39
|
+
dateUntil?: string | undefined;
|
|
40
|
+
commitPaths?: string[] | undefined;
|
|
41
|
+
reviewers?: string[] | undefined;
|
|
38
42
|
sourcePRLabels?: string[] | undefined;
|
|
39
43
|
targetBranchChoices?: string[] | undefined;
|
|
40
44
|
targetBranches?: string[] | undefined;
|
|
41
45
|
targetPRLabels?: string[] | undefined;
|
|
42
|
-
|
|
43
|
-
dateSince?: string | undefined;
|
|
44
|
-
dateUntil?: string | undefined;
|
|
46
|
+
publishStatusComment?: boolean | undefined;
|
|
45
47
|
};
|