backport 6.1.4 → 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 +53 -42
- package/dist/{main.d.ts → backportRun.d.ts} +3 -3
- package/dist/{main.js → backportRun.js} +24 -9
- package/dist/entrypoint.cli.js +3 -5
- package/dist/entrypoint.module.d.ts +4 -3
- package/dist/entrypoint.module.js +9 -7
- package/dist/options/ConfigOptions.d.ts +6 -0
- package/dist/options/cliArgs.d.ts +17 -13
- package/dist/options/cliArgs.js +25 -6
- package/dist/options/config/config.d.ts +12 -1
- package/dist/options/config/config.js +8 -7
- package/dist/options/config/globalConfig.d.ts +2 -2
- package/dist/options/config/globalConfig.js +18 -16
- package/dist/options/config/projectConfig.d.ts +3 -1
- package/dist/options/config/projectConfig.js +5 -2
- package/dist/options/config/readConfigFile.d.ts +28 -22
- package/dist/options/config/readConfigFile.js +2 -2
- package/dist/options/options.d.ts +19 -37
- package/dist/options/options.js +44 -31
- package/dist/runSequentially.d.ts +0 -1
- package/dist/runSequentially.js +0 -1
- 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 +5 -4
- package/dist/services/env.js +13 -11
- 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 +16 -10
- package/dist/services/github/v3/createStatusComment.d.ts +1 -1
- package/dist/services/github/v3/createStatusComment.js +34 -18
- 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/{fetchProjectConfig.d.ts → fetchRemoteProjectConfig.d.ts} +1 -1
- package/dist/services/github/v4/{fetchProjectConfig.js → fetchRemoteProjectConfig.js} +3 -3
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +7 -1
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +38 -39
- 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 +9 -4
- package/dist/services/logger.js +40 -37
- 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 +13 -14
- 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 +24 -10
- 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/dist/utils/redact.d.ts +1 -0
- package/dist/utils/redact.js +7 -0
- package/package.json +24 -20
- package/yarn.lock +160 -237
- 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/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 -22
- package/dist/options/config/getOptionsFromGit.d.ts +0 -4
- package/dist/options/config/getOptionsFromGit.js +0 -8
- package/dist/options/config/globalConfig.test.d.ts +0 -1
- package/dist/options/config/globalConfig.test.js +0 -74
- package/dist/options/config/projectConfig.test.d.ts +0 -1
- package/dist/options/config/projectConfig.test.js +0 -99
- 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 -335
- 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/runSequentially.test.d.ts +0 -1
- package/dist/runSequentially.test.js +0 -199
- 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/env.test.d.ts +0 -1
- package/dist/services/env.test.js +0 -27
- package/dist/services/fs-promisified.d.ts +0 -6
- package/dist/services/fs-promisified.js +0 -12
- 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/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 -110
- package/dist/services/github/v3/createStatusComment.test.d.ts +0 -1
- package/dist/services/github/v3/createStatusComment.test.js +0 -291
- 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.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/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/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/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/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/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 -432
- 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 -74
- package/dist/utils/excludeUndefined.test.d.ts +0 -1
- package/dist/utils/excludeUndefined.test.js +0 -24
package/README.md
CHANGED
|
@@ -67,42 +67,45 @@ See [configuration.md](https://github.com/sqren/backport/blob/master/docs/config
|
|
|
67
67
|
|
|
68
68
|
### CLI options
|
|
69
69
|
|
|
70
|
-
| Option | Shorthand notation | Description
|
|
71
|
-
| ------------------- | ------------------ |
|
|
72
|
-
| --access-token | | Github access token
|
|
73
|
-
| --all | -a | Show commits from any author
|
|
74
|
-
| --assignee | --assign | Assign users to the target PR
|
|
75
|
-
| --author | | Filter commits by Github username. Opposite of `--all`
|
|
76
|
-
| --auto-assign | | Assign current user to the target PR
|
|
77
|
-
| --branch | -b | Target branch to backport to
|
|
78
|
-
| --ci | | Disable interactive prompts
|
|
79
|
-
| --
|
|
80
|
-
| --
|
|
81
|
-
| --
|
|
82
|
-
| --
|
|
83
|
-
| --
|
|
84
|
-
| --
|
|
85
|
-
| --
|
|
86
|
-
| --
|
|
87
|
-
| --multiple
|
|
88
|
-
| --
|
|
89
|
-
| --
|
|
90
|
-
| --
|
|
91
|
-
| --
|
|
92
|
-
| --
|
|
93
|
-
| --
|
|
94
|
-
| --
|
|
95
|
-
| --
|
|
96
|
-
| --
|
|
97
|
-
| --
|
|
98
|
-
| --
|
|
99
|
-
| --
|
|
100
|
-
| --
|
|
101
|
-
| --
|
|
102
|
-
| --
|
|
103
|
-
| --
|
|
104
|
-
| --
|
|
105
|
-
| -
|
|
70
|
+
| Option | Shorthand notation | Description | Default |
|
|
71
|
+
| ------------------- | ------------------ | -------------------------------------------------------------------------- | ------------------------- |
|
|
72
|
+
| --access-token | | Github access token | |
|
|
73
|
+
| --all | -a | Show commits from any author | false |
|
|
74
|
+
| --assignee | --assign | Assign users to the target PR | |
|
|
75
|
+
| --author | | Filter commits by Github username. Opposite of `--all` | _Current user_ |
|
|
76
|
+
| --auto-assign | | Assign current user to the target PR | false |
|
|
77
|
+
| --branch | -b | Target branch to backport to | |
|
|
78
|
+
| --ci | | Disable interactive prompts | false |
|
|
79
|
+
| --config-file | | Custom path to project config file (.backportrc.json) | |
|
|
80
|
+
| --dir | | Clone repository into custom directory | ~/.backport/repositories/ |
|
|
81
|
+
| --dry-run | | Perform backport without pushing to Github | false |
|
|
82
|
+
| --editor | | Editor (eg. `code`) to open and resolve conflicts | nano |
|
|
83
|
+
| --fork | | Create backports in fork repo | true |
|
|
84
|
+
| --git-hostname | | Hostname for Git | github.com |
|
|
85
|
+
| --mainline | | Parent id of merge commit | 1 |
|
|
86
|
+
| --max-number | --number, -n | Number of commits to choose from | 10 |
|
|
87
|
+
| --multiple | | Multi-select for commits and branches | false |
|
|
88
|
+
| --multiple-branches | | Multi-select for branches | true |
|
|
89
|
+
| --multiple-commits | | Multi-select for commits | false |
|
|
90
|
+
| --no-cherrypick-ref | | Do not append "(cherry picked from commit...)". [Git Docs][1] | false |
|
|
91
|
+
| --no-status-comment | | Do not publish a status comment to Github with the results of the backport | false |
|
|
92
|
+
| --no-verify | | Bypass the pre-commit and commit-msg hooks | false |
|
|
93
|
+
| --path | -p | Filter commits by path | |
|
|
94
|
+
| --pr-description | --description | Description for pull request | |
|
|
95
|
+
| --pr-filter | | Find PRs using [Github's search syntax][2] | |
|
|
96
|
+
| --pr-title | --title | Title of pull request | |
|
|
97
|
+
| --pull-number | --pr | Backport pull request by number | |
|
|
98
|
+
| --repo-name | | Name of repository | |
|
|
99
|
+
| --repo-owner | | Owner of repository | |
|
|
100
|
+
| --reset-author | | Set yourself as commit author | |
|
|
101
|
+
| --reviewer | | Add reviewer to the target PR | |
|
|
102
|
+
| --sha | | Sha of commit to backport | |
|
|
103
|
+
| --source-branch | | Specify a non-default branch to backport from | |
|
|
104
|
+
| --source-pr-label | | Labels added to the source PR | |
|
|
105
|
+
| --target-branch | -b | Target branch(es) to backport to | |
|
|
106
|
+
| --target-pr-label | --label, -l | Labels added to the target PR | |
|
|
107
|
+
| --help | | Show help | |
|
|
108
|
+
| -v, --version | | Show version number | |
|
|
106
109
|
|
|
107
110
|
The CLI options will override the [configuration options](https://github.com/sqren/backport/blob/master/docs/configuration.md).
|
|
108
111
|
|
|
@@ -198,12 +201,20 @@ console.log(commits);
|
|
|
198
201
|
|
|
199
202
|
/*
|
|
200
203
|
[{
|
|
201
|
-
|
|
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
|
+
},
|
|
202
217
|
sourceBranch: 'main',
|
|
203
|
-
sha: 'd421ddcf6157150596581c7885afa3690cec6339',
|
|
204
|
-
originalMessage: '[APM] Add note about synthtrace to APM docs (#121633)',
|
|
205
|
-
pullNumber: 121633,
|
|
206
|
-
pullUrl: 'https://github.com/elastic/kibana/pull/121633',
|
|
207
218
|
expectedTargetPullRequests: [
|
|
208
219
|
{
|
|
209
220
|
url: 'https://github.com/elastic/kibana/pull/121643',
|
|
@@ -238,7 +249,7 @@ This tools is for anybody who is working on a codebase where they have to mainta
|
|
|
238
249
|
- ability to see which commits have been backported and to which branches
|
|
239
250
|
- ability to customize the title, description and labels of the created backport PRs
|
|
240
251
|
- all git operations are handled in a separate directory to not interfere with unstaged files
|
|
241
|
-
- Conflicts are handled gracefully, and hints are provided to help the user understand the source of the conflict
|
|
252
|
+
- Conflicts are handled gracefully, and hints are provided to help the user understand the source of the conflict
|
|
242
253
|
- backport a commit by specifying a PR: `backport --pr 1337`
|
|
243
254
|
- list and backport commits by a particular user: `backport --author john`
|
|
244
255
|
- list and backport commits by a particular path: `backport --path src/plugins/chatbot`
|
|
@@ -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
|
-
export declare function
|
|
14
|
+
export declare function backportRun(processArgs: string[], optionsFromModule?: ConfigFileOptions): Promise<BackportResponse>;
|
|
@@ -3,21 +3,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.backportRun = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const ora_1 = __importDefault(require("ora"));
|
|
9
|
+
const yargs_parser_1 = __importDefault(require("yargs-parser"));
|
|
8
10
|
const options_1 = require("./options/options");
|
|
9
11
|
const runSequentially_1 = require("./runSequentially");
|
|
10
12
|
const HandledError_1 = require("./services/HandledError");
|
|
11
13
|
const env_1 = require("./services/env");
|
|
12
14
|
const createStatusComment_1 = require("./services/github/v3/createStatusComment");
|
|
15
|
+
const apiRequestV4_1 = require("./services/github/v4/apiRequestV4");
|
|
13
16
|
const logger_1 = require("./services/logger");
|
|
14
17
|
const getCommits_1 = require("./ui/getCommits");
|
|
15
18
|
const getTargetBranches_1 = require("./ui/getTargetBranches");
|
|
16
|
-
async function
|
|
19
|
+
async function backportRun(processArgs, optionsFromModule = {}) {
|
|
20
|
+
const argv = (0, yargs_parser_1.default)(processArgs);
|
|
21
|
+
const ci = argv.ci ?? optionsFromModule.ci;
|
|
22
|
+
const logFilePath = argv.logFilePath ?? optionsFromModule.logFilePath;
|
|
23
|
+
(0, logger_1.initLogger)({ ci, logFilePath });
|
|
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
|
+
}
|
|
17
29
|
let options = null;
|
|
18
30
|
let commits = [];
|
|
19
31
|
try {
|
|
20
|
-
options = await (0, options_1.getOptions)(
|
|
32
|
+
options = await (0, options_1.getOptions)(processArgs, optionsFromModule);
|
|
33
|
+
spinner.stop();
|
|
21
34
|
commits = await (0, getCommits_1.getCommits)(options);
|
|
22
35
|
const targetBranches = await (0, getTargetBranches_1.getTargetBranches)(options, commits);
|
|
23
36
|
const results = await (0, runSequentially_1.runSequentially)({ options, commits, targetBranches });
|
|
@@ -33,10 +46,10 @@ async function main(argv, optionsFromModule) {
|
|
|
33
46
|
return backportResponse;
|
|
34
47
|
}
|
|
35
48
|
catch (e) {
|
|
49
|
+
spinner.stop();
|
|
36
50
|
const backportResponse = {
|
|
37
51
|
status: 'failure',
|
|
38
52
|
commits,
|
|
39
|
-
errorMessage: e.message,
|
|
40
53
|
error: e,
|
|
41
54
|
};
|
|
42
55
|
if (options) {
|
|
@@ -45,20 +58,22 @@ async function main(argv, optionsFromModule) {
|
|
|
45
58
|
backportResponse,
|
|
46
59
|
});
|
|
47
60
|
}
|
|
48
|
-
if (e instanceof HandledError_1.HandledError) {
|
|
61
|
+
if (e instanceof HandledError_1.HandledError || e instanceof apiRequestV4_1.GithubV4Exception) {
|
|
49
62
|
(0, logger_1.consoleLog)(e.message);
|
|
50
63
|
}
|
|
51
64
|
else if (e instanceof Error) {
|
|
52
65
|
// output
|
|
53
66
|
(0, logger_1.consoleLog)('\n');
|
|
54
67
|
(0, logger_1.consoleLog)(chalk_1.default.bold('⚠️ Ouch! An unhandled error occured 😿'));
|
|
55
|
-
(0, logger_1.consoleLog)(
|
|
68
|
+
(0, logger_1.consoleLog)(e.stack ? e.stack : e.message);
|
|
56
69
|
(0, logger_1.consoleLog)('Please open an issue in https://github.com/sqren/backport/issues or contact me directly on https://twitter.com/sorenlouv');
|
|
57
|
-
(0, logger_1.consoleLog)(chalk_1.default.italic(`For additional details see the logs: ${(0, env_1.getLogfilePath)(
|
|
58
|
-
|
|
70
|
+
(0, logger_1.consoleLog)(chalk_1.default.italic(`For additional details see the logs: ${(0, env_1.getLogfilePath)({
|
|
71
|
+
logFilePath,
|
|
72
|
+
})}`));
|
|
73
|
+
// write to log
|
|
59
74
|
logger_1.logger.info('Unknown error:', e);
|
|
60
75
|
}
|
|
61
76
|
return backportResponse;
|
|
62
77
|
}
|
|
63
78
|
}
|
|
64
|
-
exports.
|
|
79
|
+
exports.backportRun = backportRun;
|
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);
|
|
@@ -1,10 +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
|
-
export {
|
|
7
|
-
export
|
|
6
|
+
export { fetchRemoteProjectConfig as getRemoteProjectConfig } from './services/github/v4/fetchRemoteProjectConfig';
|
|
7
|
+
export { getGlobalConfig as getLocalGlobalConfig } from './options/config/globalConfig';
|
|
8
|
+
export declare function backportRun(options: ConfigFileOptions, processArgs?: string[]): Promise<import("./backportRun").BackportResponse>;
|
|
8
9
|
export declare function getCommits(options: {
|
|
9
10
|
accessToken: string;
|
|
10
11
|
repoName: string;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCommits = exports.backportRun = exports.
|
|
4
|
-
const
|
|
3
|
+
exports.getCommits = exports.backportRun = exports.getLocalGlobalConfig = exports.getRemoteProjectConfig = void 0;
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
var fetchRemoteProjectConfig_1 = require("./services/github/v4/fetchRemoteProjectConfig");
|
|
12
|
+
Object.defineProperty(exports, "getRemoteProjectConfig", { enumerable: true, get: function () { return fetchRemoteProjectConfig_1.fetchRemoteProjectConfig; } });
|
|
13
|
+
var globalConfig_1 = require("./options/config/globalConfig");
|
|
14
|
+
Object.defineProperty(exports, "getLocalGlobalConfig", { enumerable: true, get: function () { return globalConfig_1.getGlobalConfig; } });
|
|
14
15
|
function backportRun(options,
|
|
15
16
|
// cli args will not automatically be forwarded when it is consumed as a module
|
|
16
17
|
// It is simple to forward args manually via `process.argv`:
|
|
@@ -19,11 +20,12 @@ function backportRun(options,
|
|
|
19
20
|
// const args = process.argv.slice(2);
|
|
20
21
|
// backportRun(options, args)
|
|
21
22
|
//
|
|
22
|
-
|
|
23
|
-
return (0,
|
|
23
|
+
processArgs = []) {
|
|
24
|
+
return (0, backportRun_1.backportRun)(processArgs, (0, excludeUndefined_1.excludeUndefined)(options));
|
|
24
25
|
}
|
|
25
26
|
exports.backportRun = backportRun;
|
|
26
27
|
async function getCommits(options) {
|
|
28
|
+
(0, logger_1.initLogger)({ ci: true, accessToken: options.accessToken });
|
|
27
29
|
const optionsFromGithub = await (0, getOptionsFromGithub_1.getOptionsFromGithub)(options);
|
|
28
30
|
if (options.pullNumber) {
|
|
29
31
|
return [
|
|
@@ -22,12 +22,15 @@ declare type Options = Partial<{
|
|
|
22
22
|
cherrypickRef: boolean;
|
|
23
23
|
ci: boolean;
|
|
24
24
|
commitPaths: string[];
|
|
25
|
+
configFile: string;
|
|
25
26
|
details: boolean;
|
|
27
|
+
dir: string;
|
|
26
28
|
editor: string;
|
|
27
29
|
fork: boolean;
|
|
28
30
|
gitHostname: string;
|
|
29
31
|
githubApiBaseUrlV3: string;
|
|
30
32
|
githubApiBaseUrlV4: string;
|
|
33
|
+
logFilePath: string;
|
|
31
34
|
maxNumber: number;
|
|
32
35
|
multiple: boolean;
|
|
33
36
|
multipleBranches: boolean;
|
|
@@ -36,6 +39,7 @@ declare type Options = Partial<{
|
|
|
36
39
|
prDescription: string;
|
|
37
40
|
prFilter: string;
|
|
38
41
|
prTitle: string;
|
|
42
|
+
publishStatusComment: boolean;
|
|
39
43
|
pullNumber: number;
|
|
40
44
|
repoName: string;
|
|
41
45
|
repoOwner: string;
|
|
@@ -51,6 +55,8 @@ declare type Options = Partial<{
|
|
|
51
55
|
verbose: boolean;
|
|
52
56
|
}>;
|
|
53
57
|
export declare type ConfigFileOptions = Options & Partial<{
|
|
58
|
+
help: boolean;
|
|
59
|
+
version: boolean;
|
|
54
60
|
branchLabelMapping: Record<string, string>;
|
|
55
61
|
/**
|
|
56
62
|
* @deprecated Replaced by `repoOwner` and `repoName`
|
|
@@ -1,43 +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
|
+
dir?: string | undefined;
|
|
6
7
|
verbose?: boolean | undefined;
|
|
7
8
|
accessToken?: string | undefined;
|
|
8
|
-
assignees?: string[] | undefined;
|
|
9
9
|
author?: string | null | undefined;
|
|
10
10
|
autoAssign?: boolean | undefined;
|
|
11
|
+
assignees?: string[] | undefined;
|
|
11
12
|
autoMerge?: boolean | undefined;
|
|
12
13
|
autoMergeMethod?: string | undefined;
|
|
13
|
-
cherrypickRef?: boolean | undefined;
|
|
14
14
|
ci?: boolean | undefined;
|
|
15
|
-
|
|
15
|
+
cherrypickRef?: boolean | undefined;
|
|
16
|
+
configFile?: string | undefined;
|
|
16
17
|
details?: boolean | undefined;
|
|
17
18
|
editor?: string | undefined;
|
|
19
|
+
skipRemoteConfig?: boolean | undefined;
|
|
18
20
|
gitHostname?: string | undefined;
|
|
19
21
|
githubApiBaseUrlV3?: string | undefined;
|
|
20
22
|
githubApiBaseUrlV4?: string | undefined;
|
|
23
|
+
logFilePath?: string | undefined;
|
|
24
|
+
mainline?: number | undefined;
|
|
21
25
|
maxNumber?: number | undefined;
|
|
22
26
|
multipleBranches?: boolean | undefined;
|
|
23
27
|
multipleCommits?: boolean | undefined;
|
|
24
28
|
noVerify?: boolean | undefined;
|
|
25
29
|
prDescription?: string | undefined;
|
|
26
|
-
prFilter?: string | undefined;
|
|
27
30
|
prTitle?: string | undefined;
|
|
31
|
+
prFilter?: string | undefined;
|
|
28
32
|
pullNumber?: number | undefined;
|
|
29
|
-
repoName?: string | undefined;
|
|
30
|
-
repoOwner?: string | undefined;
|
|
31
|
-
resetAuthor?: boolean | undefined;
|
|
32
|
-
reviewers?: string[] | undefined;
|
|
33
33
|
sha?: string | undefined;
|
|
34
|
-
|
|
34
|
+
resetAuthor?: boolean | undefined;
|
|
35
|
+
repoOwner?: string | undefined;
|
|
36
|
+
repoName?: string | undefined;
|
|
35
37
|
sourceBranch?: string | undefined;
|
|
38
|
+
dateSince?: string | undefined;
|
|
39
|
+
dateUntil?: string | undefined;
|
|
40
|
+
commitPaths?: string[] | undefined;
|
|
41
|
+
reviewers?: string[] | undefined;
|
|
36
42
|
sourcePRLabels?: string[] | undefined;
|
|
37
43
|
targetBranchChoices?: string[] | undefined;
|
|
38
44
|
targetBranches?: string[] | undefined;
|
|
39
45
|
targetPRLabels?: string[] | undefined;
|
|
40
|
-
|
|
41
|
-
dateSince?: string | undefined;
|
|
42
|
-
dateUntil?: string | undefined;
|
|
46
|
+
publishStatusComment?: boolean | undefined;
|
|
43
47
|
};
|
package/dist/options/cliArgs.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getOptionsFromCliArgs = void 0;
|
|
7
7
|
const yargs_1 = __importDefault(require("yargs"));
|
|
8
8
|
const excludeUndefined_1 = require("../utils/excludeUndefined");
|
|
9
|
-
function getOptionsFromCliArgs(
|
|
10
|
-
const yargsInstance = (0, yargs_1.default)(
|
|
9
|
+
function getOptionsFromCliArgs(processArgs, { exitOnError = true } = {}) {
|
|
10
|
+
const yargsInstance = (0, yargs_1.default)(processArgs)
|
|
11
11
|
.parserConfiguration({
|
|
12
12
|
'strip-dashed': true,
|
|
13
13
|
'strip-aliased': true,
|
|
@@ -56,6 +56,11 @@ function getOptionsFromCliArgs(argv, { exitOnError = true } = {}) {
|
|
|
56
56
|
description: 'Append commit message with "(cherry picked from commit...)',
|
|
57
57
|
type: 'boolean',
|
|
58
58
|
conflicts: ['noCherrypickRef'],
|
|
59
|
+
})
|
|
60
|
+
.option('configFile', {
|
|
61
|
+
alias: 'config',
|
|
62
|
+
description: 'Path to project config',
|
|
63
|
+
type: 'string',
|
|
59
64
|
})
|
|
60
65
|
.option('since', {
|
|
61
66
|
description: 'ISO-8601 date for filtering commits',
|
|
@@ -64,6 +69,10 @@ function getOptionsFromCliArgs(argv, { exitOnError = true } = {}) {
|
|
|
64
69
|
.option('until', {
|
|
65
70
|
description: 'ISO-8601 date for filtering commits',
|
|
66
71
|
type: 'string',
|
|
72
|
+
})
|
|
73
|
+
.option('dir', {
|
|
74
|
+
description: 'Location where the temporary repository will be stored',
|
|
75
|
+
type: 'string',
|
|
67
76
|
})
|
|
68
77
|
.option('details', {
|
|
69
78
|
description: 'Show details about each commit',
|
|
@@ -97,6 +106,11 @@ function getOptionsFromCliArgs(argv, { exitOnError = true } = {}) {
|
|
|
97
106
|
hidden: true,
|
|
98
107
|
description: `Base url for Github's GraphQL (v4) API`,
|
|
99
108
|
type: 'string',
|
|
109
|
+
})
|
|
110
|
+
.option('logFilePath', {
|
|
111
|
+
hidden: true,
|
|
112
|
+
description: `Path to log file`,
|
|
113
|
+
type: 'string',
|
|
100
114
|
})
|
|
101
115
|
.option('mainline', {
|
|
102
116
|
description: 'Parent id of merge commit. Defaults to 1 when supplied without arguments',
|
|
@@ -105,7 +119,7 @@ function getOptionsFromCliArgs(argv, { exitOnError = true } = {}) {
|
|
|
105
119
|
if (mainline === undefined) {
|
|
106
120
|
// return 1 if `--mainline` is given without a value
|
|
107
121
|
// return undefined if --mainline is not supplied at all
|
|
108
|
-
return
|
|
122
|
+
return processArgs.includes('--mainline') ? 1 : undefined;
|
|
109
123
|
}
|
|
110
124
|
// use specified mainline parent
|
|
111
125
|
if (Number.isInteger(mainline)) {
|
|
@@ -143,6 +157,10 @@ function getOptionsFromCliArgs(argv, { exitOnError = true } = {}) {
|
|
|
143
157
|
description: 'Do not append commit message with "(cherry picked from commit...)"',
|
|
144
158
|
type: 'boolean',
|
|
145
159
|
conflicts: ['cherrypickRef'],
|
|
160
|
+
})
|
|
161
|
+
.option('noStatusComment', {
|
|
162
|
+
description: "Don't publish status comment to Github",
|
|
163
|
+
type: 'boolean',
|
|
146
164
|
})
|
|
147
165
|
.option('noVerify', {
|
|
148
166
|
description: 'Bypass the pre-commit and commit-msg hooks',
|
|
@@ -268,15 +286,15 @@ function getOptionsFromCliArgs(argv, { exitOnError = true } = {}) {
|
|
|
268
286
|
// filters
|
|
269
287
|
author, since, until,
|
|
270
288
|
// negations
|
|
271
|
-
|
|
289
|
+
noCherrypickRef, noFork, noStatusComment, noVerify, verify,
|
|
272
290
|
// array types (should be renamed to plural form)
|
|
273
291
|
assignee, path, reviewer, sourcePRLabel, targetBranch, targetBranchChoice, targetPRLabel, ...restOptions } = yargsInstance.parseSync();
|
|
274
292
|
return (0, excludeUndefined_1.excludeUndefined)({
|
|
275
293
|
...restOptions,
|
|
276
294
|
// filters
|
|
277
295
|
author: all ? null : author,
|
|
278
|
-
dateSince: since,
|
|
279
|
-
dateUntil: until,
|
|
296
|
+
dateSince: since ? new Date(since).toISOString() : undefined,
|
|
297
|
+
dateUntil: until ? new Date(until).toISOString() : undefined,
|
|
280
298
|
// `multiple` is a cli-only flag to override `multipleBranches` and `multipleCommits`
|
|
281
299
|
multipleBranches: multiple ?? multipleBranches,
|
|
282
300
|
multipleCommits: multiple ?? multipleCommits,
|
|
@@ -292,6 +310,7 @@ function getOptionsFromCliArgs(argv, { exitOnError = true } = {}) {
|
|
|
292
310
|
cherrypickRef: noCherrypickRef === true ? false : restOptions.cherrypickRef,
|
|
293
311
|
fork: noFork === true ? false : restOptions.fork,
|
|
294
312
|
noVerify: verify ?? noVerify,
|
|
313
|
+
publishStatusComment: noStatusComment === true ? false : undefined,
|
|
295
314
|
});
|
|
296
315
|
}
|
|
297
316
|
exports.getOptionsFromCliArgs = getOptionsFromCliArgs;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { ConfigFileOptions } from '../ConfigOptions';
|
|
2
|
+
import { OptionsFromCliArgs } from '../cliArgs';
|
|
2
3
|
export declare type OptionsFromConfigFiles = Awaited<ReturnType<typeof getOptionsFromConfigFiles>>;
|
|
3
|
-
export declare function getOptionsFromConfigFiles(optionsFromModule
|
|
4
|
+
export declare function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsFromModule, defaultConfigOptions, }: {
|
|
5
|
+
optionsFromCliArgs: OptionsFromCliArgs;
|
|
6
|
+
optionsFromModule: ConfigFileOptions;
|
|
7
|
+
defaultConfigOptions: ConfigFileOptions;
|
|
8
|
+
}): Promise<{
|
|
4
9
|
accessToken?: string | undefined;
|
|
5
10
|
assignees?: string[] | undefined;
|
|
6
11
|
author?: string | null | undefined;
|
|
@@ -23,12 +28,15 @@ export declare function getOptionsFromConfigFiles(optionsFromModule?: ConfigFile
|
|
|
23
28
|
cherrypickRef?: boolean | undefined;
|
|
24
29
|
ci?: boolean | undefined;
|
|
25
30
|
commitPaths?: string[] | undefined;
|
|
31
|
+
configFile?: string | undefined;
|
|
26
32
|
details?: boolean | undefined;
|
|
33
|
+
dir?: string | undefined;
|
|
27
34
|
editor?: string | undefined;
|
|
28
35
|
fork?: boolean | undefined;
|
|
29
36
|
gitHostname?: string | undefined;
|
|
30
37
|
githubApiBaseUrlV3?: string | undefined;
|
|
31
38
|
githubApiBaseUrlV4?: string | undefined;
|
|
39
|
+
logFilePath?: string | undefined;
|
|
32
40
|
maxNumber?: number | undefined;
|
|
33
41
|
multiple?: boolean | undefined;
|
|
34
42
|
multipleBranches?: boolean | undefined;
|
|
@@ -37,6 +45,7 @@ export declare function getOptionsFromConfigFiles(optionsFromModule?: ConfigFile
|
|
|
37
45
|
prDescription?: string | undefined;
|
|
38
46
|
prFilter?: string | undefined;
|
|
39
47
|
prTitle?: string | undefined;
|
|
48
|
+
publishStatusComment?: boolean | undefined;
|
|
40
49
|
pullNumber?: number | undefined;
|
|
41
50
|
repoName?: string | undefined;
|
|
42
51
|
repoOwner?: string | undefined;
|
|
@@ -50,6 +59,8 @@ export declare function getOptionsFromConfigFiles(optionsFromModule?: ConfigFile
|
|
|
50
59
|
targetBranches?: string[] | undefined;
|
|
51
60
|
targetPRLabels?: string[] | undefined;
|
|
52
61
|
verbose?: boolean | undefined;
|
|
62
|
+
help?: boolean | undefined;
|
|
63
|
+
version?: boolean | undefined;
|
|
53
64
|
branchLabelMapping?: Record<string, string> | undefined;
|
|
54
65
|
upstream?: string | undefined;
|
|
55
66
|
branches?: import("../ConfigOptions").TargetBranchChoiceOrString[] | undefined;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getOptionsFromConfigFiles = void 0;
|
|
4
|
-
const getOptionsFromGit_1 = require("./getOptionsFromGit");
|
|
5
4
|
const globalConfig_1 = require("./globalConfig");
|
|
6
5
|
const projectConfig_1 = require("./projectConfig");
|
|
7
|
-
async function getOptionsFromConfigFiles(optionsFromModule) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
async function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsFromModule, defaultConfigOptions, }) {
|
|
7
|
+
// ci: cli and module only flag
|
|
8
|
+
const ci = optionsFromCliArgs.ci ?? optionsFromModule.ci ?? defaultConfigOptions.ci;
|
|
9
|
+
// ci: cli and module only flag
|
|
10
|
+
const configFile = optionsFromCliArgs.configFile ?? optionsFromModule.configFile;
|
|
11
|
+
const [projectConfig, globalConfig] = await Promise.all([
|
|
12
|
+
(0, projectConfig_1.getProjectConfig)({ configFile }),
|
|
13
|
+
ci ? undefined : (0, globalConfig_1.getGlobalConfig)(),
|
|
12
14
|
]);
|
|
13
15
|
return {
|
|
14
|
-
...gitConfig,
|
|
15
16
|
...globalConfig,
|
|
16
17
|
...projectConfig,
|
|
17
18
|
...optionsFromModule,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ConfigFileOptions } from '../ConfigOptions';
|
|
2
|
-
export declare function getGlobalConfig(
|
|
3
|
-
export declare function createGlobalConfigAndFolderIfNotExist(): Promise<boolean>;
|
|
2
|
+
export declare function getGlobalConfig(): Promise<ConfigFileOptions>;
|
|
3
|
+
export declare function createGlobalConfigAndFolderIfNotExist(globalConfigPath: string): Promise<boolean>;
|
|
4
4
|
export declare function createGlobalConfigIfNotExist(globalConfigPath: string, configTemplate: string): Promise<boolean>;
|
|
@@ -4,47 +4,49 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createGlobalConfigIfNotExist = exports.createGlobalConfigAndFolderIfNotExist = exports.getGlobalConfig = void 0;
|
|
7
|
+
const promises_1 = require("fs/promises");
|
|
7
8
|
const make_dir_1 = __importDefault(require("make-dir"));
|
|
9
|
+
const HandledError_1 = require("../../services/HandledError");
|
|
8
10
|
const env_1 = require("../../services/env");
|
|
9
|
-
const fs_promisified_1 = require("../../services/fs-promisified");
|
|
10
11
|
const readConfigFile_1 = require("./readConfigFile");
|
|
11
|
-
async function getGlobalConfig(
|
|
12
|
-
// don't attempt to fetch global config in ci environment
|
|
13
|
-
if (ci) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
await createGlobalConfigAndFolderIfNotExist();
|
|
12
|
+
async function getGlobalConfig() {
|
|
17
13
|
const globalConfigPath = (0, env_1.getGlobalConfigPath)();
|
|
14
|
+
await createGlobalConfigAndFolderIfNotExist(globalConfigPath);
|
|
18
15
|
return (0, readConfigFile_1.readConfigFile)(globalConfigPath);
|
|
19
16
|
}
|
|
20
17
|
exports.getGlobalConfig = getGlobalConfig;
|
|
21
|
-
async function createGlobalConfigAndFolderIfNotExist() {
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
async function createGlobalConfigAndFolderIfNotExist(globalConfigPath) {
|
|
19
|
+
// create .backport folder
|
|
20
|
+
await (0, make_dir_1.default)((0, env_1.getBackportDirPath)());
|
|
24
21
|
const configTemplate = getConfigTemplate();
|
|
25
|
-
await (0, make_dir_1.default)(reposPath);
|
|
26
22
|
const didCreate = await createGlobalConfigIfNotExist(globalConfigPath, configTemplate);
|
|
27
23
|
await ensureCorrectPermissions(globalConfigPath);
|
|
28
24
|
return didCreate;
|
|
29
25
|
}
|
|
30
26
|
exports.createGlobalConfigAndFolderIfNotExist = createGlobalConfigAndFolderIfNotExist;
|
|
31
27
|
function ensureCorrectPermissions(globalConfigPath) {
|
|
32
|
-
return (0,
|
|
28
|
+
return (0, promises_1.chmod)(globalConfigPath, '600');
|
|
33
29
|
}
|
|
34
30
|
async function createGlobalConfigIfNotExist(globalConfigPath, configTemplate) {
|
|
35
31
|
try {
|
|
36
|
-
await (0,
|
|
32
|
+
await (0, promises_1.writeFile)(globalConfigPath, configTemplate, {
|
|
37
33
|
flag: 'wx',
|
|
38
34
|
mode: 0o600, // give the owner read-write privleges, no access for others
|
|
39
35
|
});
|
|
40
36
|
return true;
|
|
41
37
|
}
|
|
42
38
|
catch (e) {
|
|
39
|
+
// ignore error if file already exists
|
|
43
40
|
const FILE_ALREADY_EXISTS = 'EEXIST';
|
|
44
|
-
if (e.code
|
|
45
|
-
|
|
41
|
+
if (e.code === FILE_ALREADY_EXISTS) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
// handle error if folder does not exist
|
|
45
|
+
const FOLDER_NOT_EXISTS = 'ENOENT';
|
|
46
|
+
if (e.code === FOLDER_NOT_EXISTS) {
|
|
47
|
+
throw new HandledError_1.HandledError(`The .backport folder (${globalConfigPath}) does not exist. `);
|
|
46
48
|
}
|
|
47
|
-
|
|
49
|
+
throw e;
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
exports.createGlobalConfigIfNotExist = createGlobalConfigIfNotExist;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { ConfigFileOptions } from '../ConfigOptions';
|
|
2
|
-
export declare function getProjectConfig(
|
|
2
|
+
export declare function getProjectConfig({ configFile, }: {
|
|
3
|
+
configFile: string | undefined;
|
|
4
|
+
}): Promise<ConfigFileOptions | undefined>;
|