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/dist/ink.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function renderInk(): void;
|
package/dist/ink.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.renderInk = void 0;
|
|
26
|
-
const ink_1 = require("ink");
|
|
27
|
-
const ink_spinner_1 = __importDefault(require("ink-spinner"));
|
|
28
|
-
const react_1 = __importStar(require("react"));
|
|
29
|
-
const Example = () => {
|
|
30
|
-
const [message, setMessage] = (0, react_1.useState)();
|
|
31
|
-
(0, react_1.useEffect)(() => {
|
|
32
|
-
setTimeout(() => {
|
|
33
|
-
setMessage('Received message');
|
|
34
|
-
}, 5000);
|
|
35
|
-
});
|
|
36
|
-
if (!message) {
|
|
37
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
38
|
-
react_1.default.createElement(ink_1.Box, null,
|
|
39
|
-
react_1.default.createElement(ink_1.Box, { marginRight: 1 },
|
|
40
|
-
react_1.default.createElement(ink_1.Text, { color: 'cyan' },
|
|
41
|
-
react_1.default.createElement(ink_spinner_1.default, { type: "dots" }))),
|
|
42
|
-
react_1.default.createElement(ink_1.Text, null, "Loading via ink!!"))));
|
|
43
|
-
}
|
|
44
|
-
return react_1.default.createElement(ink_1.Text, null, message);
|
|
45
|
-
};
|
|
46
|
-
function renderInk() {
|
|
47
|
-
(0, ink_1.render)(react_1.default.createElement(Example, null));
|
|
48
|
-
}
|
|
49
|
-
exports.renderInk = renderInk;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const cliArgs_1 = require("./cliArgs");
|
|
4
|
-
describe('getOptionsFromCliArgs', () => {
|
|
5
|
-
describe('yargs settings', () => {
|
|
6
|
-
it('should accept both camel-case and dashed-case and convert them to camel cased', () => {
|
|
7
|
-
const argv = [
|
|
8
|
-
'--access-token',
|
|
9
|
-
'my access token',
|
|
10
|
-
'--githubApiBaseUrlV3',
|
|
11
|
-
'my api hostname',
|
|
12
|
-
];
|
|
13
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
14
|
-
expect(res.accessToken).toEqual('my access token');
|
|
15
|
-
expect('access-token' in res).toEqual(false);
|
|
16
|
-
expect(res.githubApiBaseUrlV3).toEqual('my api hostname');
|
|
17
|
-
expect('api-hostname' in res).toEqual(false);
|
|
18
|
-
});
|
|
19
|
-
it('strips undefined values from the object', () => {
|
|
20
|
-
const argv = [
|
|
21
|
-
'--access-token',
|
|
22
|
-
'my access token',
|
|
23
|
-
'--repo-owner',
|
|
24
|
-
'elastic',
|
|
25
|
-
'--repo-name',
|
|
26
|
-
'kibana',
|
|
27
|
-
];
|
|
28
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
29
|
-
expect(res).toEqual({
|
|
30
|
-
accessToken: 'my access token',
|
|
31
|
-
repoOwner: 'elastic',
|
|
32
|
-
repoName: 'kibana',
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
// blocked by: https://github.com/yargs/yargs/issues/1853
|
|
37
|
-
describe('help', () => {
|
|
38
|
-
// eslint-disable-next-line jest/no-commented-out-tests
|
|
39
|
-
// it('should output help', () => {
|
|
40
|
-
// const argv = ['--help'];
|
|
41
|
-
// expect(() =>
|
|
42
|
-
// getOptionsFromCliArgs(argv, { exitOnError: false, returnHelp: true })
|
|
43
|
-
// ).toThrow('asa');
|
|
44
|
-
// });
|
|
45
|
-
});
|
|
46
|
-
describe('sourcePRLabels', () => {
|
|
47
|
-
it('should handle all variations', () => {
|
|
48
|
-
const argv = [
|
|
49
|
-
'--sourcePRLabel',
|
|
50
|
-
'label a',
|
|
51
|
-
'--sourcePrLabel',
|
|
52
|
-
'label b',
|
|
53
|
-
'--source-pr-label',
|
|
54
|
-
'label c',
|
|
55
|
-
];
|
|
56
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
57
|
-
expect(res.sourcePRLabels).toEqual(['label a', 'label b', 'label c']);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
describe('pullNumber', () => {
|
|
61
|
-
it('should accept `--pr` alias but only return the full representation (`pullNumber`)', () => {
|
|
62
|
-
const argv = ['--pr', '1337'];
|
|
63
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
64
|
-
expect(res.pullNumber).toEqual(1337);
|
|
65
|
-
//@ts-expect-error
|
|
66
|
-
expect(res.pr).toBe(undefined);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
describe('assignees', () => {
|
|
70
|
-
it('--assignee', () => {
|
|
71
|
-
const argv = ['--assignee', 'john'];
|
|
72
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
73
|
-
expect(res.assignees).toEqual(['john']);
|
|
74
|
-
});
|
|
75
|
-
it('--assign', () => {
|
|
76
|
-
const argv = ['--assign', 'john'];
|
|
77
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
78
|
-
expect(res.assignees).toEqual(['john']);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
describe('multipleBranches', () => {
|
|
82
|
-
it('should be undefined by default', () => {
|
|
83
|
-
const argv = [];
|
|
84
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
85
|
-
expect(res.multipleBranches).toBe(undefined);
|
|
86
|
-
});
|
|
87
|
-
it('should set to true', () => {
|
|
88
|
-
const argv = ['--multiple-branches', 'true'];
|
|
89
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
90
|
-
expect(res.multipleBranches).toBe(true);
|
|
91
|
-
});
|
|
92
|
-
it('should set to false', () => {
|
|
93
|
-
const argv = ['--multiple-branches', 'false'];
|
|
94
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
95
|
-
expect(res.multipleBranches).toBe(false);
|
|
96
|
-
});
|
|
97
|
-
it('should respect `multiple` option', () => {
|
|
98
|
-
const argv = ['--multiple'];
|
|
99
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
100
|
-
expect(res.multipleBranches).toBe(true);
|
|
101
|
-
});
|
|
102
|
-
it('should conflict when using both', () => {
|
|
103
|
-
const argv = ['--multiple', '--multiple-branches', 'false'];
|
|
104
|
-
expect(() => (0, cliArgs_1.getOptionsFromCliArgs)(argv, { exitOnError: false })).toThrow('Arguments multiple and multipleBranches are mutually exclusive');
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
describe('noVerify', () => {
|
|
108
|
-
it('should be undefined by default', () => {
|
|
109
|
-
const argv = [];
|
|
110
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
111
|
-
expect(res.noVerify).toBe(undefined);
|
|
112
|
-
});
|
|
113
|
-
it('should set to false', () => {
|
|
114
|
-
const argv = ['--no-verify', 'false'];
|
|
115
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
116
|
-
expect(res.noVerify).toBe(false);
|
|
117
|
-
});
|
|
118
|
-
it('should set to true', () => {
|
|
119
|
-
const argv = ['--no-verify', 'true'];
|
|
120
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
121
|
-
expect(res.noVerify).toBe(true);
|
|
122
|
-
});
|
|
123
|
-
it('should be enabled by `verify`', () => {
|
|
124
|
-
const argv = ['--verify'];
|
|
125
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
126
|
-
expect(res.noVerify).toBe(true);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
describe('mainline', () => {
|
|
130
|
-
it('should default to 1', () => {
|
|
131
|
-
const argv = ['--mainline'];
|
|
132
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
133
|
-
expect(res.mainline).toEqual(1);
|
|
134
|
-
});
|
|
135
|
-
it('should accept numbers', () => {
|
|
136
|
-
const argv = ['--mainline', '2'];
|
|
137
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
138
|
-
expect(res.mainline).toEqual(2);
|
|
139
|
-
});
|
|
140
|
-
it('should throw on invalid values', () => {
|
|
141
|
-
const argv = ['--mainline', 'foo'];
|
|
142
|
-
expect(() => (0, cliArgs_1.getOptionsFromCliArgs)(argv, { exitOnError: false })).toThrowError('--mainline must be an integer. Received: NaN');
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
describe('targetBranches', () => {
|
|
146
|
-
it('should not coerce 6.0 to 6', () => {
|
|
147
|
-
const argv = ['-b', '6.0'];
|
|
148
|
-
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
149
|
-
expect(res.targetBranches).toEqual(['6.0']);
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const mockConfigFiles_1 = require("../../test/mockConfigFiles");
|
|
4
|
-
const config_1 = require("./config");
|
|
5
|
-
describe('getOptionsFromConfigFiles', () => {
|
|
6
|
-
let res;
|
|
7
|
-
beforeEach(async () => {
|
|
8
|
-
(0, mockConfigFiles_1.mockConfigFiles)({
|
|
9
|
-
globalConfig: { accessToken: 'abc', editor: 'vim' },
|
|
10
|
-
projectConfig: { repoName: 'kibana', repoOwner: 'elastic' },
|
|
11
|
-
});
|
|
12
|
-
res = await (0, config_1.getOptionsFromConfigFiles)();
|
|
13
|
-
});
|
|
14
|
-
it('should return values from config files', () => {
|
|
15
|
-
expect(res).toEqual({
|
|
16
|
-
accessToken: 'abc',
|
|
17
|
-
editor: 'vim',
|
|
18
|
-
repoName: 'kibana',
|
|
19
|
-
repoOwner: 'elastic',
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOptionsFromGit = void 0;
|
|
4
|
-
const git_1 = require("../../services/git");
|
|
5
|
-
async function getOptionsFromGit() {
|
|
6
|
-
return (0, git_1.getRepoOwnerAndNameFromGitRemote)();
|
|
7
|
-
}
|
|
8
|
-
exports.getOptionsFromGit = getOptionsFromGit;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const os_1 = __importDefault(require("os"));
|
|
26
|
-
const make_dir_1 = __importDefault(require("make-dir"));
|
|
27
|
-
const fs = __importStar(require("../../services/fs-promisified"));
|
|
28
|
-
const globalConfig_1 = require("./globalConfig");
|
|
29
|
-
describe('config', () => {
|
|
30
|
-
afterEach(() => jest.clearAllMocks());
|
|
31
|
-
beforeEach(() => {
|
|
32
|
-
jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
|
|
33
|
-
});
|
|
34
|
-
describe('getGlobalConfig', () => {
|
|
35
|
-
let res;
|
|
36
|
-
beforeEach(async () => {
|
|
37
|
-
jest.spyOn(fs, 'chmod').mockResolvedValueOnce();
|
|
38
|
-
jest.spyOn(fs, 'writeFile').mockResolvedValueOnce();
|
|
39
|
-
jest.spyOn(fs, 'readFile').mockResolvedValueOnce(JSON.stringify({
|
|
40
|
-
accessToken: 'myAccessToken',
|
|
41
|
-
}));
|
|
42
|
-
res = await (0, globalConfig_1.getGlobalConfig)();
|
|
43
|
-
});
|
|
44
|
-
it("should create config if it doesn't exist", () => {
|
|
45
|
-
expect(fs.writeFile).toHaveBeenCalledWith('/myHomeDir/.backport/config.json', expect.any(String), { flag: 'wx', mode: 384 });
|
|
46
|
-
});
|
|
47
|
-
it("should create config folders if it they don't exist", () => {
|
|
48
|
-
expect(make_dir_1.default).toHaveBeenCalledWith('/myHomeDir/.backport/repositories');
|
|
49
|
-
});
|
|
50
|
-
it('should load config', () => {
|
|
51
|
-
expect(fs.readFile).toHaveBeenCalledWith('/myHomeDir/.backport/config.json', 'utf8');
|
|
52
|
-
});
|
|
53
|
-
it('should return config', () => {
|
|
54
|
-
expect(res).toEqual({
|
|
55
|
-
accessToken: 'myAccessToken',
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
describe('createGlobalConfigIfNotExist', () => {
|
|
60
|
-
it('should create config and succeed', async () => {
|
|
61
|
-
jest.spyOn(fs, 'writeFile').mockResolvedValueOnce(undefined);
|
|
62
|
-
const didCreate = await (0, globalConfig_1.createGlobalConfigIfNotExist)('/path/to/globalConfig', 'myConfigTemplate');
|
|
63
|
-
expect(didCreate).toEqual(true);
|
|
64
|
-
expect(fs.writeFile).toHaveBeenCalledWith('/path/to/globalConfig', expect.stringContaining('myConfigTemplate'), { flag: 'wx', mode: 384 });
|
|
65
|
-
});
|
|
66
|
-
it('should not fail if config already exists', async () => {
|
|
67
|
-
const err = new Error();
|
|
68
|
-
err.code = 'EEXIST';
|
|
69
|
-
jest.spyOn(fs, 'writeFile').mockRejectedValueOnce(err);
|
|
70
|
-
const didCreate = await (0, globalConfig_1.createGlobalConfigIfNotExist)('myPath', 'myConfigTemplate');
|
|
71
|
-
expect(didCreate).toEqual(false);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const find_up_1 = __importDefault(require("find-up"));
|
|
26
|
-
const fs = __importStar(require("../../services/fs-promisified"));
|
|
27
|
-
const projectConfig_1 = require("./projectConfig");
|
|
28
|
-
describe('getProjectConfig', () => {
|
|
29
|
-
afterEach(() => jest.clearAllMocks());
|
|
30
|
-
describe('deprecations', () => {
|
|
31
|
-
describe('when specifying deprecated `branches`', () => {
|
|
32
|
-
it('is returned as `targetBranchChoices`', async () => {
|
|
33
|
-
jest.spyOn(fs, 'readFile').mockResolvedValueOnce(JSON.stringify({
|
|
34
|
-
repoName: 'kibana',
|
|
35
|
-
repoOwner: 'elastic',
|
|
36
|
-
branches: ['6.x'],
|
|
37
|
-
}));
|
|
38
|
-
const projectConfig = await (0, projectConfig_1.getProjectConfig)();
|
|
39
|
-
expect(projectConfig?.targetBranchChoices).toEqual(['6.x']);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
describe('when specifying deprecated `labels`', () => {
|
|
43
|
-
it('is returned as `targetPRLabels`', async () => {
|
|
44
|
-
jest.spyOn(fs, 'readFile').mockResolvedValueOnce(JSON.stringify({
|
|
45
|
-
labels: ['backport'],
|
|
46
|
-
}));
|
|
47
|
-
const projectConfig = await (0, projectConfig_1.getProjectConfig)();
|
|
48
|
-
expect(projectConfig?.targetPRLabels).toEqual(['backport']);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
describe('when specifying deprecated `upstream`', () => {
|
|
52
|
-
it('is split into `repoOwner` and `repoName`', async () => {
|
|
53
|
-
jest.spyOn(fs, 'readFile').mockResolvedValueOnce(JSON.stringify({
|
|
54
|
-
upstream: 'elastic/kibana',
|
|
55
|
-
}));
|
|
56
|
-
const projectConfig = await (0, projectConfig_1.getProjectConfig)();
|
|
57
|
-
expect(projectConfig?.repoOwner).toEqual('elastic');
|
|
58
|
-
expect(projectConfig?.repoName).toEqual('kibana');
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
describe('when projectConfig is valid', () => {
|
|
62
|
-
let projectConfig;
|
|
63
|
-
beforeEach(async () => {
|
|
64
|
-
jest.spyOn(fs, 'readFile').mockResolvedValueOnce(JSON.stringify({
|
|
65
|
-
repoName: 'kibana',
|
|
66
|
-
repoOwner: 'elastic',
|
|
67
|
-
targetBranchChoices: ['6.x'],
|
|
68
|
-
targetPRLabels: ['backport'],
|
|
69
|
-
}));
|
|
70
|
-
projectConfig = await (0, projectConfig_1.getProjectConfig)();
|
|
71
|
-
});
|
|
72
|
-
it('should call findUp', () => {
|
|
73
|
-
expect(find_up_1.default).toHaveBeenCalledWith('.backportrc.json');
|
|
74
|
-
});
|
|
75
|
-
it('should return config', () => {
|
|
76
|
-
expect(projectConfig).toEqual({
|
|
77
|
-
repoName: 'kibana',
|
|
78
|
-
repoOwner: 'elastic',
|
|
79
|
-
targetBranchChoices: ['6.x'],
|
|
80
|
-
targetPRLabels: ['backport'],
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
describe('when projectConfig is empty', () => {
|
|
86
|
-
it('should return empty config', async () => {
|
|
87
|
-
jest.spyOn(fs, 'readFile').mockResolvedValueOnce('{}');
|
|
88
|
-
const projectConfig = await (0, projectConfig_1.getProjectConfig)();
|
|
89
|
-
expect(projectConfig).toEqual({});
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
describe('when projectConfig is missing', () => {
|
|
93
|
-
it('should return empty config', async () => {
|
|
94
|
-
find_up_1.default.mockReturnValueOnce(undefined);
|
|
95
|
-
const projectConfig = await (0, projectConfig_1.getProjectConfig)();
|
|
96
|
-
expect(projectConfig).toEqual(undefined);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { OptionsFromCliArgs } from './cliArgs';
|
|
2
|
-
export declare type ValidatedOptions = ReturnType<typeof getValidatedOptions>;
|
|
3
|
-
export declare function getValidatedOptions({ upstream, ...options }: OptionsFromCliArgs): {
|
|
4
|
-
accessToken: string;
|
|
5
|
-
username: string;
|
|
6
|
-
repoName: string;
|
|
7
|
-
repoOwner: string;
|
|
8
|
-
author: string;
|
|
9
|
-
all: boolean;
|
|
10
|
-
autoFixConflicts: (({ files, directory, logger, targetBranch, }: {
|
|
11
|
-
files: string[];
|
|
12
|
-
directory: string;
|
|
13
|
-
logger: {
|
|
14
|
-
error: (message: string, meta?: unknown) => void;
|
|
15
|
-
warn: (message: string, meta?: unknown) => void;
|
|
16
|
-
info: (message: string, meta?: unknown) => void;
|
|
17
|
-
verbose: (message: string, meta?: unknown) => void;
|
|
18
|
-
debug: (message: string, meta?: unknown) => void;
|
|
19
|
-
};
|
|
20
|
-
targetBranch: string;
|
|
21
|
-
}) => boolean | Promise<boolean>) | undefined;
|
|
22
|
-
assignees: string[];
|
|
23
|
-
branchLabelMapping: Record<string, string> | undefined;
|
|
24
|
-
multipleBranches: boolean;
|
|
25
|
-
multipleCommits: boolean;
|
|
26
|
-
noVerify: boolean;
|
|
27
|
-
targetBranchChoices: import("./ConfigOptions").BranchChoice[];
|
|
28
|
-
ci: boolean;
|
|
29
|
-
dryRun: boolean;
|
|
30
|
-
editor: string | undefined;
|
|
31
|
-
fork: boolean;
|
|
32
|
-
gitHostname: string;
|
|
33
|
-
githubApiBaseUrlV3: string;
|
|
34
|
-
githubApiBaseUrlV4: string;
|
|
35
|
-
mainline: number | undefined;
|
|
36
|
-
maxNumber: number;
|
|
37
|
-
path: string | undefined;
|
|
38
|
-
prTitle: string;
|
|
39
|
-
prDescription: string | undefined;
|
|
40
|
-
prFilter: string | undefined;
|
|
41
|
-
pullNumber: number | undefined;
|
|
42
|
-
resetAuthor: boolean;
|
|
43
|
-
sha: string | undefined;
|
|
44
|
-
sourceBranch: string | undefined;
|
|
45
|
-
sourcePRLabels: string[];
|
|
46
|
-
targetBranches: string[];
|
|
47
|
-
targetPRLabels: string[];
|
|
48
|
-
verbose: boolean;
|
|
49
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getValidatedOptions = void 0;
|
|
7
|
-
const lodash_isempty_1 = __importDefault(require("lodash.isempty"));
|
|
8
|
-
const HandledError_1 = require("../services/HandledError");
|
|
9
|
-
const env_1 = require("../services/env");
|
|
10
|
-
const GLOBAL_CONFIG_DOCS_LINK = 'https://github.com/sqren/backport/blob/e119d71d6dc03cd061f6ad9b9a8b1cd995f98961/docs/configuration.md#global-config-backportconfigjson';
|
|
11
|
-
const PROJECT_CONFIG_DOCS_LINK = 'https://github.com/sqren/backport/blob/e119d71d6dc03cd061f6ad9b9a8b1cd995f98961/docs/configuration.md#project-config-backportrcjson';
|
|
12
|
-
function getValidatedOptions({
|
|
13
|
-
// omit `upstream` from options
|
|
14
|
-
upstream, ...options }) {
|
|
15
|
-
// ensure accessToken and username are given
|
|
16
|
-
if (!options.accessToken || !options.username) {
|
|
17
|
-
const globalConfigPath = env_1.getGlobalConfigPath();
|
|
18
|
-
throw new HandledError_1.HandledError(`Please update your config file: ${globalConfigPath}.\nIt must contain a valid "username" and "accessToken".\n\nRead more: ${GLOBAL_CONFIG_DOCS_LINK}`);
|
|
19
|
-
}
|
|
20
|
-
// ensure `targetBranches` or `targetBranchChoices` are given
|
|
21
|
-
if (lodash_isempty_1.default(options.targetBranches) &&
|
|
22
|
-
lodash_isempty_1.default(options.targetBranchChoices) &&
|
|
23
|
-
// this is primarily necessary on CI where `targetBranches` and `targetBranchChoices` and not given
|
|
24
|
-
lodash_isempty_1.default(options.branchLabelMapping)) {
|
|
25
|
-
throw new HandledError_1.HandledError(`You must specify a target branch\n\nYou can specify it via either:\n - Config file (recommended): ".backportrc.json". Read more: ${PROJECT_CONFIG_DOCS_LINK}\n - CLI: "--branch 6.1"`);
|
|
26
|
-
}
|
|
27
|
-
// ensure a valid upstream is given
|
|
28
|
-
const [repoOwner, repoName] = (upstream !== null && upstream !== void 0 ? upstream : '').split('/');
|
|
29
|
-
if (!repoOwner || !repoName) {
|
|
30
|
-
throw new HandledError_1.HandledError(`You must specify a valid Github repository\n\nYou can specify it via either:\n - Config file (recommended): ".backportrc.json". Read more: ${PROJECT_CONFIG_DOCS_LINK}\n - CLI: "--upstream elastic/kibana"`);
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
...options,
|
|
34
|
-
// no longer optional
|
|
35
|
-
accessToken: options.accessToken,
|
|
36
|
-
username: options.username,
|
|
37
|
-
// split upstream
|
|
38
|
-
repoName,
|
|
39
|
-
repoOwner,
|
|
40
|
-
// define author
|
|
41
|
-
author: options.author || options.username,
|
|
42
|
-
all: options.author ? false : options.all,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
exports.getValidatedOptions = getValidatedOptions;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const getValidatedOptions_1 = require("./getValidatedOptions");
|
|
4
|
-
describe('getValidatedOptions', () => {
|
|
5
|
-
const validOptions = {
|
|
6
|
-
accessToken: 'myAccessToken',
|
|
7
|
-
all: false,
|
|
8
|
-
assignees: [],
|
|
9
|
-
author: undefined,
|
|
10
|
-
autoFixConflicts: undefined,
|
|
11
|
-
branchLabelMapping: undefined,
|
|
12
|
-
ci: false,
|
|
13
|
-
dryRun: false,
|
|
14
|
-
editor: 'code',
|
|
15
|
-
fork: true,
|
|
16
|
-
gitHostname: 'github.com',
|
|
17
|
-
githubApiBaseUrlV3: 'https://api.github.com',
|
|
18
|
-
githubApiBaseUrlV4: 'https://api.github.com/graphql',
|
|
19
|
-
mainline: undefined,
|
|
20
|
-
maxNumber: 10,
|
|
21
|
-
multipleBranches: true,
|
|
22
|
-
multipleCommits: false,
|
|
23
|
-
noVerify: true,
|
|
24
|
-
path: undefined,
|
|
25
|
-
prDescription: undefined,
|
|
26
|
-
prTitle: 'myPrTitle',
|
|
27
|
-
pullNumber: undefined,
|
|
28
|
-
resetAuthor: false,
|
|
29
|
-
sha: undefined,
|
|
30
|
-
sourceBranch: 'mySourceBranch',
|
|
31
|
-
sourcePRLabels: [],
|
|
32
|
-
prFilter: undefined,
|
|
33
|
-
targetBranchChoices: [],
|
|
34
|
-
targetBranches: ['branchA'],
|
|
35
|
-
targetPRLabels: [],
|
|
36
|
-
upstream: 'elastic/kibana',
|
|
37
|
-
username: 'sqren',
|
|
38
|
-
verbose: false,
|
|
39
|
-
};
|
|
40
|
-
describe('should not throw', () => {
|
|
41
|
-
it('when all options are valid and `branches` is given', () => {
|
|
42
|
-
expect(() => getValidatedOptions_1.getValidatedOptions(validOptions)).not.toThrow();
|
|
43
|
-
});
|
|
44
|
-
it('when `targetBranchChoices` is given instead of `targetBranches`', () => {
|
|
45
|
-
expect(() => getValidatedOptions_1.getValidatedOptions({
|
|
46
|
-
...validOptions,
|
|
47
|
-
targetBranchChoices: [{ name: 'branchA' }],
|
|
48
|
-
targetBranches: [],
|
|
49
|
-
})).not.toThrow();
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
describe('should throw', () => {
|
|
53
|
-
it('when accessToken is missing', () => {
|
|
54
|
-
expect(() => getValidatedOptions_1.getValidatedOptions({
|
|
55
|
-
...validOptions,
|
|
56
|
-
accessToken: undefined,
|
|
57
|
-
})).toThrowErrorMatchingSnapshot();
|
|
58
|
-
});
|
|
59
|
-
it('when accessToken is empty', () => {
|
|
60
|
-
expect(() => getValidatedOptions_1.getValidatedOptions({
|
|
61
|
-
...validOptions,
|
|
62
|
-
accessToken: '',
|
|
63
|
-
})).toThrowErrorMatchingSnapshot();
|
|
64
|
-
});
|
|
65
|
-
it('when both `targetBranches` and `targetBranchChoices` are missing', () => {
|
|
66
|
-
expect(() => getValidatedOptions_1.getValidatedOptions({
|
|
67
|
-
...validOptions,
|
|
68
|
-
targetBranchChoices: [],
|
|
69
|
-
targetBranches: [],
|
|
70
|
-
})).toThrowErrorMatchingSnapshot();
|
|
71
|
-
});
|
|
72
|
-
it('when upstream is missing', () => {
|
|
73
|
-
expect(() => getValidatedOptions_1.getValidatedOptions({
|
|
74
|
-
...validOptions,
|
|
75
|
-
upstream: undefined,
|
|
76
|
-
})).toThrowErrorMatchingSnapshot();
|
|
77
|
-
});
|
|
78
|
-
it('when upstream is empty', () => {
|
|
79
|
-
expect(() => getValidatedOptions_1.getValidatedOptions({
|
|
80
|
-
...validOptions,
|
|
81
|
-
upstream: '',
|
|
82
|
-
})).toThrowErrorMatchingSnapshot();
|
|
83
|
-
});
|
|
84
|
-
it('when username is missing', () => {
|
|
85
|
-
expect(() => getValidatedOptions_1.getValidatedOptions({
|
|
86
|
-
...validOptions,
|
|
87
|
-
username: undefined,
|
|
88
|
-
})).toThrowErrorMatchingSnapshot();
|
|
89
|
-
});
|
|
90
|
-
it('when username is empty', () => {
|
|
91
|
-
expect(() => getValidatedOptions_1.getValidatedOptions({
|
|
92
|
-
...validOptions,
|
|
93
|
-
username: '',
|
|
94
|
-
})).toThrowErrorMatchingSnapshot();
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|