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
|
@@ -103,13 +103,14 @@ function getBackportBranchName(targetBranch, commits) {
|
|
|
103
103
|
exports.getBackportBranchName = getBackportBranchName;
|
|
104
104
|
async function waitForCherrypick(options, commit, targetBranch) {
|
|
105
105
|
const spinnerText = `Cherry-picking: ${chalk_1.default.greenBright((0, commitFormatters_1.getFirstLine)(commit.originalMessage))}`;
|
|
106
|
+
const mergedTargetPullRequest = commit.expectedTargetPullRequests.find((pr) => pr.state === 'MERGED' && pr.branch === targetBranch);
|
|
106
107
|
const cherrypickSpinner = ora(spinnerText).start();
|
|
107
108
|
let conflictingFiles;
|
|
108
109
|
let unstagedFiles;
|
|
109
110
|
let needsResolving;
|
|
110
111
|
try {
|
|
111
112
|
await (0, git_1.fetchBranch)(options, commit.sourceBranch);
|
|
112
|
-
({ conflictingFiles, unstagedFiles, needsResolving } = await (0, git_1.cherrypick)(options, commit.sha));
|
|
113
|
+
({ conflictingFiles, unstagedFiles, needsResolving } = await (0, git_1.cherrypick)(options, commit.sha, mergedTargetPullRequest));
|
|
113
114
|
// no conflicts encountered
|
|
114
115
|
if (!needsResolving) {
|
|
115
116
|
cherrypickSpinner.succeed();
|
|
@@ -147,13 +148,13 @@ async function waitForCherrypick(options, commit, targetBranch) {
|
|
|
147
148
|
});
|
|
148
149
|
if (options.ci) {
|
|
149
150
|
throw new HandledError_1.HandledError(`Commit could not be cherrypicked due to conflicts`, {
|
|
150
|
-
type: '
|
|
151
|
+
type: 'merge-conflict-due-to-missing-backports',
|
|
151
152
|
commitsWithoutBackports,
|
|
152
153
|
});
|
|
153
154
|
}
|
|
154
155
|
(0, logger_1.consoleLog)(chalk_1.default.bold('\nThe commit could not be backported due to conflicts\n'));
|
|
155
156
|
if (commitsWithoutBackports.length > 0) {
|
|
156
|
-
(0, logger_1.consoleLog)(chalk_1.default.italic(`Hint: Before fixing the conflicts manually you should consider backporting the following
|
|
157
|
+
(0, logger_1.consoleLog)(chalk_1.default.italic(`Hint: Before fixing the conflicts manually you should consider backporting the following pull requests to "${targetBranch}":`));
|
|
157
158
|
(0, logger_1.consoleLog)(`${commitsWithoutBackports.map((c) => c.formatted).join('\n')}\n\n`);
|
|
158
159
|
}
|
|
159
160
|
/*
|
|
@@ -63,7 +63,6 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
63
63
|
assignees: [],
|
|
64
64
|
authenticatedUsername: 'sqren_authenticated',
|
|
65
65
|
fork: true,
|
|
66
|
-
prDescription: 'myPrSuffix',
|
|
67
66
|
prTitle: '[{targetBranch}] {commitMessages}',
|
|
68
67
|
repoName: 'kibana',
|
|
69
68
|
repoOwner: 'elastic',
|
|
@@ -110,14 +109,12 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
110
109
|
"base": "6.x",
|
|
111
110
|
"body": "# Backport
|
|
112
111
|
|
|
113
|
-
This is an automatic backport to 6.x of:
|
|
112
|
+
This is an automatic backport to \`6.x\` of:
|
|
114
113
|
- #1000
|
|
115
114
|
- #2000
|
|
116
115
|
|
|
117
116
|
### Questions ?
|
|
118
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
119
|
-
|
|
120
|
-
myPrSuffix",
|
|
117
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
121
118
|
"head": "sqren_authenticated:backport/6.x/pr-1000_pr-2000",
|
|
122
119
|
"title": "[6.x] My original commit message (#1000) | My other commit message (#2000)",
|
|
123
120
|
},
|
|
@@ -197,12 +194,11 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
197
194
|
"base": "6.x",
|
|
198
195
|
"body": "# Backport
|
|
199
196
|
|
|
200
|
-
This is an automatic backport to 6.x of:
|
|
197
|
+
This is an automatic backport to \`6.x\` of:
|
|
201
198
|
- My original commit message (mySha)
|
|
202
199
|
|
|
203
200
|
### Questions ?
|
|
204
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
205
|
-
",
|
|
201
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
206
202
|
"head": "sqren_authenticated:backport/6.x/commit-mySha",
|
|
207
203
|
"title": "[6.x] My original commit message",
|
|
208
204
|
},
|
|
@@ -251,7 +247,7 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
251
247
|
options,
|
|
252
248
|
commits: [
|
|
253
249
|
{
|
|
254
|
-
committedDate: '
|
|
250
|
+
committedDate: '2021-08-18T16:11:38Z',
|
|
255
251
|
sourceBranch: '7.x',
|
|
256
252
|
sha: 'mySha',
|
|
257
253
|
originalMessage: 'My original commit message',
|
|
@@ -270,12 +266,11 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
270
266
|
"base": "6.x",
|
|
271
267
|
"body": "# Backport
|
|
272
268
|
|
|
273
|
-
This is an automatic backport to 6.x of:
|
|
269
|
+
This is an automatic backport to \`6.x\` of:
|
|
274
270
|
- My original commit message (mySha)
|
|
275
271
|
|
|
276
272
|
### Questions ?
|
|
277
|
-
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
|
|
278
|
-
",
|
|
273
|
+
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
279
274
|
"head": "sqren_authenticated:backport/6.x/commit-mySha",
|
|
280
275
|
"title": "[6.x] My original commit message",
|
|
281
276
|
},
|
|
@@ -320,6 +315,8 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
320
315
|
Object {
|
|
321
316
|
"authorId": null,
|
|
322
317
|
"commitPath": "conflicting-file.txt",
|
|
318
|
+
"dateSince": null,
|
|
319
|
+
"dateUntil": "2021-08-18T16:11:38Z",
|
|
323
320
|
"maxNumber": 10,
|
|
324
321
|
"repoName": "kibana",
|
|
325
322
|
"repoOwner": "elastic",
|
package/dist/ui/getCommits.js
CHANGED
|
@@ -35,7 +35,7 @@ async function getCommits(options) {
|
|
|
35
35
|
pullNumber: options.pullNumber, // must extract pullNumber to satisfy the ts gods
|
|
36
36
|
});
|
|
37
37
|
// add styles to make it look like a prompt question
|
|
38
|
-
spinner.stopAndPersist(getOraPersistsOption('Select pull request', commit.originalMessage));
|
|
38
|
+
spinner.stopAndPersist(getOraPersistsOption('Select pull request', (0, commitFormatters_1.getFirstLine)(commit.originalMessage)));
|
|
39
39
|
return [commit];
|
|
40
40
|
}
|
|
41
41
|
if (options.ci) {
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getCommitsWithoutBackports = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const git_1 = require("../services/git");
|
|
8
9
|
const commitFormatters_1 = require("../services/github/commitFormatters");
|
|
9
10
|
const fetchCommitsByAuthor_1 = require("../services/github/v4/fetchCommits/fetchCommitsByAuthor");
|
|
10
11
|
// when the user is facing a git conflict we should help them understand
|
|
@@ -20,9 +21,11 @@ conflictingFiles, }) {
|
|
|
20
21
|
const commitsInConflictingPaths = await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
|
|
21
22
|
...options,
|
|
22
23
|
author: null,
|
|
24
|
+
dateSince: null,
|
|
25
|
+
dateUntil: commit.committedDate,
|
|
23
26
|
commitPaths: conflictingFiles,
|
|
24
27
|
});
|
|
25
|
-
|
|
28
|
+
const promises = await Promise.all(commitsInConflictingPaths
|
|
26
29
|
.filter((c) => {
|
|
27
30
|
// exclude the commit we are currently trying to backport
|
|
28
31
|
if (c.sha === commit.sha) {
|
|
@@ -41,7 +44,19 @@ conflictingFiles, }) {
|
|
|
41
44
|
return hasUnmergedPr;
|
|
42
45
|
})
|
|
43
46
|
.slice(0, 10) // limit to max 10 commits
|
|
44
|
-
.map((c) => {
|
|
47
|
+
.map(async (c) => {
|
|
48
|
+
const results = await Promise.all(c.expectedTargetPullRequests.map(async (targetPr) => {
|
|
49
|
+
if (!targetPr.mergeCommit) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return (0, git_1.getIsCommitInBranch)(options, targetPr.mergeCommit.sha);
|
|
53
|
+
}));
|
|
54
|
+
const isCommitInBranch = results.some((inBranch) => inBranch === true);
|
|
55
|
+
return { c, isCommitInBranch };
|
|
56
|
+
}));
|
|
57
|
+
return promises
|
|
58
|
+
.filter(({ isCommitInBranch }) => !isCommitInBranch)
|
|
59
|
+
.map(({ c }) => {
|
|
45
60
|
// get pull request for the target branch (if it exists)
|
|
46
61
|
const pendingBackportPr = c.expectedTargetPullRequests.find((pr) => pr.branch === targetBranch && pr.state === 'OPEN');
|
|
47
62
|
const formatted = pendingBackportPr
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.maybeSetupRepo = void 0;
|
|
7
|
-
const make_dir_1 = __importDefault(require("make-dir"));
|
|
8
4
|
const ora = require("ora");
|
|
9
|
-
const env_1 = require("../services/env");
|
|
10
5
|
const git_1 = require("../services/git");
|
|
11
6
|
async function maybeSetupRepo(options) {
|
|
12
7
|
const isAlreadyCloned = await (0, git_1.repoExists)(options);
|
|
@@ -16,7 +11,6 @@ async function maybeSetupRepo(options) {
|
|
|
16
11
|
try {
|
|
17
12
|
const spinnerCloneText = 'Cloning repository (one-time operation)';
|
|
18
13
|
spinner.text = `0% ${spinnerCloneText}`;
|
|
19
|
-
await (0, make_dir_1.default)((0, env_1.getRepoOwnerPath)(options));
|
|
20
14
|
await (0, git_1.cloneRepo)(options, (progress) => {
|
|
21
15
|
spinner.text = `${progress}% ${spinnerCloneText}`;
|
|
22
16
|
});
|
|
@@ -24,7 +24,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
const os_1 = __importDefault(require("os"));
|
|
26
26
|
const del_1 = __importDefault(require("del"));
|
|
27
|
-
const makeDir = require("make-dir");
|
|
28
27
|
const childProcess = __importStar(require("../services/child-process-promisified"));
|
|
29
28
|
const fs = __importStar(require("../services/fs-promisified"));
|
|
30
29
|
const maybeSetupRepo_1 = require("./maybeSetupRepo");
|
|
@@ -38,15 +37,20 @@ describe('maybeSetupRepo', () => {
|
|
|
38
37
|
});
|
|
39
38
|
it('should delete repo if an error occurs', async () => {
|
|
40
39
|
expect.assertions(2);
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
execSpy = jest
|
|
41
|
+
.spyOn(childProcess, 'execAsCallback')
|
|
42
|
+
.mockImplementation((cmd) => {
|
|
43
|
+
if (cmd.startsWith('git clone')) {
|
|
44
|
+
throw new Error('Simulated git clone failure');
|
|
45
|
+
}
|
|
46
|
+
throw new Error('unknown error');
|
|
43
47
|
});
|
|
44
48
|
await expect((0, maybeSetupRepo_1.maybeSetupRepo)({
|
|
45
49
|
accessToken: 'myAccessToken',
|
|
46
50
|
gitHostname: 'github.com',
|
|
47
51
|
repoName: 'kibana',
|
|
48
52
|
repoOwner: 'elastic',
|
|
49
|
-
})).rejects.toThrowError('
|
|
53
|
+
})).rejects.toThrowError('Simulated git clone failure');
|
|
50
54
|
expect(del_1.default).toHaveBeenCalledWith('/myHomeDir/.backport/repositories/elastic/kibana');
|
|
51
55
|
});
|
|
52
56
|
describe('if repo already exists', () => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function redact(stringToRedact: string, str: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sequentially<T>(items: T[], handler: (item: T) => Promise<void>): Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sequentially = void 0;
|
|
4
|
+
function sequentially(items, handler) {
|
|
5
|
+
return items.reduce(async (p, item) => {
|
|
6
|
+
await p;
|
|
7
|
+
return handler(item);
|
|
8
|
+
}, Promise.resolve());
|
|
9
|
+
}
|
|
10
|
+
exports.sequentially = sequentially;
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"branches",
|
|
15
15
|
"branching"
|
|
16
16
|
],
|
|
17
|
-
"version": "6.1
|
|
17
|
+
"version": "6.2.1",
|
|
18
18
|
"main": "./dist/entrypoint.module.js",
|
|
19
19
|
"types": "dist/entrypoint.module.d.ts",
|
|
20
20
|
"bin": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"strip-json-comments": "^3.1.1",
|
|
72
72
|
"terminal-link": "^2.1.1",
|
|
73
73
|
"utility-types": "^3.10.0",
|
|
74
|
-
"winston": "^3.
|
|
74
|
+
"winston": "^3.4.0",
|
|
75
75
|
"yargs": "^17.3.1"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
@@ -80,28 +80,28 @@
|
|
|
80
80
|
"@types/inquirer": "^8.1.3",
|
|
81
81
|
"@types/jest": "^27.4.0",
|
|
82
82
|
"@types/lodash": "^4.14.178",
|
|
83
|
-
"@types/node": "^
|
|
83
|
+
"@types/node": "^17.0.8",
|
|
84
84
|
"@types/safe-json-stringify": "^1.1.2",
|
|
85
85
|
"@types/yargs": "^17.0.8",
|
|
86
86
|
"@types/yargs-parser": "^20.2.1",
|
|
87
|
-
"@typescript-eslint/eslint-plugin": "^5.9.
|
|
88
|
-
"@typescript-eslint/parser": "^5.9.
|
|
89
|
-
"eslint": "^8.
|
|
87
|
+
"@typescript-eslint/eslint-plugin": "^5.9.1",
|
|
88
|
+
"@typescript-eslint/parser": "^5.9.1",
|
|
89
|
+
"eslint": "^8.7.0",
|
|
90
90
|
"eslint-config-prettier": "^8.3.0",
|
|
91
91
|
"eslint-plugin-import": "^2.25.4",
|
|
92
|
-
"eslint-plugin-jest": "^25.
|
|
92
|
+
"eslint-plugin-jest": "^25.7.0",
|
|
93
93
|
"eslint-plugin-prettier": "^4.0.0",
|
|
94
94
|
"graphql": "^16.2.0",
|
|
95
95
|
"graphql-config": "^4.1.0",
|
|
96
96
|
"graphql-tag": "^2.12.6",
|
|
97
97
|
"husky": "^7.0.4",
|
|
98
|
-
"jest": "^27.4.
|
|
98
|
+
"jest": "^27.4.7",
|
|
99
99
|
"jest-snapshot-serializer-ansi": "^1.0.0",
|
|
100
|
-
"lint-staged": "^12.1.
|
|
101
|
-
"nock": "^13.2.
|
|
100
|
+
"lint-staged": "^12.1.7",
|
|
101
|
+
"nock": "^13.2.2",
|
|
102
102
|
"prettier": "^2.5.1",
|
|
103
103
|
"strip-ansi": "^6.0.1",
|
|
104
|
-
"ts-jest": "^27.1.
|
|
104
|
+
"ts-jest": "^27.1.3",
|
|
105
105
|
"ts-node": "^10.4.0",
|
|
106
106
|
"typescript": "^4.5.4"
|
|
107
107
|
}
|