backport 5.6.4 → 6.1.0
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 +166 -41
- package/dist/entrypoint.cli.js +3 -1
- package/dist/entrypoint.module.d.ts +18 -5
- package/dist/entrypoint.module.js +42 -12
- package/dist/entrypoint.module.private.test.d.ts +1 -0
- package/dist/entrypoint.module.private.test.js +33 -0
- package/dist/ink.d.ts +1 -0
- package/dist/ink.js +49 -0
- package/dist/main.d.ts +11 -6
- package/dist/main.js +40 -25
- package/dist/options/ConfigOptions.d.ts +56 -39
- package/dist/options/cliArgs.d.ts +38 -45
- package/dist/options/cliArgs.js +123 -104
- package/dist/options/cliArgs.test.js +106 -119
- package/dist/options/config/config.d.ts +56 -2
- package/dist/options/config/config.js +12 -6
- package/dist/options/config/config.test.js +11 -6
- package/dist/options/config/getOptionsFromGit.d.ts +4 -0
- package/dist/options/config/getOptionsFromGit.js +8 -0
- package/dist/options/config/globalConfig.d.ts +2 -1
- package/dist/options/config/globalConfig.js +9 -12
- package/dist/options/config/globalConfig.test.js +7 -5
- package/dist/options/config/projectConfig.d.ts +2 -1
- package/dist/options/config/projectConfig.js +3 -3
- package/dist/options/config/projectConfig.test.js +54 -17
- package/dist/options/config/readConfigFile.d.ts +53 -2
- package/dist/options/config/readConfigFile.js +31 -5
- package/dist/options/options.d.ts +67 -35
- package/dist/options/options.js +99 -16
- package/dist/options/options.test.js +214 -67
- package/dist/options/parseRequiredOptions.d.ts +71 -0
- package/dist/options/parseRequiredOptions.js +68 -0
- package/dist/options/parseRequiredOptions.test.d.ts +1 -0
- package/dist/options/parseRequiredOptions.test.js +122 -0
- package/dist/runSequentially.d.ts +20 -0
- package/dist/runSequentially.js +41 -0
- package/dist/runSequentially.test.d.ts +1 -0
- package/dist/runSequentially.test.js +192 -0
- package/dist/runWithOptions.js +7 -14
- package/dist/runWithOptions.test.js +142 -16
- package/dist/scripts/generate-gql.d.ts +1 -0
- package/dist/scripts/generate-gql.js +15 -0
- package/dist/scripts/postinstall.js +4 -4
- package/dist/scripts/postinstall.test.js +9 -2
- package/dist/scripts/runPostinstall.js +1 -1
- package/dist/services/HandledError.d.ts +11 -1
- package/dist/services/HandledError.js +2 -1
- package/dist/services/child-process-promisified.d.ts +1 -1
- package/dist/services/child-process-promisified.js +2 -2
- package/dist/services/env.js +5 -5
- package/dist/services/env.test.js +11 -4
- package/dist/services/fs-promisified.js +4 -4
- package/dist/services/getExpectedTarget.d.ts +9 -0
- package/dist/services/getExpectedTarget.js +77 -0
- package/dist/services/getExpectedTargetPullRequests.d.ts +9 -0
- package/dist/services/getExpectedTargetPullRequests.js +77 -0
- package/dist/services/git.d.ts +23 -5
- package/dist/services/git.integration.test.d.ts +1 -0
- package/dist/services/git.integration.test.js +168 -0
- package/dist/services/git.js +133 -60
- package/dist/services/git.test.js +160 -53
- package/dist/services/github/commitFormatters.d.ts +3 -7
- package/dist/services/github/commitFormatters.js +10 -19
- package/dist/services/github/commitFormatters.test.js +2 -24
- package/dist/services/github/v3/addAssigneesToPullRequest.d.ts +1 -1
- package/dist/services/github/v3/addAssigneesToPullRequest.js +3 -8
- package/dist/services/github/v3/addAssigneesToPullRequest.test.js +6 -8
- package/dist/services/github/v3/addLabelsToPullRequest.d.ts +1 -1
- package/dist/services/github/v3/addLabelsToPullRequest.js +2 -6
- package/dist/services/github/v3/addReviewersToPullRequest.d.ts +2 -0
- package/dist/services/github/v3/addReviewersToPullRequest.js +34 -0
- package/dist/services/github/v3/createPullRequest.d.ts +3 -2
- package/dist/services/github/v3/createPullRequest.js +32 -26
- package/dist/services/github/v3/createPullRequest.test.d.ts +1 -0
- package/dist/services/github/v3/createPullRequest.test.js +78 -0
- package/dist/services/github/v3/createStatusComment.d.ts +11 -0
- package/dist/services/github/v3/createStatusComment.js +97 -0
- package/dist/services/github/v3/createStatusComment.test.d.ts +1 -0
- package/dist/services/github/v3/createStatusComment.test.js +209 -0
- package/dist/services/github/v4/FetchPullRequestId.d.ts +9 -0
- package/dist/services/github/v4/FetchPullRequestId.js +32 -0
- package/dist/services/github/v4/apiRequestV4.d.ts +2 -2
- package/dist/services/github/v4/apiRequestV4.js +9 -11
- package/dist/services/github/v4/apiRequestV4.test.js +7 -7
- package/dist/services/github/v4/disablePullRequestAutoMerge.d.ts +9 -0
- package/dist/services/github/v4/disablePullRequestAutoMerge.js +28 -0
- package/dist/services/github/v4/enablePullRequestAutoMerge.d.ts +9 -0
- package/dist/services/github/v4/enablePullRequestAutoMerge.js +51 -0
- package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.d.ts +1 -0
- package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +112 -0
- package/dist/services/github/v4/fetchAuthorId.d.ts +10 -2
- package/dist/services/github/v4/fetchAuthorId.js +6 -7
- package/dist/services/github/v4/fetchAuthorId.private.test.js +6 -9
- package/dist/services/github/v4/fetchCommitByPullNumber.js +11 -9
- package/dist/services/github/v4/fetchCommitByPullNumber.private.test.js +6 -6
- package/dist/services/github/v4/fetchCommitBySha.js +14 -12
- package/dist/services/github/v4/fetchCommitBySha.private.test.js +7 -5
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +12 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +46 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +70 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.d.ts +12 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +36 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +55 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +27 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +88 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +128 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +125 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.d.ts +28 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.js +52 -0
- package/dist/services/github/v4/fetchCommits/fetchProjectConfig.d.ts +3 -0
- package/dist/services/github/v4/fetchCommits/fetchProjectConfig.js +55 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +10 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +49 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +77 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.js +252 -0
- package/dist/services/github/v4/fetchCommitsByAuthor.d.ts +3 -2
- package/dist/services/github/v4/fetchCommitsByAuthor.js +81 -70
- package/dist/services/github/v4/fetchCommitsByAuthor.private.test.js +81 -8
- package/dist/services/github/v4/fetchCommitsByAuthor.test.js +29 -21
- package/dist/services/github/v4/fetchDefaultBranch.d.ts +1 -1
- package/dist/services/github/v4/fetchDefaultBranch.js +1 -1
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +4 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.js +52 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +32 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.d.ts +4 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.js +72 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.js +34 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.d.ts +40 -0
- package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.js +72 -0
- package/dist/services/github/v4/fetchExistingPullRequest.js +2 -3
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +3 -5
- package/dist/services/github/v4/fetchMergedPullRequests.d.ts +19 -20
- package/dist/services/github/v4/fetchMergedPullRequests.js +22 -68
- package/dist/services/github/v4/fetchMergedPullRequests.private.test.js +8 -9
- package/dist/services/github/v4/fetchProjectConfig.d.ts +8 -0
- package/dist/services/github/v4/fetchProjectConfig.js +56 -0
- package/dist/services/github/v4/fetchProjectConfig.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchProjectConfig.private.test.js +52 -0
- package/dist/services/github/v4/fetchProjectConfig.test.d.ts +1 -0
- package/dist/services/github/v4/fetchProjectConfig.test.js +37 -0
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.d.ts +11 -0
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.js +35 -0
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.d.ts +1 -1
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.js +12 -10
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.js +8 -6
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.js +2 -2
- package/dist/services/github/v4/getExistingTargetPullRequests.d.ts +4 -58
- package/dist/services/github/v4/getExistingTargetPullRequests.js +3 -58
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +66 -0
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +130 -0
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +1 -0
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +130 -0
- package/dist/services/github/v4/getOptionsFromGithub/index.d.ts +63 -0
- package/dist/services/github/v4/getOptionsFromGithub/index.js +139 -0
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.d.ts +1 -0
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.js +147 -0
- package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +37 -0
- package/dist/services/github/v4/getOptionsFromGithub/query.js +47 -0
- package/dist/services/github/v4/getTargetBranchesFromLabels.d.ts +0 -7
- package/dist/services/github/v4/getTargetBranchesFromLabels.js +1 -26
- package/dist/services/github/v4/getTargetBranchesFromLabels.test.js +69 -32
- package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +2 -2
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +39 -25
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.d.ts +2 -2
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.js +10 -0
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.d.ts +2 -2
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.js +4 -1
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.d.ts +1 -1
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.js +1 -0
- package/dist/services/github/v4/throwOnInvalidAccessToken.d.ts +1 -1
- package/dist/services/github/v4/throwOnInvalidAccessToken.js +10 -15
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +7 -7
- package/dist/services/logger.d.ts +3 -3
- package/dist/services/logger.js +24 -24
- package/dist/services/prompt.test.d.ts +1 -0
- package/dist/services/prompt.test.js +87 -0
- package/dist/services/prompts.d.ts +10 -4
- package/dist/services/prompts.js +85 -22
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +9 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +92 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +1 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +396 -0
- package/dist/services/sourceCommit/getMockSourceCommit.d.ts +21 -0
- package/dist/services/sourceCommit/getMockSourceCommit.js +67 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.d.ts +5 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.js +20 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.d.ts +1 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.js +201 -0
- package/dist/services/sourceCommit/parseSourceCommit.d.ts +82 -0
- package/dist/services/sourceCommit/parseSourceCommit.js +96 -0
- package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +1 -0
- package/dist/services/sourceCommit/parseSourceCommit.test.js +229 -0
- package/dist/services/sourceCommit/sourceCommit.d.ts +78 -0
- package/dist/services/sourceCommit/sourceCommit.js +86 -0
- package/dist/services/sourceCommit/sourceCommit.test.d.ts +1 -0
- package/dist/services/sourceCommit/sourceCommit.test.js +287 -0
- package/dist/services/sourceCommit.d.ts +78 -0
- package/dist/services/sourceCommit.js +86 -0
- package/dist/services/sourceCommit.test.d.ts +1 -0
- package/dist/services/sourceCommit.test.js +280 -0
- package/dist/test/inquirer.private.test.js +105 -61
- package/dist/test/integration/createSpies.d.ts +1 -1
- package/dist/test/integration/createSpies.js +21 -9
- package/dist/test/integration/envConstants.js +5 -6
- package/dist/test/integration/helpers.js +1 -1
- package/dist/test/integration/integration.private.test.d.ts +1 -0
- package/dist/test/integration/integration.private.test.js +317 -0
- package/dist/test/integration/integration.test.js +30 -31
- package/dist/test/mockConfigFiles.d.ts +5 -0
- package/dist/test/mockConfigFiles.js +37 -0
- package/dist/test/nockHelpers.d.ts +3 -3
- package/dist/test/nockHelpers.js +7 -11
- package/dist/test/private/getDevAccessToken.js +1 -1
- package/dist/test/setupFiles/automatic-mocks.d.ts +0 -1
- package/dist/test/setupFiles/automatic-mocks.js +1 -51
- package/dist/types/Commit.d.ts +85 -0
- package/dist/types/Commit.js +139 -0
- package/dist/types/commitNode.d.ts +89 -0
- package/dist/types/commitNode.js +139 -0
- package/dist/types/commitNode.test.d.ts +1 -0
- package/dist/types/commitNode.test.js +255 -0
- package/dist/types/commitWithAssociatedPullRequests.d.ts +86 -0
- package/dist/types/commitWithAssociatedPullRequests.js +145 -0
- package/dist/ui/cherrypickAndCreatePullRequest.test.js +333 -76
- package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +11 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +138 -67
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +1 -0
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +468 -0
- package/dist/ui/getCommits.d.ts +1 -1
- package/dist/ui/getCommits.js +55 -25
- package/dist/ui/getTargetBranches.d.ts +3 -2
- package/dist/ui/getTargetBranches.js +33 -18
- package/dist/ui/getTargetBranches.test.js +75 -99
- package/dist/ui/getTargetBranchesFromLabels.d.ts +6 -0
- package/dist/ui/getTargetBranchesFromLabels.js +40 -0
- package/dist/ui/getTargetBranchesFromLabels.test.d.ts +1 -0
- package/dist/ui/getTargetBranchesFromLabels.test.js +288 -0
- package/dist/ui/maybeSetupRepo.js +11 -10
- package/dist/ui/maybeSetupRepo.test.js +54 -4
- package/dist/utils/excludeUndefined.d.ts +6 -0
- package/dist/utils/excludeUndefined.js +7 -0
- package/dist/utils/excludeUndefined.test.d.ts +1 -0
- package/dist/utils/excludeUndefined.test.js +24 -0
- package/package.json +37 -51
- package/yarn.lock +2416 -2987
|
@@ -1,50 +1,67 @@
|
|
|
1
1
|
import { Logger } from '../services/logger';
|
|
2
|
-
export interface
|
|
2
|
+
export interface TargetBranchChoice {
|
|
3
3
|
name: string;
|
|
4
4
|
checked?: boolean;
|
|
5
5
|
}
|
|
6
|
-
export declare type
|
|
6
|
+
export declare type TargetBranchChoiceOrString = string | TargetBranchChoice;
|
|
7
7
|
declare type AutoFixConflictsHandler = ({ files, directory, logger, targetBranch, }: {
|
|
8
8
|
files: string[];
|
|
9
9
|
directory: string;
|
|
10
10
|
logger: Logger;
|
|
11
11
|
targetBranch: string;
|
|
12
12
|
}) => boolean | Promise<boolean>;
|
|
13
|
-
|
|
14
|
-
accessToken
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
13
|
+
declare type Options = Partial<{
|
|
14
|
+
accessToken: string;
|
|
15
|
+
assignees: string[];
|
|
16
|
+
author: string | null;
|
|
17
|
+
autoAssign: boolean;
|
|
18
|
+
autoFixConflicts: AutoFixConflictsHandler;
|
|
19
|
+
autoMerge: boolean;
|
|
20
|
+
autoMergeMethod: string;
|
|
21
|
+
cherrypickRef: boolean;
|
|
22
|
+
ci: boolean;
|
|
23
|
+
commitPaths: string[];
|
|
24
|
+
details: boolean;
|
|
25
|
+
editor: string;
|
|
26
|
+
fork: boolean;
|
|
27
|
+
gitHostname: string;
|
|
28
|
+
githubApiBaseUrlV3: string;
|
|
29
|
+
githubApiBaseUrlV4: string;
|
|
30
|
+
maxNumber: number;
|
|
31
|
+
multiple: boolean;
|
|
32
|
+
multipleBranches: boolean;
|
|
33
|
+
multipleCommits: boolean;
|
|
34
|
+
noVerify: boolean;
|
|
35
|
+
prDescription: string;
|
|
36
|
+
prFilter: string;
|
|
37
|
+
prTitle: string;
|
|
38
|
+
pullNumber: number;
|
|
39
|
+
repoName: string;
|
|
40
|
+
repoOwner: string;
|
|
41
|
+
resetAuthor: boolean;
|
|
42
|
+
reviewers: string[];
|
|
43
|
+
sha: string;
|
|
44
|
+
skipRemoteConfig: boolean;
|
|
45
|
+
sourceBranch: string;
|
|
46
|
+
sourcePRLabels: string[];
|
|
47
|
+
targetBranchChoices: TargetBranchChoiceOrString[];
|
|
48
|
+
targetBranches: string[];
|
|
49
|
+
targetPRLabels: string[];
|
|
50
|
+
verbose: boolean;
|
|
51
|
+
}>;
|
|
52
|
+
export declare type ConfigFileOptions = Options & Partial<{
|
|
53
|
+
branchLabelMapping: Record<string, string>;
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated Replaced by `repoOwner` and `repoName`
|
|
56
|
+
*/
|
|
57
|
+
upstream: string;
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Replaced by `targetBranchChoices`
|
|
60
|
+
*/
|
|
61
|
+
branches: TargetBranchChoiceOrString[];
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated Replaced by `targetPRLabels`
|
|
64
|
+
*/
|
|
65
|
+
labels: string[];
|
|
66
|
+
}>;
|
|
50
67
|
export {};
|
|
@@ -1,48 +1,41 @@
|
|
|
1
|
-
import { ConfigOptions, BranchChoice } from './ConfigOptions';
|
|
2
1
|
export declare type OptionsFromCliArgs = ReturnType<typeof getOptionsFromCliArgs>;
|
|
3
|
-
export declare function getOptionsFromCliArgs(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
warn: (message: string, meta?: unknown) => void;
|
|
10
|
-
info: (message: string, meta?: unknown) => void;
|
|
11
|
-
verbose: (message: string, meta?: unknown) => void;
|
|
12
|
-
debug: (message: string, meta?: unknown) => void;
|
|
13
|
-
};
|
|
14
|
-
targetBranch: string;
|
|
15
|
-
}) => boolean | Promise<boolean>) | undefined;
|
|
2
|
+
export declare function getOptionsFromCliArgs(argv: readonly string[], { exitOnError }?: {
|
|
3
|
+
exitOnError?: boolean;
|
|
4
|
+
}): {
|
|
5
|
+
fork?: boolean | undefined;
|
|
6
|
+
verbose?: boolean | undefined;
|
|
7
|
+
accessToken?: string | undefined;
|
|
16
8
|
assignees: string[];
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
prTitle
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
resetAuthor
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
9
|
+
author?: string | null | undefined;
|
|
10
|
+
autoAssign?: boolean | undefined;
|
|
11
|
+
autoMerge?: boolean | undefined;
|
|
12
|
+
autoMergeMethod?: string | undefined;
|
|
13
|
+
cherrypickRef?: boolean | undefined;
|
|
14
|
+
ci?: boolean | undefined;
|
|
15
|
+
commitPaths: string[];
|
|
16
|
+
details?: boolean | undefined;
|
|
17
|
+
editor?: string | undefined;
|
|
18
|
+
gitHostname?: string | undefined;
|
|
19
|
+
githubApiBaseUrlV3?: string | undefined;
|
|
20
|
+
githubApiBaseUrlV4?: string | undefined;
|
|
21
|
+
maxNumber?: number | undefined;
|
|
22
|
+
multipleBranches?: boolean | undefined;
|
|
23
|
+
multipleCommits?: boolean | undefined;
|
|
24
|
+
noVerify?: boolean | undefined;
|
|
25
|
+
prDescription?: string | undefined;
|
|
26
|
+
prFilter?: string | undefined;
|
|
27
|
+
prTitle?: string | undefined;
|
|
28
|
+
pullNumber?: number | undefined;
|
|
29
|
+
repoName?: string | undefined;
|
|
30
|
+
repoOwner?: string | undefined;
|
|
31
|
+
resetAuthor?: boolean | undefined;
|
|
32
|
+
reviewers: string[];
|
|
33
|
+
sha?: string | undefined;
|
|
34
|
+
skipRemoteConfig?: boolean | undefined;
|
|
35
|
+
sourceBranch?: string | undefined;
|
|
36
|
+
sourcePRLabels?: string[] | undefined;
|
|
37
|
+
targetBranchChoices?: string[] | undefined;
|
|
38
|
+
targetBranches?: string[] | undefined;
|
|
39
|
+
targetPRLabels?: string[] | undefined;
|
|
40
|
+
mainline?: number | undefined;
|
|
48
41
|
};
|
package/dist/options/cliArgs.js
CHANGED
|
@@ -4,11 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getOptionsFromCliArgs = void 0;
|
|
7
|
-
const lodash_isstring_1 = __importDefault(require("lodash.isstring"));
|
|
8
7
|
const yargs_1 = __importDefault(require("yargs"));
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
8
|
+
const excludeUndefined_1 = require("../utils/excludeUndefined");
|
|
9
|
+
function getOptionsFromCliArgs(argv, { exitOnError = true } = {}) {
|
|
10
|
+
const yargsInstance = (0, yargs_1.default)(argv)
|
|
12
11
|
.parserConfiguration({
|
|
13
12
|
'strip-dashed': true,
|
|
14
13
|
'strip-aliased': true,
|
|
@@ -17,70 +16,77 @@ function getOptionsFromCliArgs(configOptions, argv) {
|
|
|
17
16
|
.usage('$0 [args]')
|
|
18
17
|
.wrap(Math.max(100, Math.min(120, yargs_1.default.terminalWidth())))
|
|
19
18
|
.option('accessToken', {
|
|
20
|
-
default: configOptions.accessToken,
|
|
21
19
|
alias: 'accesstoken',
|
|
22
20
|
description: 'Github access token',
|
|
23
21
|
type: 'string',
|
|
24
22
|
})
|
|
25
23
|
// show users own commits
|
|
26
24
|
.option('all', {
|
|
27
|
-
default: (_a = configOptions.all) !== null && _a !== void 0 ? _a : false,
|
|
28
25
|
description: 'List all commits',
|
|
29
26
|
alias: 'a',
|
|
30
27
|
type: 'boolean',
|
|
28
|
+
conflicts: 'author',
|
|
31
29
|
})
|
|
32
|
-
.option('
|
|
33
|
-
default: configOptions.author,
|
|
34
|
-
description: 'Show commits by specific author',
|
|
35
|
-
type: 'string',
|
|
36
|
-
})
|
|
37
|
-
.option('assignees', {
|
|
38
|
-
default: configOptions.assignees || [],
|
|
30
|
+
.option('assignee', {
|
|
39
31
|
description: 'Add assignees to the target pull request',
|
|
40
|
-
alias:
|
|
32
|
+
alias: 'assign',
|
|
41
33
|
type: 'array',
|
|
34
|
+
string: true,
|
|
35
|
+
conflicts: ['autoAssign'],
|
|
42
36
|
})
|
|
43
37
|
.option('autoAssign', {
|
|
44
|
-
default: (_b = configOptions.autoAssign) !== null && _b !== void 0 ? _b : false,
|
|
45
38
|
description: 'Auto assign the target pull request to yourself',
|
|
46
39
|
type: 'boolean',
|
|
40
|
+
conflicts: ['assignees'],
|
|
41
|
+
})
|
|
42
|
+
.option('autoMerge', {
|
|
43
|
+
description: 'Enable auto-merge for created pull requests',
|
|
44
|
+
type: 'boolean',
|
|
45
|
+
})
|
|
46
|
+
.option('autoMergeMethod', {
|
|
47
|
+
description: 'Sets auto-merge method when using --auto-merge. Default: merge',
|
|
48
|
+
type: 'string',
|
|
49
|
+
choices: ['merge', 'rebase', 'squash'],
|
|
47
50
|
})
|
|
48
51
|
.option('ci', {
|
|
49
|
-
default: (_c = configOptions.ci) !== null && _c !== void 0 ? _c : false,
|
|
50
52
|
description: 'Disable interactive prompts',
|
|
51
53
|
type: 'boolean',
|
|
52
54
|
})
|
|
53
|
-
.option('
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
.option('cherrypickRef', {
|
|
56
|
+
description: 'Append commit message with "(cherry picked from commit...)',
|
|
57
|
+
type: 'boolean',
|
|
58
|
+
conflicts: ['noCherrypickRef'],
|
|
59
|
+
})
|
|
60
|
+
.option('details', {
|
|
61
|
+
description: 'Show details about each commit',
|
|
56
62
|
type: 'boolean',
|
|
57
63
|
})
|
|
58
64
|
.option('editor', {
|
|
59
|
-
default: configOptions.editor,
|
|
60
65
|
description: 'Editor to be opened during conflict resolution',
|
|
61
66
|
type: 'string',
|
|
62
67
|
})
|
|
63
|
-
|
|
68
|
+
.option('skipRemoteConfig', {
|
|
69
|
+
description: 'Use local .backportrc.json config instead of loading from Github',
|
|
70
|
+
type: 'boolean',
|
|
71
|
+
})
|
|
72
|
+
// push target branch to {authenticatedUsername}/{repoName}
|
|
64
73
|
.option('fork', {
|
|
65
|
-
default: (_d = configOptions.fork) !== null && _d !== void 0 ? _d : true,
|
|
66
74
|
description: 'Create backports in fork or origin repo',
|
|
67
75
|
type: 'boolean',
|
|
76
|
+
conflicts: ['noFork'],
|
|
68
77
|
})
|
|
69
78
|
.option('gitHostname', {
|
|
70
79
|
hidden: true,
|
|
71
|
-
default: (_e = configOptions.gitHostname) !== null && _e !== void 0 ? _e : 'github.com',
|
|
72
80
|
description: 'Hostname for Github',
|
|
73
81
|
type: 'string',
|
|
74
82
|
})
|
|
75
83
|
.option('githubApiBaseUrlV3', {
|
|
76
84
|
hidden: true,
|
|
77
|
-
default: (_f = configOptions.githubApiBaseUrlV3) !== null && _f !== void 0 ? _f : 'https://api.github.com',
|
|
78
85
|
description: `Base url for Github's REST (v3) API`,
|
|
79
86
|
type: 'string',
|
|
80
87
|
})
|
|
81
88
|
.option('githubApiBaseUrlV4', {
|
|
82
89
|
hidden: true,
|
|
83
|
-
default: (_g = configOptions.githubApiBaseUrlV4) !== null && _g !== void 0 ? _g : 'https://api.github.com/graphql',
|
|
84
90
|
description: `Base url for Github's GraphQL (v4) API`,
|
|
85
91
|
type: 'string',
|
|
86
92
|
})
|
|
@@ -102,7 +108,6 @@ function getOptionsFromCliArgs(configOptions, argv) {
|
|
|
102
108
|
})
|
|
103
109
|
// display 10 commits to pick from
|
|
104
110
|
.option('maxNumber', {
|
|
105
|
-
default: (_h = configOptions.maxNumber) !== null && _h !== void 0 ? _h : 10,
|
|
106
111
|
description: 'Number of commits to choose from',
|
|
107
112
|
alias: ['number', 'n'],
|
|
108
113
|
type: 'number',
|
|
@@ -111,154 +116,168 @@ function getOptionsFromCliArgs(configOptions, argv) {
|
|
|
111
116
|
.option('multiple', {
|
|
112
117
|
description: 'Select multiple branches/commits',
|
|
113
118
|
type: 'boolean',
|
|
119
|
+
conflicts: ['multipleBranches', 'multipleCommits'],
|
|
114
120
|
})
|
|
115
121
|
// allow picking multiple target branches
|
|
116
122
|
.option('multipleBranches', {
|
|
117
|
-
default: (_j = configOptions.multipleBranches) !== null && _j !== void 0 ? _j : true,
|
|
118
123
|
description: 'Backport to multiple branches',
|
|
119
124
|
type: 'boolean',
|
|
125
|
+
conflicts: ['multiple'],
|
|
120
126
|
})
|
|
121
127
|
// allow picking multiple commits
|
|
122
128
|
.option('multipleCommits', {
|
|
123
|
-
default: (_k = configOptions.multipleCommits) !== null && _k !== void 0 ? _k : false,
|
|
124
129
|
description: 'Backport multiple commits',
|
|
125
130
|
type: 'boolean',
|
|
131
|
+
conflicts: ['multiple'],
|
|
132
|
+
})
|
|
133
|
+
.option('noCherrypickRef', {
|
|
134
|
+
description: 'Do not append commit message with "(cherry picked from commit...)"',
|
|
135
|
+
type: 'boolean',
|
|
136
|
+
conflicts: ['cherrypickRef'],
|
|
126
137
|
})
|
|
127
138
|
.option('noVerify', {
|
|
128
|
-
|
|
129
|
-
description: 'Bypasses the pre-commit and commit-msg hooks',
|
|
139
|
+
description: 'Bypass the pre-commit and commit-msg hooks',
|
|
130
140
|
type: 'boolean',
|
|
141
|
+
})
|
|
142
|
+
.option('noFork', {
|
|
143
|
+
description: 'Create backports in the origin repo',
|
|
144
|
+
type: 'boolean',
|
|
145
|
+
conflicts: ['fork'],
|
|
131
146
|
})
|
|
132
147
|
.option('path', {
|
|
133
|
-
default: configOptions.path,
|
|
134
148
|
description: 'Only list commits touching files under the specified path',
|
|
135
149
|
alias: 'p',
|
|
150
|
+
type: 'array',
|
|
151
|
+
string: true,
|
|
152
|
+
})
|
|
153
|
+
.option('prDescription', {
|
|
154
|
+
description: 'Description to be added to pull request',
|
|
155
|
+
alias: 'description',
|
|
136
156
|
type: 'string',
|
|
137
157
|
})
|
|
138
158
|
.option('prTitle', {
|
|
139
|
-
default: (_m = configOptions.prTitle) !== null && _m !== void 0 ? _m : '[{targetBranch}] {commitMessages}',
|
|
140
159
|
description: 'Title of pull request',
|
|
141
160
|
alias: 'title',
|
|
142
161
|
type: 'string',
|
|
143
|
-
})
|
|
144
|
-
.option('prDescription', {
|
|
145
|
-
default: configOptions.prDescription,
|
|
146
|
-
description: 'Description to be added to pull request',
|
|
147
|
-
alias: 'description',
|
|
148
|
-
type: 'string',
|
|
149
162
|
})
|
|
150
163
|
.option('prFilter', {
|
|
151
|
-
default: configOptions.prFilter,
|
|
152
164
|
conflicts: ['pullNumber', 'sha'],
|
|
153
165
|
description: `Filter source pull requests by a query`,
|
|
154
166
|
type: 'string',
|
|
155
167
|
})
|
|
156
168
|
.option('pullNumber', {
|
|
157
|
-
default: configOptions.pullNumber,
|
|
158
169
|
conflicts: ['sha', 'prFilter'],
|
|
159
170
|
description: 'Pull request to backport',
|
|
160
171
|
alias: 'pr',
|
|
161
172
|
type: 'number',
|
|
162
173
|
})
|
|
163
174
|
.option('resetAuthor', {
|
|
164
|
-
default: (_o = configOptions.resetAuthor) !== null && _o !== void 0 ? _o : false,
|
|
165
175
|
description: 'Set yourself as commit author',
|
|
166
176
|
type: 'boolean',
|
|
177
|
+
})
|
|
178
|
+
.option('reviewer', {
|
|
179
|
+
description: 'Add reviewer to the target PR',
|
|
180
|
+
type: 'array',
|
|
181
|
+
string: true,
|
|
182
|
+
})
|
|
183
|
+
.option('repoOwner', {
|
|
184
|
+
description: 'Repository owner',
|
|
185
|
+
type: 'string',
|
|
186
|
+
})
|
|
187
|
+
.option('repoName', {
|
|
188
|
+
description: 'Repository name',
|
|
189
|
+
type: 'string',
|
|
167
190
|
})
|
|
168
191
|
.option('sha', {
|
|
169
|
-
default: configOptions.sha,
|
|
170
192
|
conflicts: ['pullNumber', 'prFilter'],
|
|
171
193
|
description: 'Commit sha to backport',
|
|
172
194
|
alias: 'commit',
|
|
173
195
|
type: 'string',
|
|
174
196
|
})
|
|
175
197
|
.option('sourceBranch', {
|
|
176
|
-
default: configOptions.sourceBranch,
|
|
177
198
|
description: `Specify a non-default branch (normally "master") to backport from`,
|
|
178
199
|
type: 'string',
|
|
179
200
|
})
|
|
180
|
-
.option('
|
|
181
|
-
default: (_p = configOptions.sourcePRLabels) !== null && _p !== void 0 ? _p : [],
|
|
201
|
+
.option('sourcePRLabel', {
|
|
182
202
|
description: 'Add labels to the source (original) PR',
|
|
183
|
-
alias:
|
|
203
|
+
alias: 'sourcePrLabel',
|
|
184
204
|
type: 'array',
|
|
205
|
+
string: true,
|
|
185
206
|
})
|
|
186
|
-
.option('
|
|
187
|
-
default: configOptions.targetBranches || [],
|
|
207
|
+
.option('targetBranch', {
|
|
188
208
|
description: 'Branch(es) to backport to',
|
|
189
|
-
alias: ['
|
|
209
|
+
alias: ['branch', 'b'],
|
|
190
210
|
type: 'array',
|
|
191
|
-
string: true,
|
|
211
|
+
string: true, // ensure `6.0` is not coerced to `6`
|
|
192
212
|
})
|
|
193
|
-
.option('
|
|
194
|
-
// backwards-compatability: `branches` was renamed `targetBranchChoices`
|
|
195
|
-
default: (_r = (_q = configOptions.targetBranchChoices) !== null && _q !== void 0 ? _q : configOptions.branches) !== null && _r !== void 0 ? _r : [],
|
|
213
|
+
.option('targetBranchChoice', {
|
|
196
214
|
description: 'List branches to backport to',
|
|
197
|
-
alias: 'targetBranchChoice',
|
|
198
215
|
type: 'array',
|
|
216
|
+
string: true,
|
|
199
217
|
})
|
|
200
|
-
.option('
|
|
201
|
-
// backwards-compatability: `labels` was renamed `targetPRLabels`
|
|
202
|
-
default: (_t = (_s = configOptions.targetPRLabels) !== null && _s !== void 0 ? _s : configOptions.labels) !== null && _t !== void 0 ? _t : [],
|
|
218
|
+
.option('targetPRLabel', {
|
|
203
219
|
description: 'Add labels to the target (backport) PR',
|
|
204
|
-
alias: ['
|
|
220
|
+
alias: ['label', 'l'],
|
|
205
221
|
type: 'array',
|
|
222
|
+
string: true,
|
|
206
223
|
})
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
type: 'boolean',
|
|
211
|
-
})
|
|
212
|
-
.option('upstream', {
|
|
213
|
-
default: configOptions.upstream,
|
|
214
|
-
description: 'Name of repository',
|
|
215
|
-
alias: 'up',
|
|
216
|
-
type: 'string',
|
|
217
|
-
})
|
|
218
|
-
.option('username', {
|
|
219
|
-
default: configOptions.username,
|
|
220
|
-
description: 'Github username',
|
|
224
|
+
.option('author', {
|
|
225
|
+
description: 'Show commits by a specific user',
|
|
226
|
+
alias: 'author',
|
|
221
227
|
type: 'string',
|
|
228
|
+
conflicts: 'all',
|
|
222
229
|
})
|
|
223
230
|
.option('verbose', {
|
|
224
|
-
default: (_u = configOptions.verbose) !== null && _u !== void 0 ? _u : false,
|
|
225
231
|
description: 'Show additional debug information',
|
|
226
232
|
type: 'boolean',
|
|
233
|
+
})
|
|
234
|
+
// cli-only
|
|
235
|
+
.option('verify', {
|
|
236
|
+
description: `Opposite of no-verify`,
|
|
237
|
+
type: 'boolean',
|
|
227
238
|
})
|
|
228
239
|
.alias('version', 'v')
|
|
229
240
|
.alias('version', 'V')
|
|
230
241
|
.help()
|
|
231
|
-
.epilogue('For bugs, feature requests or questions: https://github.com/sqren/backport/issues\nOr contact me directly: https://twitter.com/sorenlouv')
|
|
232
|
-
//
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
+
.epilogue('For bugs, feature requests or questions: https://github.com/sqren/backport/issues\nOr contact me directly: https://twitter.com/sorenlouv');
|
|
243
|
+
// don't kill process upon error
|
|
244
|
+
// and don't log error to console
|
|
245
|
+
if (!exitOnError) {
|
|
246
|
+
yargsInstance.fail((msg, err) => {
|
|
247
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
248
|
+
if (err) {
|
|
249
|
+
throw err;
|
|
250
|
+
}
|
|
251
|
+
throw new Error(msg);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
const {
|
|
255
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
256
|
+
$0, _,
|
|
257
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
258
|
+
multiple, multipleBranches, multipleCommits, all, author,
|
|
259
|
+
// negations
|
|
260
|
+
verify, noVerify, noCherrypickRef, noFork,
|
|
261
|
+
// array types (should be renamed to plural form)
|
|
262
|
+
assignee, path, reviewer, sourcePRLabel, targetBranch, targetBranchChoice, targetPRLabel, ...restOptions } = yargsInstance.parseSync();
|
|
263
|
+
return (0, excludeUndefined_1.excludeUndefined)({
|
|
264
|
+
...restOptions,
|
|
265
|
+
author: all ? null : author,
|
|
242
266
|
// `multiple` is a cli-only flag to override `multipleBranches` and `multipleCommits`
|
|
243
|
-
multipleBranches: multiple
|
|
244
|
-
multipleCommits: multiple
|
|
245
|
-
//
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
//
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
return {
|
|
258
|
-
name: choice,
|
|
259
|
-
checked: false,
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
return choice;
|
|
267
|
+
multipleBranches: multiple ?? multipleBranches,
|
|
268
|
+
multipleCommits: multiple ?? multipleCommits,
|
|
269
|
+
// rename array types to plural
|
|
270
|
+
assignees: assignee ?? [],
|
|
271
|
+
commitPaths: path ?? [],
|
|
272
|
+
reviewers: reviewer ?? [],
|
|
273
|
+
sourcePRLabels: sourcePRLabel,
|
|
274
|
+
targetBranchChoices: targetBranchChoice,
|
|
275
|
+
targetBranches: targetBranch,
|
|
276
|
+
targetPRLabels: targetPRLabel,
|
|
277
|
+
// negations (cli-only flags)
|
|
278
|
+
cherrypickRef: noCherrypickRef === true ? false : restOptions.cherrypickRef,
|
|
279
|
+
fork: noFork === true ? false : restOptions.fork,
|
|
280
|
+
noVerify: verify ?? noVerify,
|
|
263
281
|
});
|
|
264
282
|
}
|
|
283
|
+
exports.getOptionsFromCliArgs = getOptionsFromCliArgs;
|