backport 6.1.3 → 6.2.1
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 +40 -37
- package/dist/backportRun.d.ts +14 -0
- package/dist/backportRun.js +75 -0
- package/dist/entrypoint.api.d.ts +22 -0
- package/dist/entrypoint.api.js +57 -0
- package/dist/entrypoint.api.private.test.d.ts +1 -0
- package/dist/entrypoint.api.private.test.js +37 -0
- package/dist/entrypoint.cli.js +3 -5
- package/dist/entrypoint.module.d.ts +6 -3
- package/dist/entrypoint.module.js +13 -7
- package/dist/entrypoint.module.private.test.js +4 -1
- package/dist/main.js +5 -1
- package/dist/options/ConfigOptions.d.ts +4 -0
- package/dist/options/cliArgs.d.ts +17 -11
- package/dist/options/cliArgs.js +36 -5
- package/dist/options/config/config.d.ts +10 -1
- package/dist/options/config/config.js +9 -3
- package/dist/options/config/config.test.js +27 -1
- package/dist/options/config/getProjectConfig.d.ts +0 -0
- package/dist/options/config/getProjectConfig.js +1 -0
- package/dist/options/config/globalConfig.d.ts +2 -2
- package/dist/options/config/globalConfig.js +16 -14
- package/dist/options/config/globalConfig.test.js +10 -4
- package/dist/options/config/projectConfig.d.ts +3 -1
- package/dist/options/config/projectConfig.js +5 -2
- package/dist/options/config/projectConfig.test.js +35 -6
- package/dist/options/config/readConfigFile.d.ts +26 -22
- package/dist/options/options.d.ts +18 -9
- package/dist/options/options.js +11 -4
- package/dist/options/options.test.js +40 -35
- package/dist/react-components/0-loadOptions.d.ts +6 -0
- package/dist/react-components/0-loadOptions.js +45 -0
- package/dist/react-components/1-loadCommit.d.ts +8 -0
- package/dist/react-components/1-loadCommit.js +88 -0
- package/dist/react-components/1a-loadCommit.d.ts +5 -0
- package/dist/react-components/1a-loadCommit.js +76 -0
- package/dist/react-components/1b-commitChoices.d.ts +5 -0
- package/dist/react-components/1b-commitChoices.js +98 -0
- package/dist/react-components/2-commitChoices.d.ts +8 -0
- package/dist/react-components/2-commitChoices.js +96 -0
- package/dist/react-components/2-commitsPrompt.d.ts +8 -0
- package/dist/react-components/2-commitsPrompt.js +96 -0
- package/dist/react-components/2-targetBranchChoices.d.ts +9 -0
- package/dist/react-components/2-targetBranchChoices.js +109 -0
- package/dist/react-components/3-cherrypick.d.ts +1 -0
- package/dist/react-components/3-cherrypick.js +2 -0
- package/dist/react-components/App.d.ts +2 -0
- package/dist/react-components/App.js +35 -0
- package/dist/react-components/BackportStateContext.d.ts +33 -0
- package/dist/react-components/BackportStateContext.js +42 -0
- package/dist/react-components/CommitPrompt/2-commitsPrompt.d.ts +8 -0
- package/dist/react-components/CommitPrompt/2-commitsPrompt.js +96 -0
- package/dist/react-components/CommitPrompt/CommitPrompt.d.ts +8 -0
- package/dist/react-components/CommitPrompt/CommitPrompt.js +96 -0
- package/dist/react-components/CommitPrompt/getCommits.d.ts +2 -0
- package/dist/react-components/CommitPrompt/getCommits.js +27 -0
- package/dist/react-components/CommitPrompt.d.ts +8 -0
- package/dist/react-components/CommitPrompt.js +96 -0
- package/dist/react-components/CustomMultiSelect.d.ts +13 -0
- package/dist/react-components/CustomMultiSelect.js +21 -0
- package/dist/react-components/CustomMultiSelectItem.d.ts +5 -0
- package/dist/react-components/CustomMultiSelectItem.js +12 -0
- package/dist/react-components/CustomSelect.d.ts +14 -0
- package/dist/react-components/CustomSelect.js +34 -0
- package/dist/react-components/ErrorBoundary.d.ts +15 -0
- package/dist/react-components/ErrorBoundary.js +53 -0
- package/dist/react-components/MultiSelect.d.ts +7 -0
- package/dist/react-components/MultiSelect.js +16 -0
- package/dist/react-components/hooks/useAsync.d.ts +12 -0
- package/dist/react-components/hooks/useAsync.js +73 -0
- package/dist/runSequentially.test.js +11 -13
- package/dist/scripts/postinstall.js +3 -3
- package/dist/services/HandledError.d.ts +1 -1
- package/dist/services/backportRun/backportRun.ci.d.ts +6 -0
- package/dist/services/backportRun/backportRun.ci.js +81 -0
- package/dist/services/backportRun/backportRun.d.ts +14 -0
- package/dist/services/backportRun/backportRun.interactive.d.ts +1 -0
- package/dist/services/backportRun/backportRun.interactive.js +4 -0
- package/dist/services/backportRun/backportRun.js +14 -0
- package/dist/services/backportRun/backportState.d.ts +4 -0
- package/dist/services/backportRun/backportState.js +28 -0
- package/dist/services/backportRun/getCommits.d.ts +2 -0
- package/dist/services/backportRun/getCommits.js +20 -0
- package/dist/services/backportRun/runSequentially.d.ts +20 -0
- package/dist/services/backportRun/runSequentially.js +41 -0
- package/dist/services/backportRun/runSequentially.test.d.ts +1 -0
- package/dist/services/backportRun/runSequentially.test.js +199 -0
- package/dist/services/cherrypickAndCreateTargetPullRequest.d.ts +12 -0
- package/dist/services/cherrypickAndCreateTargetPullRequest.js +206 -0
- package/dist/services/cherrypickAndCreateTargetPullRequest.test.d.ts +1 -0
- package/dist/services/cherrypickAndCreateTargetPullRequest.test.js +403 -0
- package/dist/services/env.d.ts +5 -4
- package/dist/services/env.js +13 -11
- package/dist/services/env.test.js +0 -6
- package/dist/services/getCommits.d.ts +2 -0
- package/dist/services/getCommits.js +38 -0
- package/dist/services/getCommitsWithoutBackports.d.ts +11 -0
- package/dist/services/getCommitsWithoutBackports.js +68 -0
- package/dist/services/getCommitsWithoutBackports.test.d.ts +1 -0
- package/dist/services/getCommitsWithoutBackports.test.js +259 -0
- package/dist/services/getTargetBranches.d.ts +5 -0
- package/dist/services/getTargetBranches.js +60 -0
- package/dist/services/getTargetBranches.test.d.ts +1 -0
- package/dist/services/getTargetBranches.test.js +180 -0
- package/dist/services/git.d.ts +2 -1
- package/dist/services/git.js +5 -3
- package/dist/services/github/v3/createPullRequest.js +8 -5
- package/dist/services/github/v3/createPullRequest.test.js +60 -10
- package/dist/services/github/v3/createStatusComment.d.ts +2 -2
- package/dist/services/github/v3/createStatusComment.js +40 -15
- package/dist/services/github/v3/createStatusComment.test.js +174 -86
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +78 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +1 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +64 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +5 -5
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +60 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +2 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +17 -10
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +72 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +6 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +8 -7
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +8 -0
- package/dist/services/github/v4/fetchProjectConfig.d.ts +1 -1
- package/dist/services/github/v4/fetchProjectConfig.js +3 -3
- package/dist/services/github/v4/fetchProjectConfig.private.test.js +5 -5
- package/dist/services/github/v4/fetchRemoteProjectConfig.d.ts +8 -0
- package/dist/services/github/v4/fetchRemoteProjectConfig.js +56 -0
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +52 -0
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +4 -0
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +0 -7
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +16 -5
- package/dist/services/logger.d.ts +4 -2
- package/dist/services/logger.js +31 -32
- package/dist/services/maybeSetupRepo.d.ts +2 -0
- package/dist/services/maybeSetupRepo.js +33 -0
- package/dist/services/maybeSetupRepo.test.d.ts +1 -0
- package/dist/services/maybeSetupRepo.test.js +78 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +4 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +8 -2
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +20 -0
- package/dist/services/sourceCommit/getMockSourceCommit.d.ts +1 -0
- package/dist/services/sourceCommit/getMockSourceCommit.js +72 -46
- package/dist/services/sourceCommit/parseSourceCommit.d.ts +22 -8
- package/dist/services/sourceCommit/parseSourceCommit.js +29 -10
- package/dist/services/sourceCommit/parseSourceCommit.test.js +10 -2
- package/dist/test/backport-e2e.private.test.d.ts +1 -0
- package/dist/test/backport-e2e.private.test.js +325 -0
- package/dist/test/handleUnbackportedPullRequests.private.test.d.ts +1 -0
- package/dist/test/handleUnbackportedPullRequests.private.test.js +43 -0
- package/dist/test/inquirer.private.test.js +3 -1
- package/dist/test/integration/integration.private.test.js +2 -2
- package/dist/test/nockHelpers.js +1 -3
- package/dist/test/setupFiles/automatic-mocks.js +1 -0
- package/dist/todo-delete.d.ts +1 -0
- package/dist/todo-delete.js +17 -0
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +4 -3
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +9 -12
- package/dist/ui/getCommits.js +1 -1
- package/dist/ui/getCommitsWithoutBackports.js +17 -2
- package/dist/ui/maybeSetupRepo.js +0 -6
- package/dist/ui/maybeSetupRepo.test.js +8 -4
- package/dist/utils/redact.d.ts +1 -0
- package/dist/utils/redact.js +7 -0
- package/dist/utils/sequentially.d.ts +1 -0
- package/dist/utils/sequentially.js +10 -0
- package/package.json +11 -11
- package/yarn.lock +570 -436
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCommits = void 0;
|
|
4
|
+
const fetchCommitByPullNumber_1 = require("../../services/github/v4/fetchCommits/fetchCommitByPullNumber");
|
|
5
|
+
const fetchCommitBySha_1 = require("../../services/github/v4/fetchCommits/fetchCommitBySha");
|
|
6
|
+
const fetchCommitsByAuthor_1 = require("../../services/github/v4/fetchCommits/fetchCommitsByAuthor");
|
|
7
|
+
const fetchPullRequestBySearchQuery_1 = require("../../services/github/v4/fetchCommits/fetchPullRequestBySearchQuery");
|
|
8
|
+
async function getCommits(options) {
|
|
9
|
+
if (options.sha) {
|
|
10
|
+
return (0, fetchCommitBySha_1.fetchCommitBySha)({ ...options, sha: options.sha });
|
|
11
|
+
}
|
|
12
|
+
if (options.pullNumber) {
|
|
13
|
+
return await (0, fetchCommitByPullNumber_1.fetchCommitByPullNumber)({
|
|
14
|
+
...options,
|
|
15
|
+
pullNumber: options.pullNumber, // must extract pullNumber to satisfy the ts gods
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const commitChoices = options.prFilter
|
|
19
|
+
? await (0, fetchPullRequestBySearchQuery_1.fetchPullRequestBySearchQuery)(options)
|
|
20
|
+
: await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)(options);
|
|
21
|
+
return promptForCommits({
|
|
22
|
+
commitChoices,
|
|
23
|
+
isMultipleChoice: options.multipleCommits,
|
|
24
|
+
showDetails: options.details,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.getCommits = getCommits;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ValidConfigOptions } from '../../options/options';
|
|
3
|
+
import { AsyncStatus } from '../hooks/useAsync';
|
|
4
|
+
export declare function CommitPrompt({ options, optionsStatus, optionsError, }: {
|
|
5
|
+
options?: ValidConfigOptions;
|
|
6
|
+
optionsStatus: AsyncStatus;
|
|
7
|
+
optionsError: Error | null;
|
|
8
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,96 @@
|
|
|
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.CommitPrompt = void 0;
|
|
26
|
+
const ink_multi_select_1 = __importDefault(require("ink-multi-select"));
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const fetchCommitByPullNumber_1 = require("../../services/github/v4/fetchCommits/fetchCommitByPullNumber");
|
|
29
|
+
const fetchCommitBySha_1 = require("../../services/github/v4/fetchCommits/fetchCommitBySha");
|
|
30
|
+
const fetchCommitsByAuthor_1 = require("../../services/github/v4/fetchCommits/fetchCommitsByAuthor");
|
|
31
|
+
const fetchPullRequestBySearchQuery_1 = require("../../services/github/v4/fetchCommits/fetchPullRequestBySearchQuery");
|
|
32
|
+
const logger_1 = require("../../services/logger");
|
|
33
|
+
const BackportStateContext_1 = require("../BackportStateContext");
|
|
34
|
+
const useAsync_1 = require("../hooks/useAsync");
|
|
35
|
+
function CommitPrompt({ options, optionsStatus, optionsError, }) {
|
|
36
|
+
const { setBackportState } = (0, BackportStateContext_1.useBackportStateContext)();
|
|
37
|
+
const [choices, setChoices] = (0, react_1.useState)([]);
|
|
38
|
+
const [loadingStatus, setLoadingStatus] = (0, react_1.useState)('loading');
|
|
39
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
40
|
+
(0, react_1.useEffect)(() => {
|
|
41
|
+
async function fetch() {
|
|
42
|
+
if (!options) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const commit = await getCommit(options);
|
|
46
|
+
if (commit) {
|
|
47
|
+
setBackportState({
|
|
48
|
+
view: 'target-branches-prompt',
|
|
49
|
+
commits: [commit],
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const commitChoices = options.prFilter
|
|
54
|
+
? await (0, fetchPullRequestBySearchQuery_1.fetchPullRequestBySearchQuery)(options)
|
|
55
|
+
: await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)(options);
|
|
56
|
+
setChoices(commitChoices);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
fetch()
|
|
60
|
+
.then(() => {
|
|
61
|
+
setLoadingStatus('success');
|
|
62
|
+
})
|
|
63
|
+
.catch((e) => {
|
|
64
|
+
setLoadingStatus('failure');
|
|
65
|
+
setError(e);
|
|
66
|
+
});
|
|
67
|
+
}, [options]);
|
|
68
|
+
// console.log({ optionsStatus, loadingStatus });
|
|
69
|
+
if (optionsStatus !== 'success') {
|
|
70
|
+
return (react_1.default.createElement(useAsync_1.ShowAsyncStatus, { text: "Initializing", status: optionsStatus, error: optionsError }));
|
|
71
|
+
}
|
|
72
|
+
if (loadingStatus !== 'success') {
|
|
73
|
+
return (react_1.default.createElement(useAsync_1.ShowAsyncStatus, { text: "Loading commits", status: loadingStatus, error: error }));
|
|
74
|
+
}
|
|
75
|
+
logger_1.logger.info(`tester: ${optionsStatus}, ${loadingStatus}, ${choices.length}`);
|
|
76
|
+
const handleSubmit = (items) => {
|
|
77
|
+
console.log(items);
|
|
78
|
+
};
|
|
79
|
+
const items = choices.map((c) => ({
|
|
80
|
+
label: c.originalMessage,
|
|
81
|
+
value: c.originalMessage,
|
|
82
|
+
}));
|
|
83
|
+
return react_1.default.createElement(ink_multi_select_1.default, { items: items, onSubmit: handleSubmit });
|
|
84
|
+
}
|
|
85
|
+
exports.CommitPrompt = CommitPrompt;
|
|
86
|
+
function getCommit(options) {
|
|
87
|
+
if (options.sha) {
|
|
88
|
+
return (0, fetchCommitBySha_1.fetchCommitBySha)({ ...options, sha: options.sha });
|
|
89
|
+
}
|
|
90
|
+
if (options.pullNumber) {
|
|
91
|
+
return (0, fetchCommitByPullNumber_1.fetchCommitByPullNumber)({
|
|
92
|
+
...options,
|
|
93
|
+
pullNumber: options.pullNumber, // must extract pullNumber to satisfy the ts gods
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ListedItem, SelectedItem } from 'ink-multi-select';
|
|
3
|
+
export declare function ItemComponent({ isHighlighted, label, }: {
|
|
4
|
+
isHighlighted?: boolean;
|
|
5
|
+
label: string;
|
|
6
|
+
}): JSX.Element;
|
|
7
|
+
export declare function CustomSelect({ defaultSelected, items, onMultiSubmit, onSingleSelect, isMultiSelect, }: {
|
|
8
|
+
defaultSelected?: SelectedItem[];
|
|
9
|
+
items: ListedItem[];
|
|
10
|
+
onMultiSubmit: (item: ListedItem[]) => void;
|
|
11
|
+
onSingleSelect: (item: ListedItem) => void;
|
|
12
|
+
isMultiSelect: boolean;
|
|
13
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
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.CustomSelect = exports.ItemComponent = void 0;
|
|
7
|
+
const ink_1 = require("ink");
|
|
8
|
+
const ink_multi_select_1 = __importDefault(require("ink-multi-select"));
|
|
9
|
+
const ink_select_input_1 = __importDefault(require("ink-select-input"));
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
11
|
+
function ItemComponent({ isHighlighted, label, }) {
|
|
12
|
+
return react_1.default.createElement(ink_1.Text, { color: isHighlighted ? 'cyanBright' : undefined }, label);
|
|
13
|
+
}
|
|
14
|
+
exports.ItemComponent = ItemComponent;
|
|
15
|
+
function CustomSelect({ defaultSelected, items, onMultiSubmit, onSingleSelect, isMultiSelect, }) {
|
|
16
|
+
if (isMultiSelect) {
|
|
17
|
+
return (react_1.default.createElement(ink_multi_select_1.default, { itemComponent: ItemComponent, defaultSelected: defaultSelected, items: items, onSubmit: onMultiSubmit }));
|
|
18
|
+
}
|
|
19
|
+
return (react_1.default.createElement(ink_select_input_1.default, { itemComponent: ItemComponent, items: items.map(({ label, value }) => ({ label, value })), onSelect: onSingleSelect }));
|
|
20
|
+
}
|
|
21
|
+
exports.CustomSelect = CustomSelect;
|
|
@@ -0,0 +1,12 @@
|
|
|
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.CustomMultiSelectItem = void 0;
|
|
7
|
+
const ink_1 = require("ink");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
function CustomMultiSelectItem({ isHighlighted, label, }) {
|
|
10
|
+
return react_1.default.createElement(ink_1.Text, { color: isHighlighted ? 'cyanBright' : undefined }, label);
|
|
11
|
+
}
|
|
12
|
+
exports.CustomMultiSelectItem = CustomMultiSelectItem;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SelectedItem } from 'ink-multi-select';
|
|
3
|
+
export declare type SelectItem<V> = {
|
|
4
|
+
label: string;
|
|
5
|
+
value: V;
|
|
6
|
+
key?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function CustomSelect<V>({ defaultSelected, items, onMultiSubmit, onSingleSelect, isMultiSelect, }: {
|
|
9
|
+
defaultSelected?: SelectedItem[];
|
|
10
|
+
items: SelectItem<V>[];
|
|
11
|
+
onMultiSubmit: (item: SelectItem<V>[]) => void;
|
|
12
|
+
onSingleSelect: (item: SelectItem<V>) => void;
|
|
13
|
+
isMultiSelect: boolean;
|
|
14
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
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.CustomSelect = void 0;
|
|
7
|
+
const figures_1 = __importDefault(require("figures"));
|
|
8
|
+
const ink_1 = require("ink");
|
|
9
|
+
const ink_link_1 = __importDefault(require("ink-link"));
|
|
10
|
+
const ink_multi_select_1 = __importDefault(require("ink-multi-select"));
|
|
11
|
+
const ink_select_input_1 = __importDefault(require("ink-select-input"));
|
|
12
|
+
const react_1 = __importDefault(require("react"));
|
|
13
|
+
function IndicatorComponent({ isSelected = false }) {
|
|
14
|
+
return (react_1.default.createElement(ink_1.Box, { marginRight: 1 }, isSelected ? (react_1.default.createElement(ink_1.Text, { color: "greenBright" }, figures_1.default.pointer)) : (react_1.default.createElement(ink_1.Text, null, " "))));
|
|
15
|
+
}
|
|
16
|
+
function IndicatorComponentMulti({ isHighlighted = false, }) {
|
|
17
|
+
return IndicatorComponent({ isSelected: isHighlighted });
|
|
18
|
+
}
|
|
19
|
+
function ItemComponent({ isHighlighted, label, value, }) {
|
|
20
|
+
return (react_1.default.createElement(ink_1.Box, { flexDirection: "column", marginBottom: 1 },
|
|
21
|
+
react_1.default.createElement(ink_1.Text, { color: isHighlighted ? 'greenBright' : undefined }, label),
|
|
22
|
+
react_1.default.createElement(ink_link_1.default, { url: value.pullUrl },
|
|
23
|
+
"My ",
|
|
24
|
+
react_1.default.createElement(ink_1.Text, { color: "cyan" }, "Website"))));
|
|
25
|
+
}
|
|
26
|
+
function CustomSelect({ defaultSelected, items, onMultiSubmit, onSingleSelect, isMultiSelect, }) {
|
|
27
|
+
if (isMultiSelect) {
|
|
28
|
+
return (react_1.default.createElement(ink_multi_select_1.default, { indicatorComponent: IndicatorComponentMulti, itemComponent: ItemComponent, defaultSelected: defaultSelected, items: items,
|
|
29
|
+
//@ts-expect-error
|
|
30
|
+
onSubmit: onMultiSubmit }));
|
|
31
|
+
}
|
|
32
|
+
return (react_1.default.createElement(ink_select_input_1.default, { limit: 5, indicatorComponent: IndicatorComponent, itemComponent: ItemComponent, items: items, onSelect: onSingleSelect }));
|
|
33
|
+
}
|
|
34
|
+
exports.CustomSelect = CustomSelect;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { Component, ErrorInfo, ReactNode } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
interface State {
|
|
6
|
+
hasError: boolean;
|
|
7
|
+
error: Error | null;
|
|
8
|
+
}
|
|
9
|
+
declare class ErrorBoundary extends Component<Props, State> {
|
|
10
|
+
state: State;
|
|
11
|
+
static getDerivedStateFromError(error: Error): State;
|
|
12
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
13
|
+
render(): React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export default ErrorBoundary;
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
const ink_1 = require("ink");
|
|
23
|
+
const react_1 = __importStar(require("react"));
|
|
24
|
+
const logger_1 = require("../services/logger");
|
|
25
|
+
class ErrorBoundary extends react_1.Component {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
this.state = {
|
|
29
|
+
hasError: false,
|
|
30
|
+
error: null,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
static getDerivedStateFromError(error) {
|
|
34
|
+
// Update state so the next render will show the fallback UI.
|
|
35
|
+
return { hasError: true, error };
|
|
36
|
+
}
|
|
37
|
+
componentDidCatch(error, errorInfo) {
|
|
38
|
+
logger_1.logger.error('Uncaught error:', error);
|
|
39
|
+
logger_1.logger.error('Error details', errorInfo);
|
|
40
|
+
}
|
|
41
|
+
render() {
|
|
42
|
+
if (this.state.error) {
|
|
43
|
+
if (process.env.NODE_ENV === 'development') {
|
|
44
|
+
throw this.state.error;
|
|
45
|
+
}
|
|
46
|
+
return react_1.default.createElement(ink_1.Text, null,
|
|
47
|
+
"Sorry.. there was an error: ",
|
|
48
|
+
this.state.error.stack);
|
|
49
|
+
}
|
|
50
|
+
return this.props.children;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.default = ErrorBoundary;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ListedItem, SelectedItem } from 'ink-multi-select';
|
|
3
|
+
export declare function CustomMultiSelect({ defaultSelected, items, onSubmit, }: {
|
|
4
|
+
defaultSelected?: SelectedItem[];
|
|
5
|
+
items: ListedItem[] | undefined;
|
|
6
|
+
onSubmit: (item: ListedItem[]) => void;
|
|
7
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
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.CustomMultiSelect = void 0;
|
|
7
|
+
const ink_1 = require("ink");
|
|
8
|
+
const ink_multi_select_1 = __importDefault(require("ink-multi-select"));
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
function Item({ isHighlighted, label, }) {
|
|
11
|
+
return react_1.default.createElement(ink_1.Text, { color: isHighlighted ? 'cyanBright' : undefined }, label);
|
|
12
|
+
}
|
|
13
|
+
function CustomMultiSelect({ defaultSelected, items, onSubmit, }) {
|
|
14
|
+
return (react_1.default.createElement(ink_multi_select_1.default, { itemComponent: Item, defaultSelected: defaultSelected, items: items, onSubmit: onSubmit }));
|
|
15
|
+
}
|
|
16
|
+
exports.CustomMultiSelect = CustomMultiSelect;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type AsyncStatus = 'loading' | 'success' | 'failure';
|
|
3
|
+
export declare function useAsync<T>(fn: () => Promise<T>): {
|
|
4
|
+
data: T | undefined;
|
|
5
|
+
status: AsyncStatus;
|
|
6
|
+
error: Error | null;
|
|
7
|
+
};
|
|
8
|
+
export declare function ShowAsyncStatus({ status, text, error, }: {
|
|
9
|
+
status: AsyncStatus;
|
|
10
|
+
text: string;
|
|
11
|
+
error: Error | null;
|
|
12
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,73 @@
|
|
|
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.ShowAsyncStatus = exports.useAsync = 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
|
+
function useAsync(fn) {
|
|
30
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
31
|
+
const [data, setData] = (0, react_1.useState)();
|
|
32
|
+
const [status, setStatus] = (0, react_1.useState)('loading');
|
|
33
|
+
(0, react_1.useEffect)(() => {
|
|
34
|
+
async function fetch() {
|
|
35
|
+
try {
|
|
36
|
+
const data = await fn();
|
|
37
|
+
setStatus('success');
|
|
38
|
+
setData(data);
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
setStatus('failure');
|
|
42
|
+
setError(e);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
fetch();
|
|
46
|
+
}, []);
|
|
47
|
+
return { data, status, error };
|
|
48
|
+
}
|
|
49
|
+
exports.useAsync = useAsync;
|
|
50
|
+
function ShowAsyncStatus({ status, text, error, }) {
|
|
51
|
+
if (status === 'loading') {
|
|
52
|
+
return (react_1.default.createElement(ink_1.Text, null,
|
|
53
|
+
react_1.default.createElement(ink_1.Text, { color: "green" },
|
|
54
|
+
react_1.default.createElement(ink_spinner_1.default, { type: "dots" })),
|
|
55
|
+
"\u00A0",
|
|
56
|
+
text));
|
|
57
|
+
}
|
|
58
|
+
if (status === 'success') {
|
|
59
|
+
return (react_1.default.createElement(ink_1.Text, null,
|
|
60
|
+
react_1.default.createElement(ink_1.Text, { color: "green" }, "\u2705"),
|
|
61
|
+
"\u00A0",
|
|
62
|
+
text));
|
|
63
|
+
}
|
|
64
|
+
return (react_1.default.createElement(ink_1.Text, null,
|
|
65
|
+
react_1.default.createElement(ink_1.Text, { color: "green" }, "\u274C"),
|
|
66
|
+
"\u00A0",
|
|
67
|
+
text,
|
|
68
|
+
react_1.default.createElement(ink_1.Newline, null),
|
|
69
|
+
react_1.default.createElement(ink_1.Newline, null),
|
|
70
|
+
react_1.default.createElement(ink_1.Text, null, error?.message)));
|
|
71
|
+
}
|
|
72
|
+
exports.ShowAsyncStatus = ShowAsyncStatus;
|
|
73
|
+
// render(<TaskStatus status="failed" text="Loading..." />);
|
|
@@ -56,39 +56,41 @@ describe('runSequentially', () => {
|
|
|
56
56
|
jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
|
|
57
57
|
const options = {
|
|
58
58
|
accessToken: 'myAccessToken',
|
|
59
|
-
authenticatedUsername: 'sqren_authenticated',
|
|
60
59
|
assignees: [],
|
|
60
|
+
authenticatedUsername: 'sqren_authenticated',
|
|
61
|
+
author: 'sqren',
|
|
61
62
|
autoAssign: false,
|
|
62
63
|
autoFixConflicts: undefined,
|
|
63
64
|
autoMerge: false,
|
|
64
65
|
autoMergeMethod: 'merge',
|
|
65
66
|
backportBinary: 'node scripts/backport',
|
|
66
67
|
branchLabelMapping: undefined,
|
|
67
|
-
historicalBranchLabelMappings: [],
|
|
68
68
|
cherrypickRef: true,
|
|
69
69
|
ci: false,
|
|
70
70
|
commitPaths: [],
|
|
71
|
+
dateSince: null,
|
|
72
|
+
dateUntil: null,
|
|
71
73
|
details: false,
|
|
72
74
|
editor: 'code',
|
|
73
|
-
skipRemoteConfig: undefined,
|
|
74
75
|
fork: true,
|
|
75
76
|
gitHostname: 'github.com',
|
|
76
77
|
githubApiBaseUrlV3: 'https://api.github.com',
|
|
77
78
|
githubApiBaseUrlV4: 'http://localhost/graphql',
|
|
79
|
+
historicalBranchLabelMappings: [],
|
|
78
80
|
mainline: undefined,
|
|
79
81
|
maxNumber: 10,
|
|
80
82
|
multipleBranches: false,
|
|
81
83
|
multipleCommits: false,
|
|
82
84
|
noVerify: true,
|
|
83
|
-
prDescription: 'myPrDescription',
|
|
84
85
|
prFilter: undefined,
|
|
85
|
-
|
|
86
|
+
publishStatusComment: true,
|
|
86
87
|
pullNumber: undefined,
|
|
87
88
|
repoName: 'kibana',
|
|
88
89
|
repoOwner: 'elastic',
|
|
89
90
|
resetAuthor: false,
|
|
90
91
|
reviewers: [],
|
|
91
92
|
sha: undefined,
|
|
93
|
+
skipRemoteConfig: undefined,
|
|
92
94
|
sourceBranch: 'my-source-branch-from-options',
|
|
93
95
|
sourcePRLabels: [],
|
|
94
96
|
targetBranches: [],
|
|
@@ -100,7 +102,6 @@ describe('runSequentially', () => {
|
|
|
100
102
|
{ name: '5.4' },
|
|
101
103
|
],
|
|
102
104
|
targetPRLabels: [],
|
|
103
|
-
author: 'sqren',
|
|
104
105
|
verbose: false,
|
|
105
106
|
};
|
|
106
107
|
rpcExecMock = jest
|
|
@@ -146,15 +147,13 @@ describe('runSequentially', () => {
|
|
|
146
147
|
"base": "7.x",
|
|
147
148
|
"body": "# Backport
|
|
148
149
|
|
|
149
|
-
This is an automatic backport to 7.x of:
|
|
150
|
+
This is an automatic backport to \`7.x\` of:
|
|
150
151
|
- #55
|
|
151
152
|
|
|
152
153
|
### Questions ?
|
|
153
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
154
|
-
|
|
155
|
-
myPrDescription",
|
|
154
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
156
155
|
"head": "sqren_authenticated:backport/7.x/pr-55",
|
|
157
|
-
"title": "
|
|
156
|
+
"title": "[7.x] My commit message",
|
|
158
157
|
},
|
|
159
158
|
]
|
|
160
159
|
`);
|
|
@@ -184,9 +183,8 @@ describe('runSequentially', () => {
|
|
|
184
183
|
expect(rpcExecOriginalMock.mock.calls).toMatchInlineSnapshot(`
|
|
185
184
|
Array [
|
|
186
185
|
Array [
|
|
187
|
-
"git clone https://x-access-token:myAccessToken@github.com/elastic/kibana.git --progress",
|
|
186
|
+
"git clone https://x-access-token:myAccessToken@github.com/elastic/kibana.git /myHomeDir/.backport/repositories/elastic/kibana --progress",
|
|
188
187
|
Object {
|
|
189
|
-
"cwd": "/myHomeDir/.backport/repositories/elastic",
|
|
190
188
|
"maxBuffer": 104857600,
|
|
191
189
|
},
|
|
192
190
|
[Function],
|
|
@@ -6,10 +6,10 @@ const env_1 = require("../services/env");
|
|
|
6
6
|
const logger_1 = require("../services/logger");
|
|
7
7
|
async function postinstall() {
|
|
8
8
|
try {
|
|
9
|
-
const
|
|
9
|
+
const globalConfigPath = (0, env_1.getGlobalConfigPath)();
|
|
10
|
+
const didCreate = await (0, globalConfig_1.createGlobalConfigAndFolderIfNotExist)(globalConfigPath);
|
|
10
11
|
if (didCreate) {
|
|
11
|
-
|
|
12
|
-
(0, logger_1.consoleLog)(`Global config successfully created in ${GLOBAL_CONFIG_PATH}`);
|
|
12
|
+
(0, logger_1.consoleLog)(`Global config successfully created in ${globalConfigPath}`);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
catch (e) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ConfigFileOptions } from '../../options/ConfigOptions';
|
|
2
|
+
import { ValidConfigOptions } from '../../options/options';
|
|
3
|
+
import { Commit } from '../sourceCommit/parseSourceCommit';
|
|
4
|
+
import { BackportResponse } from './backportRun';
|
|
5
|
+
export declare function backportRunCi(argv: string[], optionsFromModule?: ConfigFileOptions): Promise<BackportResponse>;
|
|
6
|
+
export declare function getTargetBranches(options: ValidConfigOptions, commit: Commit): string[];
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTargetBranches = exports.backportRunCi = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const options_1 = require("../../options/options");
|
|
6
|
+
const HandledError_1 = require("../HandledError");
|
|
7
|
+
const createStatusComment_1 = require("../github/v3/createStatusComment");
|
|
8
|
+
const fetchCommitByPullNumber_1 = require("../github/v4/fetchCommits/fetchCommitByPullNumber");
|
|
9
|
+
const fetchCommitBySha_1 = require("../github/v4/fetchCommits/fetchCommitBySha");
|
|
10
|
+
const runSequentially_1 = require("./runSequentially");
|
|
11
|
+
async function backportRunCi(argv, optionsFromModule) {
|
|
12
|
+
let options = null;
|
|
13
|
+
let commit;
|
|
14
|
+
try {
|
|
15
|
+
options = await (0, options_1.getOptions)(argv, optionsFromModule);
|
|
16
|
+
commit = await getCommit(options);
|
|
17
|
+
if (!commit) {
|
|
18
|
+
throw new HandledError_1.HandledError('`--sha` or `--pr` must be specified when running in `ci` mode');
|
|
19
|
+
}
|
|
20
|
+
const targetBranches = getTargetBranches(options, commit);
|
|
21
|
+
if (targetBranches.length === 0) {
|
|
22
|
+
throw new HandledError_1.HandledError(`There are no branches to backport to. Aborting.`);
|
|
23
|
+
}
|
|
24
|
+
const results = await (0, runSequentially_1.runSequentially)({
|
|
25
|
+
options,
|
|
26
|
+
commits: [commit],
|
|
27
|
+
targetBranches,
|
|
28
|
+
});
|
|
29
|
+
const backportResponse = {
|
|
30
|
+
status: 'success',
|
|
31
|
+
commits: [commit],
|
|
32
|
+
results,
|
|
33
|
+
};
|
|
34
|
+
await (0, createStatusComment_1.createStatusComment)({
|
|
35
|
+
options,
|
|
36
|
+
backportResponse,
|
|
37
|
+
});
|
|
38
|
+
return backportResponse;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
console.error(e);
|
|
42
|
+
const backportResponse = {
|
|
43
|
+
status: 'failure',
|
|
44
|
+
commits: commit ? [commit] : [],
|
|
45
|
+
errorMessage: e.message,
|
|
46
|
+
error: e,
|
|
47
|
+
};
|
|
48
|
+
if (options) {
|
|
49
|
+
await (0, createStatusComment_1.createStatusComment)({
|
|
50
|
+
options,
|
|
51
|
+
backportResponse,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return backportResponse;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.backportRunCi = backportRunCi;
|
|
58
|
+
function getCommit(options) {
|
|
59
|
+
if (options.sha) {
|
|
60
|
+
return (0, fetchCommitBySha_1.fetchCommitBySha)({
|
|
61
|
+
...options,
|
|
62
|
+
sha: options.sha, // must extract sha to satisfy the ts gods
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if (options.pullNumber) {
|
|
66
|
+
return (0, fetchCommitByPullNumber_1.fetchCommitByPullNumber)({
|
|
67
|
+
...options,
|
|
68
|
+
pullNumber: options.pullNumber, // must extract pullNumber to satisfy the ts gods
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function getTargetBranches(options, commit) {
|
|
73
|
+
// target branches already specified (in contrast to letting the user choose from a list)
|
|
74
|
+
if (!(0, lodash_1.isEmpty)(options.targetBranches)) {
|
|
75
|
+
return options.targetBranches;
|
|
76
|
+
}
|
|
77
|
+
return commit.expectedTargetPullRequests
|
|
78
|
+
.filter((pr) => pr.state === 'MISSING')
|
|
79
|
+
.map((pr) => pr.branch);
|
|
80
|
+
}
|
|
81
|
+
exports.getTargetBranches = getTargetBranches;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ConfigFileOptions } from '../../options/ConfigOptions';
|
|
2
|
+
import { Commit } from '../sourceCommit/parseSourceCommit';
|
|
3
|
+
import { Result } from './runSequentially';
|
|
4
|
+
export declare type BackportResponse = {
|
|
5
|
+
status: 'success';
|
|
6
|
+
commits: Commit[];
|
|
7
|
+
results: Result[];
|
|
8
|
+
} | {
|
|
9
|
+
status: 'failure';
|
|
10
|
+
commits: Commit[];
|
|
11
|
+
errorMessage: string;
|
|
12
|
+
error: Error;
|
|
13
|
+
};
|
|
14
|
+
export declare function backportRun(argv: string[], optionsFromModule?: ConfigFileOptions): Promise<BackportResponse | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare function backportRun(): void;
|