backport 7.4.0 → 8.2.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 +15 -16
- package/dist/backportRun.d.ts +12 -6
- package/dist/backportRun.js +64 -62
- package/dist/entrypoint.cli.js +4 -8
- package/dist/entrypoint.module.d.ts +13 -6
- package/dist/entrypoint.module.js +14 -20
- package/dist/entrypoint.module.private.test.js +47 -346
- package/dist/errors/BackportError.d.ts +19 -0
- package/dist/errors/BackportError.js +29 -0
- package/dist/lib/BackportError.d.ts +19 -0
- package/dist/lib/BackportError.js +29 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest.d.ts +11 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest.js +242 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest.test.d.ts +1 -0
- package/dist/lib/cherrypickAndCreateTargetPullRequest.test.js +321 -0
- package/dist/lib/child-process-promisified.d.ts +25 -0
- package/dist/lib/child-process-promisified.js +60 -0
- package/dist/lib/env.d.ts +9 -0
- package/dist/lib/env.js +33 -0
- package/dist/lib/env.test.d.ts +1 -0
- package/dist/lib/env.test.js +26 -0
- package/dist/lib/getCommits.d.ts +2 -0
- package/dist/lib/getCommits.js +75 -0
- package/dist/lib/getCommitsWithoutBackports.d.ts +11 -0
- package/dist/lib/getCommitsWithoutBackports.js +68 -0
- package/dist/lib/getCommitsWithoutBackports.test.d.ts +1 -0
- package/dist/lib/getCommitsWithoutBackports.test.js +335 -0
- package/dist/lib/getGitConfigAuthor.d.ts +6 -0
- package/dist/lib/getGitConfigAuthor.js +15 -0
- package/dist/lib/getTargetBranches.d.ts +5 -0
- package/dist/lib/getTargetBranches.js +67 -0
- package/dist/lib/getTargetBranches.test.d.ts +1 -0
- package/dist/lib/getTargetBranches.test.js +210 -0
- package/dist/lib/git.d.ts +77 -0
- package/dist/lib/git.js +439 -0
- package/dist/lib/git.private.test.d.ts +1 -0
- package/dist/lib/git.private.test.js +618 -0
- package/dist/lib/git.test.d.ts +1 -0
- package/dist/lib/git.test.js +580 -0
- package/dist/lib/github/commitFormatters.d.ts +3 -0
- package/dist/lib/github/commitFormatters.js +17 -0
- package/dist/lib/github/commitFormatters.test.d.ts +1 -0
- package/dist/lib/github/commitFormatters.test.js +11 -0
- package/dist/lib/github/v3/addAssigneesToPullRequest.d.ts +2 -0
- package/dist/lib/github/v3/addAssigneesToPullRequest.js +32 -0
- package/dist/lib/github/v3/addAssigneesToPullRequest.test.d.ts +1 -0
- package/dist/lib/github/v3/addAssigneesToPullRequest.test.js +27 -0
- package/dist/lib/github/v3/addLabelsToPullRequest.d.ts +2 -0
- package/dist/lib/github/v3/addLabelsToPullRequest.js +30 -0
- package/dist/lib/github/v3/addReviewersToPullRequest.d.ts +2 -0
- package/dist/lib/github/v3/addReviewersToPullRequest.js +32 -0
- package/dist/lib/github/v3/createPullRequest.d.ts +29 -0
- package/dist/lib/github/v3/createPullRequest.js +91 -0
- package/dist/lib/github/v3/createPullRequest.test.d.ts +1 -0
- package/dist/lib/github/v3/createPullRequest.test.js +377 -0
- package/dist/lib/github/v3/createStatusComment.d.ts +11 -0
- package/dist/lib/github/v3/createStatusComment.js +138 -0
- package/dist/lib/github/v3/createStatusComment.test.d.ts +1 -0
- package/dist/lib/github/v3/createStatusComment.test.js +566 -0
- package/dist/lib/github/v3/getGithubV3ErrorMessage.d.ts +14 -0
- package/dist/lib/github/v3/getGithubV3ErrorMessage.js +16 -0
- package/dist/lib/github/v4/FetchPullRequestId.d.ts +2 -0
- package/dist/lib/github/v4/FetchPullRequestId.js +36 -0
- package/dist/lib/github/v4/apiRequestV4.d.ts +31 -0
- package/dist/lib/github/v4/apiRequestV4.js +71 -0
- package/dist/lib/github/v4/apiRequestV4.test.d.ts +1 -0
- package/dist/lib/github/v4/apiRequestV4.test.js +109 -0
- package/dist/lib/github/v4/disablePullRequestAutoMerge.d.ts +2 -0
- package/dist/lib/github/v4/disablePullRequestAutoMerge.js +32 -0
- package/dist/lib/github/v4/enablePullRequestAutoMerge.d.ts +2 -0
- package/dist/lib/github/v4/enablePullRequestAutoMerge.js +50 -0
- package/dist/lib/github/v4/enablePullRequestAutoMerge.private.test.d.ts +1 -0
- package/dist/lib/github/v4/enablePullRequestAutoMerge.private.test.js +112 -0
- package/dist/lib/github/v4/fetchAuthorId.d.ts +10 -0
- package/dist/lib/github/v4/fetchAuthorId.js +28 -0
- package/dist/lib/github/v4/fetchAuthorId.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchAuthorId.private.test.js +25 -0
- package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/allFetchers.private.test.js +93 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +11 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.js +58 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +136 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.d.ts +11 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.js +48 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitBySha.private.test.js +118 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +29 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.js +110 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +196 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +157 -0
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +107 -0
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.d.ts +12 -0
- package/dist/lib/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +69 -0
- package/dist/lib/github/v4/fetchExistingPullRequest.d.ts +9 -0
- package/dist/lib/github/v4/fetchExistingPullRequest.js +64 -0
- package/dist/lib/github/v4/fetchExistingPullRequest.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchExistingPullRequest.private.test.js +44 -0
- package/dist/lib/github/v4/fetchPullRequestAutoMergeMethod.d.ts +2 -0
- package/dist/lib/github/v4/fetchPullRequestAutoMergeMethod.js +39 -0
- package/dist/lib/github/v4/fetchRemoteProjectConfig.d.ts +8 -0
- package/dist/lib/github/v4/fetchRemoteProjectConfig.js +49 -0
- package/dist/lib/github/v4/fetchRemoteProjectConfig.private.test.d.ts +1 -0
- package/dist/lib/github/v4/fetchRemoteProjectConfig.private.test.js +49 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +72 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +78 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +1 -0
- package/dist/lib/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +116 -0
- package/dist/lib/github/v4/getOptionsFromGithub/query.d.ts +16 -0
- package/dist/lib/github/v4/getOptionsFromGithub/query.js +29 -0
- package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.d.ts +29 -0
- package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.js +61 -0
- package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.d.ts +1 -0
- package/dist/lib/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +72 -0
- package/dist/lib/github/v4/mocks/commitsByAuthorMock.d.ts +2 -0
- package/dist/lib/github/v4/mocks/commitsByAuthorMock.js +176 -0
- package/dist/lib/github/v4/throwOnInvalidAccessToken.d.ts +7 -0
- package/dist/lib/github/v4/throwOnInvalidAccessToken.js +45 -0
- package/dist/lib/github/v4/throwOnInvalidAccessToken.test.d.ts +1 -0
- package/dist/lib/github/v4/throwOnInvalidAccessToken.test.js +87 -0
- package/dist/lib/github/v4/validateTargetBranches.d.ts +14 -0
- package/dist/lib/github/v4/validateTargetBranches.js +46 -0
- package/dist/lib/github/v4/validateTargetBranches.private.test.d.ts +1 -0
- package/dist/lib/github/v4/validateTargetBranches.private.test.js +51 -0
- package/dist/lib/logger.d.ts +11 -0
- package/dist/lib/logger.js +80 -0
- package/dist/lib/ora.d.ts +2 -0
- package/dist/lib/ora.js +21 -0
- package/dist/lib/prompt.test.d.ts +1 -0
- package/dist/lib/prompt.test.js +139 -0
- package/dist/lib/prompts.d.ts +17 -0
- package/dist/lib/prompts.js +132 -0
- package/dist/lib/remoteConfig.d.ts +20 -0
- package/dist/lib/remoteConfig.js +52 -0
- package/dist/lib/sequentially.d.ts +1 -0
- package/dist/lib/sequentially.js +10 -0
- package/dist/lib/setupRepo.d.ts +2 -0
- package/dist/lib/setupRepo.js +56 -0
- package/dist/lib/setupRepo.test.d.ts +1 -0
- package/dist/lib/setupRepo.test.js +278 -0
- package/dist/lib/sourceCommit/getExpectedTargetPullRequests.d.ts +16 -0
- package/dist/lib/sourceCommit/getExpectedTargetPullRequests.js +102 -0
- package/dist/lib/sourceCommit/getExpectedTargetPullRequests.test.d.ts +1 -0
- package/dist/lib/sourceCommit/getExpectedTargetPullRequests.test.js +467 -0
- package/dist/lib/sourceCommit/getMockSourceCommit.d.ts +26 -0
- package/dist/lib/sourceCommit/getMockSourceCommit.js +103 -0
- package/dist/lib/sourceCommit/parseSourceCommit.d.ts +108 -0
- package/dist/lib/sourceCommit/parseSourceCommit.js +123 -0
- package/dist/lib/sourceCommit/parseSourceCommit.test.d.ts +1 -0
- package/dist/lib/sourceCommit/parseSourceCommit.test.js +226 -0
- package/dist/options/ConfigOptions.d.ts +4 -2
- package/dist/options/cliArgs.d.ts +14 -6
- package/dist/options/cliArgs.js +50 -22
- package/dist/options/cliArgs.test.js +128 -4
- package/dist/options/config/config.d.ts +5 -4
- package/dist/options/config/config.js +3 -5
- package/dist/options/config/config.test.js +0 -1
- package/dist/options/config/globalConfig.d.ts +5 -3
- package/dist/options/config/globalConfig.js +17 -14
- package/dist/options/config/readConfigFile.d.ts +5 -3
- package/dist/options/config/readConfigFile.js +2 -2
- package/dist/options/options.d.ts +41 -5
- package/dist/options/options.js +24 -24
- package/dist/options/options.test.js +117 -55
- package/dist/runSequentially.d.ts +14 -9
- package/dist/runSequentially.js +27 -12
- package/dist/scripts/postinstall.js +4 -3
- package/dist/scripts/postinstall.test.js +6 -2
- package/dist/services/BackportError.d.ts +19 -0
- package/dist/services/BackportError.js +29 -0
- package/dist/services/HandledBackportError.d.ts +19 -0
- package/dist/services/HandledBackportError.js +29 -0
- package/dist/services/HandledError.d.ts +2 -2
- package/dist/services/HandledError.js +7 -7
- package/dist/services/child-process-promisified.d.ts +19 -3
- package/dist/services/child-process-promisified.js +46 -17
- package/dist/services/git.d.ts +6 -7
- package/dist/services/git.integration.test.js +381 -65
- package/dist/services/git.js +189 -123
- package/dist/services/git.private.test.d.ts +1 -0
- package/dist/services/git.private.test.js +618 -0
- package/dist/services/git.test.js +167 -124
- package/dist/services/github/v3/addAssigneesToPullRequest.js +1 -1
- package/dist/services/github/v3/addLabelsToPullRequest.js +1 -1
- package/dist/services/github/v3/addReviewersToPullRequest.js +2 -1
- package/dist/services/github/v3/createPullRequest.js +4 -2
- package/dist/services/github/v3/createStatusComment.js +16 -17
- package/dist/services/github/v3/createStatusComment.test.js +20 -9
- package/dist/services/github/v4/apiRequestV4.js +2 -2
- package/dist/services/github/v4/apiRequestV4.test.js +2 -2
- package/dist/services/github/v4/enablePullRequestAutoMerge.js +2 -4
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +4 -3
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +5 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +3 -2
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +5 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +4 -3
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +5 -1
- package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +3 -2
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +2 -2
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +5 -1
- package/dist/services/github/v4/throwOnInvalidAccessToken.js +5 -5
- package/dist/services/logger.js +5 -1
- package/dist/services/test.d.ts +1 -0
- package/dist/services/test.js +23 -0
- package/dist/state.d.ts +0 -0
- package/dist/state.js +1 -0
- package/dist/test/e2e/cli/commit-author.private.test.js +4 -4
- package/dist/test/e2e/cli/different-merge-strategies.private.test.js +27 -25
- package/dist/test/e2e/cli/entrypoint.cli.private.test.js +53 -75
- package/dist/test/e2e/cli/error-handling-interactive-mode.private.test.d.ts +1 -0
- package/dist/test/e2e/cli/error-handling-interactive-mode.private.test.js +80 -0
- package/dist/test/e2e/cli/error-handling-non-interactive-mode.private.test.d.ts +1 -0
- package/dist/test/e2e/cli/error-handling-non-interactive-mode.private.test.js +199 -0
- package/dist/test/e2e/cli/interactive-error-handling.private.test.d.ts +1 -0
- package/dist/test/e2e/cli/interactive-error-handling.private.test.js +80 -0
- package/dist/test/e2e/cli/non-interactive-error-handling.private.test.d.ts +1 -0
- package/dist/test/e2e/cli/non-interactive-error-handling.private.test.js +198 -0
- package/dist/test/e2e/cli/repo-with-backportrc-removed.private.test.js +28 -29
- package/dist/test/e2e/cli/runBackportViaCli.d.ts +6 -2
- package/dist/test/e2e/cli/runBackportViaCli.js +44 -23
- package/dist/test/e2e/cli/test-that-repo-can-be-cloned.private.test.js +22 -14
- package/dist/test/e2e/module/entrypoint.module.mutation.test.js +28 -21
- package/dist/test/handleUnbackportedPullRequests.private.test.js +11 -8
- package/dist/test/sandbox.js +5 -1
- package/dist/test/setupFiles/automatic-mocks.js +6 -2
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +4 -4
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +7 -159
- package/dist/ui/getCommits.js +2 -2
- package/dist/ui/getCommitsWithoutBackports.test.js +5 -1
- package/dist/ui/getGitConfigAuthor.js +1 -1
- package/dist/ui/getTargetBranches.js +3 -3
- package/dist/ui/getTargetBranches.test.js +5 -1
- package/dist/ui/ora.d.ts +1 -8
- package/dist/ui/setupRepo.js +3 -3
- package/dist/ui/setupRepo.test.js +98 -61
- package/dist/utils/isErrnoError.d.ts +2 -0
- package/dist/utils/isErrnoError.js +7 -0
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +19 -19
- package/yarn.lock +472 -701
package/dist/options/cliArgs.js
CHANGED
|
@@ -3,10 +3,12 @@ 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.getOptionsFromCliArgs = void 0;
|
|
6
|
+
exports.getRuntimeArguments = exports.getOptionsFromCliArgs = void 0;
|
|
7
7
|
const yargs_1 = __importDefault(require("yargs"));
|
|
8
|
+
const yargs_parser_1 = __importDefault(require("yargs-parser"));
|
|
8
9
|
const excludeUndefined_1 = require("../utils/excludeUndefined");
|
|
9
|
-
|
|
10
|
+
const options_1 = require("./options");
|
|
11
|
+
function getOptionsFromCliArgs(processArgs) {
|
|
10
12
|
const yargsInstance = (0, yargs_1.default)(processArgs)
|
|
11
13
|
.strict()
|
|
12
14
|
.parserConfiguration({
|
|
@@ -54,20 +56,25 @@ function getOptionsFromCliArgs(processArgs, { exitOnError = true } = {}) {
|
|
|
54
56
|
alias: 'author',
|
|
55
57
|
type: 'string',
|
|
56
58
|
conflicts: 'all',
|
|
57
|
-
})
|
|
58
|
-
.option('ci', {
|
|
59
|
-
description: 'Disable interactive prompts',
|
|
60
|
-
type: 'boolean',
|
|
61
59
|
})
|
|
62
60
|
.option('cherrypickRef', {
|
|
63
61
|
description: 'Append commit message with "(cherry picked from commit...)',
|
|
64
62
|
type: 'boolean',
|
|
65
63
|
conflicts: ['noCherrypickRef'],
|
|
64
|
+
})
|
|
65
|
+
.option('cwd', {
|
|
66
|
+
hidden: true,
|
|
67
|
+
description: 'Path to source repo',
|
|
68
|
+
type: 'string',
|
|
66
69
|
})
|
|
67
70
|
.option('projectConfigFile', {
|
|
68
71
|
alias: 'config',
|
|
69
72
|
description: 'Path to project config',
|
|
70
73
|
type: 'string',
|
|
74
|
+
})
|
|
75
|
+
.option('globalConfigFile', {
|
|
76
|
+
description: 'Path to global config',
|
|
77
|
+
type: 'string',
|
|
71
78
|
})
|
|
72
79
|
.option('since', {
|
|
73
80
|
description: 'ISO-8601 date for filtering commits',
|
|
@@ -78,7 +85,7 @@ function getOptionsFromCliArgs(processArgs, { exitOnError = true } = {}) {
|
|
|
78
85
|
type: 'string',
|
|
79
86
|
})
|
|
80
87
|
.option('dir', {
|
|
81
|
-
description: '
|
|
88
|
+
description: 'Path to temporary backport repo',
|
|
82
89
|
type: 'string',
|
|
83
90
|
})
|
|
84
91
|
.option('details', {
|
|
@@ -125,6 +132,12 @@ function getOptionsFromCliArgs(processArgs, { exitOnError = true } = {}) {
|
|
|
125
132
|
.option('gitAuthorEmail', {
|
|
126
133
|
description: `Set commit author email`,
|
|
127
134
|
type: 'string',
|
|
135
|
+
})
|
|
136
|
+
.option('nonInteractive', {
|
|
137
|
+
alias: ['json'],
|
|
138
|
+
description: 'Disable interactive prompts and return response as JSON',
|
|
139
|
+
type: 'boolean',
|
|
140
|
+
conflicts: 'interactive',
|
|
128
141
|
})
|
|
129
142
|
.option('logFilePath', {
|
|
130
143
|
hidden: true,
|
|
@@ -181,6 +194,8 @@ function getOptionsFromCliArgs(processArgs, { exitOnError = true } = {}) {
|
|
|
181
194
|
type: 'boolean',
|
|
182
195
|
conflicts: ['cherrypickRef'],
|
|
183
196
|
})
|
|
197
|
+
// cli-only
|
|
198
|
+
// negation of `publishStatusCommentOnSuccess` and `publishStatusCommentOnFailure`
|
|
184
199
|
.option('noStatusComment', {
|
|
185
200
|
description: "Don't publish status comment to Github",
|
|
186
201
|
type: 'boolean',
|
|
@@ -296,29 +311,27 @@ function getOptionsFromCliArgs(processArgs, { exitOnError = true } = {}) {
|
|
|
296
311
|
})
|
|
297
312
|
.alias('version', 'v')
|
|
298
313
|
.help()
|
|
299
|
-
.epilogue('For bugs, feature requests or questions: https://github.com/sqren/backport/issues\nOr contact me directly: https://twitter.com/sorenlouv')
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
});
|
|
310
|
-
}
|
|
314
|
+
.epilogue('For bugs, feature requests or questions: https://github.com/sqren/backport/issues\nOr contact me directly: https://twitter.com/sorenlouv')
|
|
315
|
+
// don't kill process upon error
|
|
316
|
+
// and don't log error to console
|
|
317
|
+
.fail((msg, err) => {
|
|
318
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
319
|
+
if (err) {
|
|
320
|
+
throw err;
|
|
321
|
+
}
|
|
322
|
+
throw new Error(msg);
|
|
323
|
+
});
|
|
311
324
|
const {
|
|
312
325
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
313
326
|
$0, _,
|
|
314
327
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
315
328
|
multiple, multipleBranches, multipleCommits, all,
|
|
316
|
-
//
|
|
329
|
+
// shorthands
|
|
317
330
|
repo,
|
|
318
331
|
// filters
|
|
319
332
|
author, since, until,
|
|
320
333
|
// negations
|
|
321
|
-
noCherrypickRef, noFork, noStatusComment, noVerify, verify,
|
|
334
|
+
noCherrypickRef, noFork, noStatusComment, noVerify, verify, nonInteractive,
|
|
322
335
|
// array types (should be renamed to plural form)
|
|
323
336
|
assignee, path, reviewer, sourcePRLabel, targetBranch, targetBranchChoice, targetPRLabel, ...restOptions } = yargsInstance.parseSync();
|
|
324
337
|
const [repoOwner, repoName] = repo?.split('/') ?? [
|
|
@@ -349,7 +362,22 @@ function getOptionsFromCliArgs(processArgs, { exitOnError = true } = {}) {
|
|
|
349
362
|
cherrypickRef: noCherrypickRef === true ? false : restOptions.cherrypickRef,
|
|
350
363
|
fork: noFork === true ? false : restOptions.fork,
|
|
351
364
|
noVerify: verify ?? noVerify,
|
|
352
|
-
|
|
365
|
+
publishStatusCommentOnSuccess: noStatusComment === true ? false : undefined,
|
|
366
|
+
publishStatusCommentOnFailure: noStatusComment === true ? false : undefined,
|
|
367
|
+
publishStatusCommentOnAbort: noStatusComment === true ? false : undefined,
|
|
368
|
+
interactive: nonInteractive === true ? false : undefined,
|
|
353
369
|
});
|
|
354
370
|
}
|
|
355
371
|
exports.getOptionsFromCliArgs = getOptionsFromCliArgs;
|
|
372
|
+
function getRuntimeArguments(processArgs, optionsFromModule) {
|
|
373
|
+
const { nonInteractive, json, logFilePath, ls } = (0, yargs_parser_1.default)(processArgs);
|
|
374
|
+
const base = { ...options_1.defaultConfigOptions, ...optionsFromModule };
|
|
375
|
+
return {
|
|
376
|
+
interactive: nonInteractive === undefined && json === undefined
|
|
377
|
+
? base.interactive
|
|
378
|
+
: !(nonInteractive === true || json === true),
|
|
379
|
+
logFilePath,
|
|
380
|
+
ls,
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
exports.getRuntimeArguments = getRuntimeArguments;
|
|
@@ -47,6 +47,27 @@ describe('getOptionsFromCliArgs', () => {
|
|
|
47
47
|
expect(res.sourcePRLabels).toEqual(['label a', 'label b', 'label c']);
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
+
describe('reviewers', () => {
|
|
51
|
+
it('should handle all variations', () => {
|
|
52
|
+
const argv = ['--reviewer=peter'];
|
|
53
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
54
|
+
expect(res.reviewers).toEqual(['peter']);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
describe('author', () => {
|
|
58
|
+
it('has a default author', () => {
|
|
59
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)([]);
|
|
60
|
+
expect(res.author).toEqual(undefined);
|
|
61
|
+
});
|
|
62
|
+
it('sets the author', () => {
|
|
63
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)(['--author=sqren']);
|
|
64
|
+
expect(res.author).toEqual('sqren');
|
|
65
|
+
});
|
|
66
|
+
it('sets the author to null', () => {
|
|
67
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)(['--all']);
|
|
68
|
+
expect(res.author).toEqual(null);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
50
71
|
describe('pullNumber', () => {
|
|
51
72
|
it('should accept `--pr` alias but only return the full representation (`pullNumber`)', () => {
|
|
52
73
|
const argv = ['--pr', '1337'];
|
|
@@ -91,7 +112,54 @@ describe('getOptionsFromCliArgs', () => {
|
|
|
91
112
|
});
|
|
92
113
|
it('should conflict when using both', () => {
|
|
93
114
|
const argv = ['--multiple', '--multiple-branches', 'false'];
|
|
94
|
-
expect(() => (0, cliArgs_1.getOptionsFromCliArgs)(argv
|
|
115
|
+
expect(() => (0, cliArgs_1.getOptionsFromCliArgs)(argv)).toThrowError('Arguments multiple and multipleBranches are mutually exclusive');
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
describe('fork', () => {
|
|
119
|
+
it('--fork', () => {
|
|
120
|
+
const argv = ['--fork'];
|
|
121
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
122
|
+
expect(res.fork).toEqual(true);
|
|
123
|
+
});
|
|
124
|
+
it('--no-fork', () => {
|
|
125
|
+
const argv = ['--no-fork'];
|
|
126
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
127
|
+
expect(res.fork).toEqual(false);
|
|
128
|
+
});
|
|
129
|
+
it('defaults to undefined', () => {
|
|
130
|
+
const argv = [];
|
|
131
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
132
|
+
expect(res.fork).toEqual(undefined);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
describe('interactive', () => {
|
|
136
|
+
it('defaults to undefined', () => {
|
|
137
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)([]);
|
|
138
|
+
expect(res.interactive).toEqual(undefined);
|
|
139
|
+
});
|
|
140
|
+
it('noStatusComment', () => {
|
|
141
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)(['--non-interactive']);
|
|
142
|
+
expect(res.interactive).toEqual(false);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
describe('publishStatusCommentOnFailure', () => {
|
|
146
|
+
it('defaults to undefined', () => {
|
|
147
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)([]);
|
|
148
|
+
expect(res.publishStatusCommentOnFailure).toEqual(undefined);
|
|
149
|
+
});
|
|
150
|
+
it('noStatusComment', () => {
|
|
151
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)(['--noStatusComment']);
|
|
152
|
+
expect(res.publishStatusCommentOnFailure).toEqual(false);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
describe('publishStatusCommentOnSuccess', () => {
|
|
156
|
+
it('defaults to undefined', () => {
|
|
157
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)([]);
|
|
158
|
+
expect(res.publishStatusCommentOnSuccess).toEqual(undefined);
|
|
159
|
+
});
|
|
160
|
+
it('noStatusComment', () => {
|
|
161
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)(['--noStatusComment']);
|
|
162
|
+
expect(res.publishStatusCommentOnSuccess).toEqual(false);
|
|
95
163
|
});
|
|
96
164
|
});
|
|
97
165
|
describe('noVerify', () => {
|
|
@@ -116,6 +184,16 @@ describe('getOptionsFromCliArgs', () => {
|
|
|
116
184
|
expect(res.noVerify).toBe(true);
|
|
117
185
|
});
|
|
118
186
|
});
|
|
187
|
+
describe('cherrypickRef', () => {
|
|
188
|
+
it('should be undefined by default', () => {
|
|
189
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)([]);
|
|
190
|
+
expect(res.cherrypickRef).toBe(undefined);
|
|
191
|
+
});
|
|
192
|
+
it('can be disabled', () => {
|
|
193
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)(['--no-cherrypick-ref']);
|
|
194
|
+
expect(res.cherrypickRef).toBe(false);
|
|
195
|
+
});
|
|
196
|
+
});
|
|
119
197
|
describe('mainline', () => {
|
|
120
198
|
it('should default to 1', () => {
|
|
121
199
|
const argv = ['--mainline'];
|
|
@@ -129,7 +207,7 @@ describe('getOptionsFromCliArgs', () => {
|
|
|
129
207
|
});
|
|
130
208
|
it('should throw on invalid values', () => {
|
|
131
209
|
const argv = ['--mainline', 'foo'];
|
|
132
|
-
expect(() => (0, cliArgs_1.getOptionsFromCliArgs)(argv
|
|
210
|
+
expect(() => (0, cliArgs_1.getOptionsFromCliArgs)(argv)).toThrowError('--mainline must be an integer. Received: NaN');
|
|
133
211
|
});
|
|
134
212
|
});
|
|
135
213
|
describe('targetBranches', () => {
|
|
@@ -146,12 +224,18 @@ describe('getOptionsFromCliArgs', () => {
|
|
|
146
224
|
expect(res.repoOwner).toEqual('elastic');
|
|
147
225
|
expect(res.repoName).toEqual('kibana');
|
|
148
226
|
});
|
|
227
|
+
it('accepts --repo-name and --repo-owner', () => {
|
|
228
|
+
const argv = ['--repo-owner=elastic', '--repo-name=kibana'];
|
|
229
|
+
const res = (0, cliArgs_1.getOptionsFromCliArgs)(argv);
|
|
230
|
+
expect(res.repoOwner).toEqual('elastic');
|
|
231
|
+
expect(res.repoName).toEqual('kibana');
|
|
232
|
+
});
|
|
149
233
|
it('throw if both --repo and --repo-name is given', () => {
|
|
150
234
|
const argv = ['--repo', 'elastic/kibana', '--repo-name', 'foo'];
|
|
151
|
-
expect(() => (0, cliArgs_1.getOptionsFromCliArgs)(argv
|
|
235
|
+
expect(() => (0, cliArgs_1.getOptionsFromCliArgs)(argv)).toThrowError('Arguments repo and repoName are mutually exclusive');
|
|
152
236
|
});
|
|
153
237
|
});
|
|
154
|
-
describe('
|
|
238
|
+
describe('dateSince and dateUntil', () => {
|
|
155
239
|
it('should always be UTC time (configured globally in jest.config.js)', () => {
|
|
156
240
|
expect(new Date().getTimezoneOffset()).toBe(0);
|
|
157
241
|
});
|
|
@@ -180,3 +264,43 @@ describe('getOptionsFromCliArgs', () => {
|
|
|
180
264
|
});
|
|
181
265
|
});
|
|
182
266
|
});
|
|
267
|
+
describe('getRuntimeArguments', () => {
|
|
268
|
+
describe('interactive', () => {
|
|
269
|
+
it('--non-interactive flag', () => {
|
|
270
|
+
const { interactive } = (0, cliArgs_1.getRuntimeArguments)(['--non-interactive']);
|
|
271
|
+
expect(interactive).toEqual(false);
|
|
272
|
+
});
|
|
273
|
+
it('--json flag', () => {
|
|
274
|
+
const { interactive } = (0, cliArgs_1.getRuntimeArguments)(['--json']);
|
|
275
|
+
expect(interactive).toEqual(false);
|
|
276
|
+
});
|
|
277
|
+
it('default', () => {
|
|
278
|
+
const { interactive } = (0, cliArgs_1.getRuntimeArguments)([]);
|
|
279
|
+
expect(interactive).toEqual(true);
|
|
280
|
+
});
|
|
281
|
+
it('setting via module options', () => {
|
|
282
|
+
const { interactive } = (0, cliArgs_1.getRuntimeArguments)([], { interactive: false });
|
|
283
|
+
expect(interactive).toEqual(false);
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
describe('ls', () => {
|
|
287
|
+
it('by default', () => {
|
|
288
|
+
const { ls } = (0, cliArgs_1.getRuntimeArguments)([]);
|
|
289
|
+
expect(ls).toEqual(undefined);
|
|
290
|
+
});
|
|
291
|
+
it('--ls flag', () => {
|
|
292
|
+
const { ls } = (0, cliArgs_1.getRuntimeArguments)(['--ls']);
|
|
293
|
+
expect(ls).toEqual(true);
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
describe('logFilePath', () => {
|
|
297
|
+
it('by default', () => {
|
|
298
|
+
const { logFilePath } = (0, cliArgs_1.getRuntimeArguments)([]);
|
|
299
|
+
expect(logFilePath).toEqual(undefined);
|
|
300
|
+
});
|
|
301
|
+
it('--log-file-path flag', () => {
|
|
302
|
+
const { logFilePath } = (0, cliArgs_1.getRuntimeArguments)(['--log-file-path']);
|
|
303
|
+
expect(logFilePath).toEqual(true);
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ConfigFileOptions } from '../ConfigOptions';
|
|
2
2
|
import { OptionsFromCliArgs } from '../cliArgs';
|
|
3
3
|
export declare type OptionsFromConfigFiles = Awaited<ReturnType<typeof getOptionsFromConfigFiles>>;
|
|
4
|
-
export declare function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsFromModule,
|
|
4
|
+
export declare function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsFromModule, }: {
|
|
5
5
|
optionsFromCliArgs: OptionsFromCliArgs;
|
|
6
6
|
optionsFromModule: ConfigFileOptions;
|
|
7
|
-
defaultConfigOptions: ConfigFileOptions;
|
|
8
7
|
}): Promise<{
|
|
9
8
|
accessToken?: string | undefined;
|
|
10
9
|
assignees?: string[] | undefined;
|
|
@@ -20,7 +19,6 @@ export declare function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsF
|
|
|
20
19
|
autoMergeMethod?: string | undefined;
|
|
21
20
|
backportBinary?: string | undefined;
|
|
22
21
|
cherrypickRef?: boolean | undefined;
|
|
23
|
-
ci?: boolean | undefined;
|
|
24
22
|
commitPaths?: string[] | undefined;
|
|
25
23
|
details?: boolean | undefined;
|
|
26
24
|
dir?: string | undefined;
|
|
@@ -32,6 +30,7 @@ export declare function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsF
|
|
|
32
30
|
gitHostname?: string | undefined;
|
|
33
31
|
githubApiBaseUrlV3?: string | undefined;
|
|
34
32
|
githubApiBaseUrlV4?: string | undefined;
|
|
33
|
+
interactive?: boolean | undefined;
|
|
35
34
|
logFilePath?: string | undefined;
|
|
36
35
|
ls?: boolean | undefined;
|
|
37
36
|
maxNumber?: number | undefined;
|
|
@@ -43,7 +42,9 @@ export declare function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsF
|
|
|
43
42
|
prFilter?: string | undefined;
|
|
44
43
|
projectConfigFile?: string | undefined;
|
|
45
44
|
prTitle?: string | undefined;
|
|
46
|
-
|
|
45
|
+
publishStatusCommentOnAbort?: boolean | undefined;
|
|
46
|
+
publishStatusCommentOnFailure?: boolean | undefined;
|
|
47
|
+
publishStatusCommentOnSuccess?: boolean | undefined;
|
|
47
48
|
pullNumber?: number | undefined;
|
|
48
49
|
repoForkOwner?: string | undefined;
|
|
49
50
|
repoName?: string | undefined;
|
|
@@ -3,14 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getOptionsFromConfigFiles = void 0;
|
|
4
4
|
const globalConfig_1 = require("./globalConfig");
|
|
5
5
|
const projectConfig_1 = require("./projectConfig");
|
|
6
|
-
async function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsFromModule,
|
|
7
|
-
// ci: cli and module only flag
|
|
8
|
-
const ci = optionsFromCliArgs.ci ?? optionsFromModule.ci ?? defaultConfigOptions.ci;
|
|
9
|
-
// ci: cli and module only flag
|
|
6
|
+
async function getOptionsFromConfigFiles({ optionsFromCliArgs, optionsFromModule, }) {
|
|
10
7
|
const projectConfigFile = optionsFromCliArgs.projectConfigFile ?? optionsFromModule.projectConfigFile;
|
|
8
|
+
const globalConfigFile = optionsFromCliArgs.globalConfigFile;
|
|
11
9
|
const [projectConfig, globalConfig] = await Promise.all([
|
|
12
10
|
(0, projectConfig_1.getProjectConfig)({ projectConfigFile }),
|
|
13
|
-
|
|
11
|
+
(0, globalConfig_1.getGlobalConfig)({ globalConfigFile }),
|
|
14
12
|
]);
|
|
15
13
|
return {
|
|
16
14
|
...globalConfig,
|
|
@@ -18,7 +18,6 @@ describe('getOptionsFromConfigFiles', () => {
|
|
|
18
18
|
res = await (0, config_1.getOptionsFromConfigFiles)({
|
|
19
19
|
optionsFromCliArgs: {},
|
|
20
20
|
optionsFromModule: {},
|
|
21
|
-
defaultConfigOptions: { ci: false },
|
|
22
21
|
});
|
|
23
22
|
});
|
|
24
23
|
it('should return values from config files', () => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ConfigFileOptions } from '../ConfigOptions';
|
|
2
|
-
export declare function getGlobalConfig(
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export declare function getGlobalConfig({ globalConfigFile, }?: {
|
|
3
|
+
globalConfigFile?: string;
|
|
4
|
+
}): Promise<ConfigFileOptions>;
|
|
5
|
+
export declare function createGlobalConfigAndFolderIfNotExist(globalConfigPath: string): Promise<boolean | undefined>;
|
|
6
|
+
export declare function createGlobalConfigIfNotExist(globalConfigPath: string, configTemplate: string): Promise<boolean | undefined>;
|
|
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.createGlobalConfigIfNotExist = exports.createGlobalConfigAndFolderIfNotExist = exports.getGlobalConfig = void 0;
|
|
7
7
|
const promises_1 = require("fs/promises");
|
|
8
8
|
const make_dir_1 = __importDefault(require("make-dir"));
|
|
9
|
-
const
|
|
10
|
-
const env_1 = require("../../
|
|
9
|
+
const BackportError_1 = require("../../lib/BackportError");
|
|
10
|
+
const env_1 = require("../../lib/env");
|
|
11
|
+
const isErrnoError_1 = require("../../utils/isErrnoError");
|
|
11
12
|
const readConfigFile_1 = require("./readConfigFile");
|
|
12
|
-
async function getGlobalConfig() {
|
|
13
|
-
const globalConfigPath = (0, env_1.getGlobalConfigPath)();
|
|
13
|
+
async function getGlobalConfig({ globalConfigFile, } = {}) {
|
|
14
|
+
const globalConfigPath = (0, env_1.getGlobalConfigPath)(globalConfigFile);
|
|
14
15
|
await createGlobalConfigAndFolderIfNotExist(globalConfigPath);
|
|
15
16
|
return (0, readConfigFile_1.readConfigFile)(globalConfigPath);
|
|
16
17
|
}
|
|
@@ -36,17 +37,19 @@ async function createGlobalConfigIfNotExist(globalConfigPath, configTemplate) {
|
|
|
36
37
|
return true;
|
|
37
38
|
}
|
|
38
39
|
catch (e) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
if ((0, isErrnoError_1.isErrnoError)(e)) {
|
|
41
|
+
// ignore error if file already exists
|
|
42
|
+
const FILE_ALREADY_EXISTS = 'EEXIST';
|
|
43
|
+
if (e.code === FILE_ALREADY_EXISTS) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
// handle error if folder does not exist
|
|
47
|
+
const FOLDER_NOT_EXISTS = 'ENOENT';
|
|
48
|
+
if (e.code === FOLDER_NOT_EXISTS) {
|
|
49
|
+
throw new BackportError_1.BackportError(`The .backport folder (${globalConfigPath}) does not exist. `);
|
|
50
|
+
}
|
|
51
|
+
throw e;
|
|
43
52
|
}
|
|
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. `);
|
|
48
|
-
}
|
|
49
|
-
throw e;
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
exports.createGlobalConfigIfNotExist = createGlobalConfigIfNotExist;
|
|
@@ -4,14 +4,14 @@ export declare function withConfigMigrations({ upstream, labels, branches, ...co
|
|
|
4
4
|
fork?: boolean | undefined;
|
|
5
5
|
dir?: string | undefined;
|
|
6
6
|
help?: boolean | undefined;
|
|
7
|
-
|
|
7
|
+
interactive?: boolean | undefined;
|
|
8
8
|
accessToken?: string | undefined;
|
|
9
|
+
logFilePath?: string | undefined;
|
|
9
10
|
author?: string | null | undefined;
|
|
10
11
|
autoAssign?: boolean | undefined;
|
|
11
12
|
assignees?: string[] | undefined;
|
|
12
13
|
autoMerge?: boolean | undefined;
|
|
13
14
|
autoMergeMethod?: string | undefined;
|
|
14
|
-
ci?: boolean | undefined;
|
|
15
15
|
cherrypickRef?: boolean | undefined;
|
|
16
16
|
projectConfigFile?: string | undefined;
|
|
17
17
|
details?: boolean | undefined;
|
|
@@ -47,7 +47,9 @@ export declare function withConfigMigrations({ upstream, labels, branches, ...co
|
|
|
47
47
|
targetBranchChoices?: import("../ConfigOptions").TargetBranchChoiceOrString[] | undefined;
|
|
48
48
|
targetBranches?: string[] | undefined;
|
|
49
49
|
targetPRLabels?: string[] | undefined;
|
|
50
|
-
|
|
50
|
+
publishStatusCommentOnSuccess?: boolean | undefined;
|
|
51
|
+
publishStatusCommentOnFailure?: boolean | undefined;
|
|
52
|
+
publishStatusCommentOnAbort?: boolean | undefined;
|
|
51
53
|
autoFixConflicts?: (({ files, directory, logger, targetBranch, }: {
|
|
52
54
|
files: string[];
|
|
53
55
|
directory: string;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.withConfigMigrations = exports.readConfigFile = void 0;
|
|
7
7
|
const promises_1 = require("fs/promises");
|
|
8
8
|
const strip_json_comments_1 = __importDefault(require("strip-json-comments"));
|
|
9
|
-
const
|
|
9
|
+
const BackportError_1 = require("../../lib/BackportError");
|
|
10
10
|
const excludeUndefined_1 = require("../../utils/excludeUndefined");
|
|
11
11
|
async function readConfigFile(filepath) {
|
|
12
12
|
const fileContents = await (0, promises_1.readFile)(filepath, 'utf8');
|
|
@@ -15,7 +15,7 @@ async function readConfigFile(filepath) {
|
|
|
15
15
|
return withConfigMigrations(JSON.parse(configWithoutComments));
|
|
16
16
|
}
|
|
17
17
|
catch (e) {
|
|
18
|
-
throw new
|
|
18
|
+
throw new BackportError_1.BackportError(`"${filepath}" contains invalid JSON:\n\n${fileContents}`);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
exports.readConfigFile = readConfigFile;
|
|
@@ -1,20 +1,55 @@
|
|
|
1
1
|
import { ConfigFileOptions, TargetBranchChoiceOrString } from './ConfigOptions';
|
|
2
|
+
import { OptionsFromCliArgs } from './cliArgs';
|
|
2
3
|
export declare type ValidConfigOptions = Readonly<Awaited<ReturnType<typeof getOptions>>>;
|
|
3
|
-
export declare
|
|
4
|
+
export declare const defaultConfigOptions: {
|
|
5
|
+
assignees: string[];
|
|
6
|
+
autoAssign: boolean;
|
|
7
|
+
autoMerge: boolean;
|
|
8
|
+
autoMergeMethod: string;
|
|
9
|
+
backportBinary: string;
|
|
10
|
+
cherrypickRef: boolean;
|
|
11
|
+
commitPaths: string[];
|
|
12
|
+
cwd: string;
|
|
13
|
+
dateSince: null;
|
|
14
|
+
dateUntil: null;
|
|
15
|
+
details: boolean;
|
|
16
|
+
fork: boolean;
|
|
17
|
+
gitHostname: string;
|
|
18
|
+
interactive: boolean;
|
|
19
|
+
maxNumber: number;
|
|
20
|
+
multipleBranches: boolean;
|
|
21
|
+
multipleCommits: boolean;
|
|
22
|
+
noVerify: boolean;
|
|
23
|
+
publishStatusCommentOnAbort: boolean;
|
|
24
|
+
publishStatusCommentOnSuccess: boolean;
|
|
25
|
+
publishStatusCommentOnFailure: boolean;
|
|
26
|
+
resetAuthor: boolean;
|
|
27
|
+
reviewers: string[];
|
|
28
|
+
sourcePRLabels: string[];
|
|
29
|
+
targetBranchChoices: TargetBranchChoiceOrString[];
|
|
30
|
+
targetBranches: string[];
|
|
31
|
+
targetPRLabels: string[];
|
|
32
|
+
};
|
|
33
|
+
export declare function getOptions({ optionsFromCliArgs, optionsFromModule, }: {
|
|
34
|
+
optionsFromCliArgs: OptionsFromCliArgs;
|
|
35
|
+
optionsFromModule: ConfigFileOptions;
|
|
36
|
+
}): Promise<{
|
|
4
37
|
accessToken: string;
|
|
5
38
|
repoName: string;
|
|
6
39
|
repoOwner: string;
|
|
40
|
+
cwd: string;
|
|
7
41
|
fork: boolean;
|
|
8
42
|
dir?: string | undefined;
|
|
43
|
+
interactive: boolean;
|
|
9
44
|
logFilePath?: string | undefined;
|
|
10
45
|
author: string | null;
|
|
11
46
|
autoAssign: boolean;
|
|
12
47
|
assignees: string[];
|
|
13
48
|
autoMerge: boolean;
|
|
14
49
|
autoMergeMethod: string;
|
|
15
|
-
ci: boolean;
|
|
16
50
|
cherrypickRef: boolean;
|
|
17
51
|
projectConfigFile?: string | undefined;
|
|
52
|
+
globalConfigFile?: string | undefined;
|
|
18
53
|
details: boolean;
|
|
19
54
|
dryRun?: boolean | undefined;
|
|
20
55
|
editor?: string | undefined;
|
|
@@ -44,10 +79,12 @@ export declare function getOptions(processArgs: string[], optionsFromModule: Con
|
|
|
44
79
|
commitPaths: string[];
|
|
45
80
|
reviewers: string[];
|
|
46
81
|
sourcePRLabels: string[];
|
|
47
|
-
targetBranchChoices:
|
|
82
|
+
targetBranchChoices: TargetBranchChoiceOrString[];
|
|
48
83
|
targetBranches: string[];
|
|
49
84
|
targetPRLabels: string[];
|
|
50
|
-
|
|
85
|
+
publishStatusCommentOnSuccess: boolean;
|
|
86
|
+
publishStatusCommentOnFailure: boolean;
|
|
87
|
+
publishStatusCommentOnAbort: boolean;
|
|
51
88
|
autoFixConflicts?: (({ files, directory, logger, targetBranch, }: {
|
|
52
89
|
files: string[];
|
|
53
90
|
directory: string;
|
|
@@ -64,5 +101,4 @@ export declare function getOptions(processArgs: string[], optionsFromModule: Con
|
|
|
64
101
|
branches?: TargetBranchChoiceOrString[] | undefined;
|
|
65
102
|
labels?: string[] | undefined;
|
|
66
103
|
authenticatedUsername: string;
|
|
67
|
-
cwd: string;
|
|
68
104
|
}>;
|