backport 6.2.1 → 6.3.0-beta-4
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 +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 +278 -0
- 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.js +1 -1
- package/dist/options/ConfigOptions.d.ts +5 -2
- package/dist/options/cliArgs.d.ts +1 -0
- package/dist/options/cliArgs.js +27 -6
- package/dist/options/cliArgs.test.js +28 -10
- package/dist/options/config/config.d.ts +4 -7
- package/dist/options/config/config.js +2 -7
- package/dist/options/config/config.test.js +5 -21
- package/dist/options/config/globalConfig.js +3 -3
- package/dist/options/config/globalConfig.test.js +10 -29
- package/dist/options/config/projectConfig.test.js +7 -26
- package/dist/options/config/readConfigFile.d.ts +4 -7
- package/dist/options/config/readConfigFile.js +2 -2
- package/dist/options/options.d.ts +6 -34
- package/dist/options/options.js +37 -29
- package/dist/options/options.test.js +53 -22
- package/dist/runSequentially.d.ts +0 -1
- package/dist/runSequentially.js +1 -1
- package/dist/runSequentially.test.js +35 -12
- 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.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 +8 -5
- package/dist/services/github/v3/createPullRequest.test.js +204 -39
- 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/fetchAuthorId.private.test.js +2 -2
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +38 -20
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +19 -10
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +3 -3
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +25 -16
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +2 -2
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +6 -6
- 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 +33 -16
- package/dist/services/github/v4/fetchExistingPullRequest.d.ts +0 -4
- package/dist/services/github/v4/fetchExistingPullRequest.js +1 -2
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +2 -2
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.d.ts +0 -9
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +2 -2
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +6 -8
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +49 -41
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +7 -1
- 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 +9 -18
- package/dist/services/logger.js +20 -56
- 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} +134 -112
- 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.d.ts +2 -1
- package/dist/test/private/getDevAccessToken.js +6 -18
- 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 +47 -19
- 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 +24 -19
- package/yarn.lock +119 -147
- 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 -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/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
|
@@ -22,11 +22,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
const promises_1 = require("fs/promises");
|
|
25
26
|
const os_1 = __importDefault(require("os"));
|
|
26
27
|
const del_1 = __importDefault(require("del"));
|
|
27
28
|
const childProcess = __importStar(require("../services/child-process-promisified"));
|
|
28
|
-
const
|
|
29
|
+
const git = __importStar(require("../services/git"));
|
|
30
|
+
const mocks_1 = require("../test/mocks");
|
|
29
31
|
const maybeSetupRepo_1 = require("./maybeSetupRepo");
|
|
32
|
+
const fs = { stat: promises_1.stat };
|
|
30
33
|
describe('maybeSetupRepo', () => {
|
|
31
34
|
let execSpy;
|
|
32
35
|
beforeEach(() => {
|
|
@@ -35,38 +38,110 @@ describe('maybeSetupRepo', () => {
|
|
|
35
38
|
.spyOn(childProcess, 'exec')
|
|
36
39
|
.mockResolvedValue({ stderr: '', stdout: '' });
|
|
37
40
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
afterEach(() => {
|
|
42
|
+
jest.restoreAllMocks();
|
|
43
|
+
});
|
|
44
|
+
describe('if an error occurs while cloning', () => {
|
|
45
|
+
it('should delete repo', async () => {
|
|
46
|
+
expect.assertions(2);
|
|
47
|
+
execSpy = jest
|
|
48
|
+
.spyOn(childProcess, 'execAsCallback')
|
|
49
|
+
.mockImplementation((cmd) => {
|
|
50
|
+
if (cmd.startsWith('git clone')) {
|
|
51
|
+
throw new Error('Simulated git clone failure');
|
|
52
|
+
}
|
|
53
|
+
throw new Error('unknown error');
|
|
54
|
+
});
|
|
55
|
+
await expect((0, maybeSetupRepo_1.maybeSetupRepo)({
|
|
56
|
+
repoName: 'kibana',
|
|
57
|
+
repoOwner: 'elastic',
|
|
58
|
+
})).rejects.toThrowError('Simulated git clone failure');
|
|
59
|
+
expect(del_1.default).toHaveBeenCalledWith('/myHomeDir/.backport/repositories/elastic/kibana');
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
describe('while cloning the repo', () => {
|
|
63
|
+
it('updates the progress', async () => {
|
|
64
|
+
let onCloneComplete;
|
|
65
|
+
let dataHandler;
|
|
66
|
+
const oraMock = (0, mocks_1.getOraMock)();
|
|
67
|
+
const spinnerTextSpy = jest.spyOn(oraMock, 'text', 'set');
|
|
68
|
+
const spinnerSuccessSpy = jest.spyOn(oraMock, 'succeed');
|
|
69
|
+
jest
|
|
70
|
+
.spyOn(git, 'getSourceRepoPath')
|
|
71
|
+
.mockResolvedValue('/path/to/source/repo');
|
|
72
|
+
jest
|
|
73
|
+
.spyOn(childProcess, 'execAsCallback')
|
|
74
|
+
//@ts-expect-error
|
|
75
|
+
.mockImplementation((cmdString, cmdOptions, onComplete) => {
|
|
76
|
+
// callback should be called to finalize the operation
|
|
77
|
+
if (onComplete) {
|
|
78
|
+
//@ts-expect-error
|
|
79
|
+
onCloneComplete = onComplete;
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
stderr: {
|
|
83
|
+
on: (name, handler) => {
|
|
84
|
+
dataHandler = handler;
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
setTimeout(() => {
|
|
90
|
+
dataHandler('Receiving objects: 1%');
|
|
91
|
+
dataHandler('Receiving objects: 10%');
|
|
92
|
+
dataHandler('Receiving objects: 20%');
|
|
93
|
+
dataHandler('Receiving objects: 100%');
|
|
94
|
+
dataHandler('Updating files: 1%');
|
|
95
|
+
dataHandler('Updating files: 10%');
|
|
96
|
+
dataHandler('Updating files: 20%');
|
|
97
|
+
dataHandler('Updating files: 100%');
|
|
98
|
+
onCloneComplete();
|
|
99
|
+
}, 50);
|
|
100
|
+
await (0, maybeSetupRepo_1.maybeSetupRepo)({
|
|
101
|
+
repoName: 'kibana',
|
|
102
|
+
repoOwner: 'elastic',
|
|
103
|
+
});
|
|
104
|
+
expect(spinnerTextSpy.mock.calls.map((call) => call[0]))
|
|
105
|
+
.toMatchInlineSnapshot(`
|
|
106
|
+
Array [
|
|
107
|
+
"0% Cloning repository from /path/to/source/repo (one-time operation)",
|
|
108
|
+
"1% Cloning repository from /path/to/source/repo (one-time operation)",
|
|
109
|
+
"9% Cloning repository from /path/to/source/repo (one-time operation)",
|
|
110
|
+
"18% Cloning repository from /path/to/source/repo (one-time operation)",
|
|
111
|
+
"90% Cloning repository from /path/to/source/repo (one-time operation)",
|
|
112
|
+
"90% Cloning repository from /path/to/source/repo (one-time operation)",
|
|
113
|
+
"91% Cloning repository from /path/to/source/repo (one-time operation)",
|
|
114
|
+
"92% Cloning repository from /path/to/source/repo (one-time operation)",
|
|
115
|
+
"100% Cloning repository from /path/to/source/repo (one-time operation)",
|
|
116
|
+
]
|
|
117
|
+
`);
|
|
118
|
+
expect(spinnerSuccessSpy).toHaveBeenCalledWith('100% Cloning repository from /path/to/source/repo (one-time operation)');
|
|
47
119
|
});
|
|
48
|
-
await expect((0, maybeSetupRepo_1.maybeSetupRepo)({
|
|
49
|
-
accessToken: 'myAccessToken',
|
|
50
|
-
gitHostname: 'github.com',
|
|
51
|
-
repoName: 'kibana',
|
|
52
|
-
repoOwner: 'elastic',
|
|
53
|
-
})).rejects.toThrowError('Simulated git clone failure');
|
|
54
|
-
expect(del_1.default).toHaveBeenCalledWith('/myHomeDir/.backport/repositories/elastic/kibana');
|
|
55
120
|
});
|
|
56
121
|
describe('if repo already exists', () => {
|
|
57
122
|
beforeEach(() => {
|
|
58
123
|
// @ts-expect-error
|
|
59
124
|
jest.spyOn(fs, 'stat').mockResolvedValue({ isDirectory: () => true });
|
|
125
|
+
jest
|
|
126
|
+
.spyOn(childProcess, 'execAsCallback')
|
|
127
|
+
//@ts-expect-error
|
|
128
|
+
.mockImplementation((cmdString, cmdOptions, callback) => {
|
|
129
|
+
//@ts-expect-error
|
|
130
|
+
callback();
|
|
131
|
+
return {
|
|
132
|
+
stderr: { on: () => null },
|
|
133
|
+
};
|
|
134
|
+
});
|
|
60
135
|
});
|
|
61
136
|
it('should re-create remotes for both source repo and fork', async () => {
|
|
62
137
|
await (0, maybeSetupRepo_1.maybeSetupRepo)({
|
|
63
138
|
accessToken: 'myAccessToken',
|
|
64
139
|
authenticatedUsername: 'sqren_authenticated',
|
|
65
|
-
gitHostname: 'github.com',
|
|
66
140
|
repoName: 'kibana',
|
|
67
141
|
repoOwner: 'elastic',
|
|
68
142
|
});
|
|
69
143
|
expect(execSpy.mock.calls.map(([cmd]) => cmd)).toEqual([
|
|
144
|
+
'git remote --verbose',
|
|
70
145
|
'git remote rm origin',
|
|
71
146
|
'git remote rm sqren_authenticated',
|
|
72
147
|
'git remote add sqren_authenticated https://x-access-token:myAccessToken@github.com/sqren_authenticated/kibana.git',
|
|
@@ -75,4 +150,55 @@ describe('maybeSetupRepo', () => {
|
|
|
75
150
|
]);
|
|
76
151
|
});
|
|
77
152
|
});
|
|
153
|
+
describe('if repo does not exists locally', () => {
|
|
154
|
+
beforeEach(() => {
|
|
155
|
+
// @ts-expect-error
|
|
156
|
+
jest.spyOn(fs, 'stat').mockResolvedValue({ isDirectory: () => true });
|
|
157
|
+
jest
|
|
158
|
+
.spyOn(childProcess, 'execAsCallback')
|
|
159
|
+
//@ts-expect-error
|
|
160
|
+
.mockImplementation((cmdString, cmdOptions, callback) => {
|
|
161
|
+
//@ts-expect-error
|
|
162
|
+
callback();
|
|
163
|
+
return {
|
|
164
|
+
stderr: { on: () => null },
|
|
165
|
+
};
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
it('should clone it from github.com', async () => {
|
|
169
|
+
await (0, maybeSetupRepo_1.maybeSetupRepo)({
|
|
170
|
+
accessToken: 'myAccessToken',
|
|
171
|
+
gitHostname: 'github.com',
|
|
172
|
+
repoName: 'kibana',
|
|
173
|
+
repoOwner: 'elastic',
|
|
174
|
+
});
|
|
175
|
+
expect(childProcess.execAsCallback).toHaveBeenCalledWith('git clone https://x-access-token:myAccessToken@github.com/elastic/kibana.git /myHomeDir/.backport/repositories/elastic/kibana --progress', expect.any(Object), expect.any(Function));
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
describe('if repo does exist locally', () => {
|
|
179
|
+
beforeEach(() => {
|
|
180
|
+
// @ts-expect-error
|
|
181
|
+
jest.spyOn(fs, 'stat').mockResolvedValue({ isDirectory: () => true });
|
|
182
|
+
jest
|
|
183
|
+
.spyOn(git, 'getSourceRepoPath')
|
|
184
|
+
.mockResolvedValue('/path/to/source/repo');
|
|
185
|
+
jest
|
|
186
|
+
.spyOn(childProcess, 'execAsCallback')
|
|
187
|
+
//@ts-expect-error
|
|
188
|
+
.mockImplementation((cmdString, cmdOptions, callback) => {
|
|
189
|
+
//@ts-expect-error
|
|
190
|
+
callback();
|
|
191
|
+
return {
|
|
192
|
+
stderr: { on: () => null },
|
|
193
|
+
};
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
it('should clone it from local folder', async () => {
|
|
197
|
+
await (0, maybeSetupRepo_1.maybeSetupRepo)({
|
|
198
|
+
repoName: 'kibana',
|
|
199
|
+
repoOwner: 'elastic',
|
|
200
|
+
});
|
|
201
|
+
expect(childProcess.execAsCallback).toHaveBeenCalledWith('git clone /path/to/source/repo /myHomeDir/.backport/repositories/elastic/kibana --progress', expect.any(Object), expect.any(Function));
|
|
202
|
+
});
|
|
203
|
+
});
|
|
78
204
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function maybe<T>(value: T): T | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PACKAGE_VERSION = "6.3.0-beta-3";
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"branches",
|
|
15
15
|
"branching"
|
|
16
16
|
],
|
|
17
|
-
"version": "6.
|
|
17
|
+
"version": "6.3.0-beta-4",
|
|
18
18
|
"main": "./dist/entrypoint.module.js",
|
|
19
19
|
"types": "dist/entrypoint.module.d.ts",
|
|
20
20
|
"bin": {
|
|
@@ -22,14 +22,18 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"scripts": {
|
|
25
|
-
"lint": "tsc --project ./tsconfig.test.json && eslint './**/*.{ts,js}'",
|
|
26
|
-
"prepare": "husky install",
|
|
27
25
|
"postinstall": "test -f ./dist/scripts/runPostinstall.js && node ./dist/scripts/runPostinstall.js || echo 'Dist folder missing'",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
26
|
+
"postversion": "yarn extractPackageVersion && yarn build",
|
|
27
|
+
"prepare": "husky install",
|
|
28
|
+
"prepublishOnly": "yarn build",
|
|
29
|
+
"build": "tsc --project ./tsconfig.prod.json",
|
|
30
|
+
"extractPackageVersion": "node -p \"'export const PACKAGE_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" | prettier > src/utils/packageVersion.ts",
|
|
31
|
+
"lint": "tsc --project ./tsconfig.test.json && eslint './**/*.{ts,js}'",
|
|
32
|
+
"start": "ts-node --transpile-only ./src/entrypoint.cli.ts",
|
|
31
33
|
"test-all": "yarn lint && jest --config ./jest.config.all.js",
|
|
32
|
-
"
|
|
34
|
+
"test-mutation": "jest --config ./jest.config.mutation.js",
|
|
35
|
+
"test-private": "jest --config ./jest.config.private.js",
|
|
36
|
+
"test": "jest"
|
|
33
37
|
},
|
|
34
38
|
"lint-staged": {
|
|
35
39
|
"*.ts": [
|
|
@@ -59,10 +63,12 @@
|
|
|
59
63
|
},
|
|
60
64
|
"dependencies": {
|
|
61
65
|
"@octokit/rest": "^18.12.0",
|
|
62
|
-
"axios": "^0.
|
|
66
|
+
"axios": "^0.25.0",
|
|
63
67
|
"dedent": "^0.7.0",
|
|
64
68
|
"del": "^6.0.0",
|
|
69
|
+
"dotenv": "^16.0.0",
|
|
65
70
|
"find-up": "^5.0.0",
|
|
71
|
+
"graphql-tag": "^2.12.6",
|
|
66
72
|
"inquirer": "^8.2.0",
|
|
67
73
|
"lodash": "^4.17.21",
|
|
68
74
|
"make-dir": "^3.1.0",
|
|
@@ -71,38 +77,37 @@
|
|
|
71
77
|
"strip-json-comments": "^3.1.1",
|
|
72
78
|
"terminal-link": "^2.1.1",
|
|
73
79
|
"utility-types": "^3.10.0",
|
|
74
|
-
"winston": "^3.
|
|
80
|
+
"winston": "^3.5.1",
|
|
75
81
|
"yargs": "^17.3.1"
|
|
76
82
|
},
|
|
77
83
|
"devDependencies": {
|
|
78
84
|
"@types/core-js": "^2.5.5",
|
|
79
85
|
"@types/dedent": "^0.7.0",
|
|
80
|
-
"@types/inquirer": "^8.
|
|
86
|
+
"@types/inquirer": "^8.2.0",
|
|
81
87
|
"@types/jest": "^27.4.0",
|
|
82
88
|
"@types/lodash": "^4.14.178",
|
|
83
89
|
"@types/node": "^17.0.8",
|
|
84
90
|
"@types/safe-json-stringify": "^1.1.2",
|
|
85
91
|
"@types/yargs": "^17.0.8",
|
|
86
92
|
"@types/yargs-parser": "^20.2.1",
|
|
87
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
88
|
-
"@typescript-eslint/parser": "^5.
|
|
89
|
-
"eslint": "^8.
|
|
93
|
+
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
|
94
|
+
"@typescript-eslint/parser": "^5.10.2",
|
|
95
|
+
"eslint": "^8.8.0",
|
|
90
96
|
"eslint-config-prettier": "^8.3.0",
|
|
91
97
|
"eslint-plugin-import": "^2.25.4",
|
|
92
|
-
"eslint-plugin-jest": "^
|
|
98
|
+
"eslint-plugin-jest": "^26.0.0",
|
|
93
99
|
"eslint-plugin-prettier": "^4.0.0",
|
|
94
|
-
"graphql": "^16.
|
|
100
|
+
"graphql": "^16.3.0",
|
|
95
101
|
"graphql-config": "^4.1.0",
|
|
96
|
-
"graphql-tag": "^2.12.6",
|
|
97
102
|
"husky": "^7.0.4",
|
|
98
103
|
"jest": "^27.4.7",
|
|
99
104
|
"jest-snapshot-serializer-ansi": "^1.0.0",
|
|
100
|
-
"lint-staged": "^12.
|
|
101
|
-
"nock": "^13.2.
|
|
105
|
+
"lint-staged": "^12.3.3",
|
|
106
|
+
"nock": "^13.2.4",
|
|
102
107
|
"prettier": "^2.5.1",
|
|
103
108
|
"strip-ansi": "^6.0.1",
|
|
104
109
|
"ts-jest": "^27.1.3",
|
|
105
110
|
"ts-node": "^10.4.0",
|
|
106
|
-
"typescript": "^4.5.
|
|
111
|
+
"typescript": "^4.5.5"
|
|
107
112
|
}
|
|
108
113
|
}
|