backport 7.3.2 → 7.3.3
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 +8 -0
- package/dist/backportRun.js +7 -0
- package/dist/entrypoint.cli.js +2 -2
- package/dist/entrypoint.module.d.ts +3 -0
- package/dist/entrypoint.module.js +19 -8
- package/dist/entrypoint.module.private.test.d.ts +1 -0
- package/dist/entrypoint.module.private.test.js +592 -0
- package/dist/options/ConfigOptions.d.ts +1 -0
- package/dist/options/cliArgs.d.ts +2 -0
- package/dist/options/cliArgs.js +8 -0
- package/dist/options/config/config.d.ts +1 -0
- package/dist/options/config/readConfigFile.d.ts +1 -0
- package/dist/options/options.d.ts +2 -0
- package/dist/options/options.js +5 -5
- package/dist/options/options.test.js +9 -2
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +2 -2
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +3 -2
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +4 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +1 -1
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +1 -1
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +3 -3
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +10 -4
- package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.d.ts +12 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery.js +68 -0
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +1 -0
- package/dist/services/prompt.test.js +1 -1
- package/dist/services/prompts.js +4 -4
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +1 -1
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +1 -1
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +39 -39
- package/dist/services/sourceCommit/parseSourceCommit.test.js +3 -3
- package/dist/test/e2e/cli/cli.private.test.js +3 -0
- package/dist/test/handleUnbackportedPullRequests.private.test.js +1 -1
- package/dist/ui/getCommits.js +9 -3
- package/dist/ui/getCommitsWithoutBackports.test.js +2 -2
- package/dist/ui/getTargetBranches.js +1 -1
- package/dist/ui/getTargetBranches.test.js +2 -2
- package/dist/utils/filterMissingCommits.d.ts +2 -0
- package/dist/utils/filterMissingCommits.js +7 -0
- package/dist/utils/filterUnmergedCommits.d.ts +2 -0
- package/dist/utils/filterUnmergedCommits.js +7 -0
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +3 -2
package/dist/ui/getCommits.js
CHANGED
|
@@ -10,7 +10,7 @@ const commitFormatters_1 = require("../services/github/commitFormatters");
|
|
|
10
10
|
const fetchCommitByPullNumber_1 = require("../services/github/v4/fetchCommits/fetchCommitByPullNumber");
|
|
11
11
|
const fetchCommitBySha_1 = require("../services/github/v4/fetchCommits/fetchCommitBySha");
|
|
12
12
|
const fetchCommitsByAuthor_1 = require("../services/github/v4/fetchCommits/fetchCommitsByAuthor");
|
|
13
|
-
const
|
|
13
|
+
const fetchPullRequestsBySearchQuery_1 = require("../services/github/v4/fetchCommits/fetchPullRequestsBySearchQuery");
|
|
14
14
|
const prompts_1 = require("../services/prompts");
|
|
15
15
|
const ora_1 = require("./ora");
|
|
16
16
|
function getOraPersistsOption(question, answer) {
|
|
@@ -40,16 +40,22 @@ async function getCommits(options) {
|
|
|
40
40
|
spinner.stopAndPersist(getOraPersistsOption('Select pull request', (0, commitFormatters_1.getFirstLine)(commit.sourceCommit.message)));
|
|
41
41
|
return [commit];
|
|
42
42
|
}
|
|
43
|
-
if (options.ci) {
|
|
43
|
+
if (options.ci && !options.ls) {
|
|
44
44
|
throw new HandledError_1.HandledError('When "--ci" flag is enabled either `--sha` or `--pr` must be specified');
|
|
45
45
|
}
|
|
46
46
|
spinner.text = options.prFilter
|
|
47
47
|
? 'Loading pull requests...'
|
|
48
48
|
: `Loading commits from branch "${options.sourceBranch}"...`;
|
|
49
49
|
const commitChoices = options.prFilter
|
|
50
|
-
? await (0,
|
|
50
|
+
? await (0, fetchPullRequestsBySearchQuery_1.fetchPullRequestsBySearchQuery)({
|
|
51
|
+
...options,
|
|
52
|
+
prFilter: options.prFilter,
|
|
53
|
+
})
|
|
51
54
|
: await (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)(options);
|
|
52
55
|
spinner.stop();
|
|
56
|
+
if (options.ls) {
|
|
57
|
+
return commitChoices;
|
|
58
|
+
}
|
|
53
59
|
return (0, prompts_1.promptForCommits)({
|
|
54
60
|
commitChoices,
|
|
55
61
|
isMultipleChoice: options.multipleCommits,
|
|
@@ -95,9 +95,9 @@ describe('getCommitsWithoutBackports', () => {
|
|
|
95
95
|
});
|
|
96
96
|
expect((0, strip_ansi_1.default)(commitsWithoutBackports[0].formatted)).toEqual(' - First commit (#1) (backport missing)\n https://www.github.com/foo/bar/pull/123');
|
|
97
97
|
});
|
|
98
|
-
it('should display as missing if a backport is
|
|
98
|
+
it('should display as missing if a backport is NOT_CREATED', async () => {
|
|
99
99
|
const commitsWithoutBackports = await setupExpectedPullRequests({
|
|
100
|
-
expectedTargetPullRequests: [{ state: '
|
|
100
|
+
expectedTargetPullRequests: [{ state: 'NOT_CREATED', branch: '7.x' }],
|
|
101
101
|
});
|
|
102
102
|
expect((0, strip_ansi_1.default)(commitsWithoutBackports[0].formatted)).toEqual(' - First commit (#1) (backport missing)\n https://www.github.com/foo/bar/pull/123');
|
|
103
103
|
});
|
|
@@ -12,7 +12,7 @@ function getTargetBranches(options, commits) {
|
|
|
12
12
|
// target branches from the first commit
|
|
13
13
|
const missingTargetBranches = commits.length === 1
|
|
14
14
|
? commits[0].expectedTargetPullRequests
|
|
15
|
-
.filter((pr) => pr.state === '
|
|
15
|
+
.filter((pr) => pr.state === 'NOT_CREATED' || pr.state === 'CLOSED')
|
|
16
16
|
.map((pr) => pr.branch)
|
|
17
17
|
: [];
|
|
18
18
|
// automatically backport to specified target branches
|
|
@@ -101,7 +101,7 @@ describe('getTargetBranches', () => {
|
|
|
101
101
|
expectedTargetPullRequests: [
|
|
102
102
|
{ branch: '7.2', state: 'MERGED' },
|
|
103
103
|
{ branch: '7.1', state: 'OPEN' },
|
|
104
|
-
{ branch: '7.x', state: '
|
|
104
|
+
{ branch: '7.x', state: 'NOT_CREATED' },
|
|
105
105
|
],
|
|
106
106
|
},
|
|
107
107
|
];
|
|
@@ -142,7 +142,7 @@ describe('getTargetBranches', () => {
|
|
|
142
142
|
},
|
|
143
143
|
},
|
|
144
144
|
sourceBranch: 'master',
|
|
145
|
-
expectedTargetPullRequests: [{ branch: '7.x', state: '
|
|
145
|
+
expectedTargetPullRequests: [{ branch: '7.x', state: 'NOT_CREATED' }],
|
|
146
146
|
},
|
|
147
147
|
];
|
|
148
148
|
await (0, getTargetBranches_1.getTargetBranches)(options, commits);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterUnmergedCommits = void 0;
|
|
4
|
+
function filterUnmergedCommits(commit) {
|
|
5
|
+
return commit.expectedTargetPullRequests.some((pr) => pr.state !== 'MERGED');
|
|
6
|
+
}
|
|
7
|
+
exports.filterUnmergedCommits = filterUnmergedCommits;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterUnmergedCommits = void 0;
|
|
4
|
+
function filterUnmergedCommits(commit) {
|
|
5
|
+
return commit.expectedTargetPullRequests.some((pr) => pr.state !== 'MERGED');
|
|
6
|
+
}
|
|
7
|
+
exports.filterUnmergedCommits = filterUnmergedCommits;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "7.3.
|
|
1
|
+
export declare const PACKAGE_VERSION = "7.3.3";
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"branches",
|
|
15
15
|
"branching"
|
|
16
16
|
],
|
|
17
|
-
"version": "7.3.
|
|
17
|
+
"version": "7.3.3",
|
|
18
18
|
"main": "./dist/entrypoint.module.js",
|
|
19
19
|
"types": "dist/entrypoint.module.d.ts",
|
|
20
20
|
"bin": {
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"test-all": "jest --config ./jest.config.all.js",
|
|
34
34
|
"test-mutation": "jest --config ./jest.config.mutation.js",
|
|
35
35
|
"test-private": "jest --config ./jest.config.private.js",
|
|
36
|
-
"test": "jest"
|
|
36
|
+
"test": "jest",
|
|
37
|
+
"docker-run": "./docker/backport.sh"
|
|
37
38
|
},
|
|
38
39
|
"lint-staged": {
|
|
39
40
|
"*.ts": [
|