backport 7.0.0 → 7.1.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 +2 -1
- package/dist/backportRun.d.ts +1 -0
- package/dist/backportRun.js +4 -3
- package/dist/entrypoint.cli.e2e.private.test.js +58 -19
- package/dist/entrypoint.cli.js +12 -1
- package/dist/options/ConfigOptions.d.ts +1 -0
- package/dist/options/cliArgs.d.ts +1 -1
- package/dist/options/cliArgs.test.js +12 -0
- package/dist/options/config/config.d.ts +1 -0
- package/dist/options/config/projectConfig.js +2 -2
- package/dist/options/config/readConfigFile.d.ts +2 -1
- package/dist/options/options.d.ts +2 -5
- package/dist/options/options.test.js +26 -28
- package/dist/runSequentially.test.js +1 -2
- package/dist/services/HandledError.js +3 -1
- package/dist/services/git.js +5 -8
- package/dist/services/github/v3/addAssigneesToPullRequest.d.ts +1 -1
- package/dist/services/github/v3/addAssigneesToPullRequest.js +3 -6
- package/dist/services/github/v3/addLabelsToPullRequest.d.ts +1 -1
- package/dist/services/github/v3/addLabelsToPullRequest.js +3 -6
- package/dist/services/github/v3/addReviewersToPullRequest.d.ts +1 -1
- package/dist/services/github/v3/addReviewersToPullRequest.js +3 -6
- package/dist/services/github/v3/createPullRequest.js +2 -5
- package/dist/services/github/v3/createPullRequest.test.js +5 -5
- package/dist/services/github/v3/createStatusComment.test.js +7 -7
- package/dist/services/github/v4/FetchPullRequestId.js +5 -1
- package/dist/services/github/v4/apiRequestV4.d.ts +3 -1
- package/dist/services/github/v4/apiRequestV4.js +7 -7
- package/dist/services/github/v4/apiRequestV4.test.js +38 -11
- package/dist/services/github/v4/disablePullRequestAutoMerge.js +5 -1
- package/dist/services/github/v4/enablePullRequestAutoMerge.js +4 -3
- package/dist/services/github/v4/fetchAuthorId.js +5 -1
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +0 -3
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +6 -2
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +3 -12
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +6 -2
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +3 -11
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +0 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +6 -2
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +7 -12
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +0 -1
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +6 -2
- package/dist/services/github/v4/fetchExistingPullRequest.js +5 -1
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.js +5 -1
- package/dist/services/github/v4/fetchRemoteProjectConfig.d.ts +1 -1
- package/dist/services/github/v4/fetchRemoteProjectConfig.js +13 -20
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +1 -4
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +14 -55
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +0 -19
- package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +3 -16
- package/dist/services/github/v4/getOptionsFromGithub/query.js +9 -19
- package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.js +5 -1
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +5 -0
- package/dist/services/logger.d.ts +5 -5
- package/dist/services/logger.js +24 -23
- package/dist/services/remoteConfig.d.ts +18 -0
- package/dist/services/remoteConfig.js +39 -0
- package/dist/services/sourceCommit/getMockSourceCommit.d.ts +4 -0
- package/dist/services/sourceCommit/getMockSourceCommit.js +20 -6
- package/dist/services/sourceCommit/parseSourceCommit.d.ts +3 -4
- package/dist/services/sourceCommit/parseSourceCommit.js +73 -71
- package/dist/services/sourceCommit/parseSourceCommit.test.js +7 -17
- package/dist/test/backport-e2e.mutation.test.js +3 -3
- package/dist/test/nockHelpers.js +6 -2
- package/dist/test/setupFiles/automatic-mocks.js +5 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +4 -4
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +3 -3
- package/dist/ui/getCommits.js +2 -2
- package/dist/ui/ora.d.ts +9 -0
- package/dist/ui/ora.js +21 -0
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +2 -2
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.sourceCommitWithTargetPullRequestFragment = exports.parseSourceCommit = void 0;
|
|
4
|
-
const
|
|
7
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
|
+
const remoteConfig_1 = require("../remoteConfig");
|
|
5
9
|
const getExpectedTargetPullRequests_1 = require("./getExpectedTargetPullRequests");
|
|
6
10
|
function parseSourceCommit({ sourceCommit, options, }) {
|
|
7
11
|
const sourcePullRequest = sourceCommit.associatedPullRequests.edges?.[0]?.node;
|
|
8
12
|
// use info from associated pull request if available. Fall back to commit info
|
|
9
13
|
const sourceBranch = sourcePullRequest?.baseRefName ?? options.sourceBranch;
|
|
10
|
-
const
|
|
14
|
+
const remoteConfig = sourceCommit.remoteConfigHistory.edges?.[0]?.remoteConfig;
|
|
15
|
+
const branchLabelMapping = remoteConfig
|
|
16
|
+
? (0, remoteConfig_1.parseRemoteConfig)(remoteConfig)?.branchLabelMapping ??
|
|
17
|
+
options.branchLabelMapping
|
|
18
|
+
: options.branchLabelMapping;
|
|
11
19
|
const expectedTargetPullRequests = (0, getExpectedTargetPullRequests_1.getExpectedTargetPullRequests)(sourceCommit, branchLabelMapping);
|
|
12
20
|
return {
|
|
13
21
|
sourceCommit: {
|
|
@@ -30,72 +38,72 @@ function parseSourceCommit({ sourceCommit, options, }) {
|
|
|
30
38
|
};
|
|
31
39
|
}
|
|
32
40
|
exports.parseSourceCommit = parseSourceCommit;
|
|
33
|
-
exports.sourceCommitWithTargetPullRequestFragment =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
exports.sourceCommitWithTargetPullRequestFragment = (0, graphql_tag_1.default) `
|
|
42
|
+
fragment SourceCommitWithTargetPullRequest on Commit {
|
|
43
|
+
...RemoteConfigHistory
|
|
44
|
+
|
|
45
|
+
# Source Commit
|
|
46
|
+
repository {
|
|
47
|
+
name
|
|
48
|
+
owner {
|
|
49
|
+
login
|
|
42
50
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
}
|
|
52
|
+
sha: oid
|
|
53
|
+
message
|
|
54
|
+
committedDate
|
|
46
55
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
56
|
+
# Source pull request: PR where source commit was merged in
|
|
57
|
+
associatedPullRequests(first: 1) {
|
|
58
|
+
edges {
|
|
59
|
+
node {
|
|
60
|
+
url
|
|
61
|
+
number
|
|
62
|
+
labels(first: 50) {
|
|
63
|
+
nodes {
|
|
64
|
+
name
|
|
57
65
|
}
|
|
58
|
-
|
|
66
|
+
}
|
|
67
|
+
baseRefName
|
|
59
68
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
# source merge commit (the commit that actually went into the source branch)
|
|
70
|
+
mergeCommit {
|
|
71
|
+
sha: oid
|
|
72
|
+
message
|
|
73
|
+
}
|
|
65
74
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
# (possible) backport pull requests referenced in the source pull request
|
|
76
|
+
timelineItems(last: 20, itemTypes: CROSS_REFERENCED_EVENT) {
|
|
77
|
+
edges {
|
|
78
|
+
node {
|
|
79
|
+
... on CrossReferencedEvent {
|
|
80
|
+
targetPullRequest: source {
|
|
81
|
+
__typename
|
|
73
82
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
83
|
+
# Target PRs (backport PRs)
|
|
84
|
+
... on PullRequest {
|
|
85
|
+
# target merge commit: the backport commit that was merged into the target branch
|
|
86
|
+
targetMergeCommit: mergeCommit {
|
|
87
|
+
sha: oid
|
|
88
|
+
message
|
|
89
|
+
}
|
|
90
|
+
repository {
|
|
91
|
+
name
|
|
92
|
+
owner {
|
|
93
|
+
login
|
|
86
94
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
}
|
|
96
|
+
url
|
|
97
|
+
title
|
|
98
|
+
state
|
|
99
|
+
baseRefName
|
|
100
|
+
number
|
|
101
|
+
commits(first: 20) {
|
|
102
|
+
edges {
|
|
103
|
+
node {
|
|
104
|
+
targetCommit: commit {
|
|
105
|
+
message
|
|
106
|
+
sha: oid
|
|
99
107
|
}
|
|
100
108
|
}
|
|
101
109
|
}
|
|
@@ -109,13 +117,7 @@ exports.sourceCommitWithTargetPullRequestFragment = {
|
|
|
109
117
|
}
|
|
110
118
|
}
|
|
111
119
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return branchLabelMapping;
|
|
117
|
-
}
|
|
118
|
-
const match = historicalBranchLabelMappings.find((branchLabelMapping) => sourceCommit.committedDate > branchLabelMapping.committedDate);
|
|
119
|
-
return (match?.branchLabelMapping ??
|
|
120
|
-
historicalBranchLabelMappings[0].branchLabelMapping);
|
|
121
|
-
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
${remoteConfig_1.RemoteConfigHistoryFragment}
|
|
123
|
+
`;
|
|
@@ -76,7 +76,6 @@ describe('parseSourceCommit', () => {
|
|
|
76
76
|
'^v6.4.0$': 'main',
|
|
77
77
|
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
78
78
|
},
|
|
79
|
-
historicalBranchLabelMappings: [],
|
|
80
79
|
},
|
|
81
80
|
});
|
|
82
81
|
expect(commit.expectedTargetPullRequests).toEqual([
|
|
@@ -105,6 +104,13 @@ describe('parseSourceCommit', () => {
|
|
|
105
104
|
it('uses the historical branchLabelMapping from 2021-02-02', () => {
|
|
106
105
|
const mockSourceCommit = (0, getMockSourceCommit_1.getMockSourceCommit)({
|
|
107
106
|
sourceCommit: {
|
|
107
|
+
remoteConfig: {
|
|
108
|
+
branchLabelMapping: {
|
|
109
|
+
'^v6.3.0$': 'main',
|
|
110
|
+
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
111
|
+
},
|
|
112
|
+
committedDate: '2021-02-02T00:00:00Z',
|
|
113
|
+
},
|
|
108
114
|
message: 'My commit message (#66)',
|
|
109
115
|
commitedDate: '2021-03-03T00:00:00Z',
|
|
110
116
|
},
|
|
@@ -129,22 +135,6 @@ describe('parseSourceCommit', () => {
|
|
|
129
135
|
'^v6.4.0$': 'main',
|
|
130
136
|
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
131
137
|
},
|
|
132
|
-
historicalBranchLabelMappings: [
|
|
133
|
-
{
|
|
134
|
-
branchLabelMapping: {
|
|
135
|
-
'^v6.4.0$': 'main',
|
|
136
|
-
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
137
|
-
},
|
|
138
|
-
committedDate: '2021-04-04T00:00:00Z',
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
branchLabelMapping: {
|
|
142
|
-
'^v6.3.0$': 'main',
|
|
143
|
-
'^v(\\d+).(\\d+).\\d+$': '$1.$2',
|
|
144
|
-
},
|
|
145
|
-
committedDate: '2021-02-02T00:00:00Z',
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
138
|
},
|
|
149
139
|
});
|
|
150
140
|
expect(commit.expectedTargetPullRequests).toEqual([
|
|
@@ -78,7 +78,7 @@ describe('backport e2e', () => {
|
|
|
78
78
|
This will backport the following commits from \`master\` to \`7.x\`:
|
|
79
79
|
- Add ❤️ emoji (5bf29b7d)
|
|
80
80
|
|
|
81
|
-
<!--- Backport version: 1.2.3 -->
|
|
81
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
82
82
|
|
|
83
83
|
### Questions ?
|
|
84
84
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
@@ -150,7 +150,7 @@ describe('backport e2e', () => {
|
|
|
150
150
|
- Add ❤️ emoji (5bf29b7d)
|
|
151
151
|
- Add family emoji (#2) (59d6ff1c)
|
|
152
152
|
|
|
153
|
-
<!--- Backport version: 1.2.3 -->
|
|
153
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
154
154
|
|
|
155
155
|
### Questions ?
|
|
156
156
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
@@ -225,7 +225,7 @@ describe('backport e2e', () => {
|
|
|
225
225
|
This will backport the following commits from \`master\` to \`7.x\`:
|
|
226
226
|
- Add ❤️ emoji (5bf29b7d)
|
|
227
227
|
|
|
228
|
-
<!--- Backport version: 1.2.3 -->
|
|
228
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
229
229
|
|
|
230
230
|
### Questions ?
|
|
231
231
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
package/dist/test/nockHelpers.js
CHANGED
|
@@ -6,18 +6,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.listenForCallsToNockScope = exports.mockGqlRequest = void 0;
|
|
7
7
|
const url_1 = require("url");
|
|
8
8
|
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
9
|
+
const graphql_tag_2 = require("graphql-tag");
|
|
9
10
|
const nock_1 = __importDefault(require("nock"));
|
|
11
|
+
(0, graphql_tag_2.disableFragmentWarnings)();
|
|
10
12
|
function mockGqlRequest({ name, statusCode, body, headers, apiBaseUrl, }) {
|
|
11
13
|
const { origin, pathname } = new url_1.URL(
|
|
12
14
|
// default to localhost as host to avoid CORS issues
|
|
13
15
|
apiBaseUrl ?? 'http://localhost/graphql');
|
|
14
16
|
const scope = (0, nock_1.default)(origin)
|
|
15
|
-
.post(pathname, (body) =>
|
|
17
|
+
.post(pathname, (body) => {
|
|
18
|
+
return getQueryNameFromString(body.query) === name;
|
|
19
|
+
})
|
|
16
20
|
.reply(statusCode, body, headers);
|
|
17
21
|
return listenForCallsToNockScope(scope);
|
|
18
22
|
}
|
|
19
23
|
exports.mockGqlRequest = mockGqlRequest;
|
|
20
|
-
function
|
|
24
|
+
function getQueryNameFromString(query) {
|
|
21
25
|
const obj = (0, graphql_tag_1.default)(query);
|
|
22
26
|
// @ts-expect-error
|
|
23
27
|
return obj.definitions[0].name.value;
|
|
@@ -31,7 +31,11 @@ jest.mock('find-up', () => {
|
|
|
31
31
|
});
|
|
32
32
|
// @ts-expect-error
|
|
33
33
|
// eslint-disable-next-line no-import-assign
|
|
34
|
-
packageVersionModule.
|
|
34
|
+
packageVersionModule.UNMOCKED_PACKAGE_VERSION =
|
|
35
|
+
packageVersionModule.PACKAGE_VERSION;
|
|
36
|
+
// @ts-expect-error
|
|
37
|
+
// eslint-disable-next-line no-import-assign
|
|
38
|
+
packageVersionModule.PACKAGE_VERSION = '1.2.3-mocked';
|
|
35
39
|
jest.mock('make-dir', () => {
|
|
36
40
|
return jest.fn(() => Promise.resolve('/some/path'));
|
|
37
41
|
});
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.cherrypickAndCreateTargetPullRequest = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const lodash_1 = require("lodash");
|
|
9
|
-
const ora = require("ora");
|
|
10
9
|
const HandledError_1 = require("../services/HandledError");
|
|
11
10
|
const child_process_promisified_1 = require("../services/child-process-promisified");
|
|
12
11
|
const env_1 = require("../services/env");
|
|
@@ -21,6 +20,7 @@ const logger_1 = require("../services/logger");
|
|
|
21
20
|
const prompts_1 = require("../services/prompts");
|
|
22
21
|
const sequentially_1 = require("../services/sequentially");
|
|
23
22
|
const getCommitsWithoutBackports_1 = require("./getCommitsWithoutBackports");
|
|
23
|
+
const ora_1 = require("./ora");
|
|
24
24
|
async function cherrypickAndCreateTargetPullRequest({ options, commits, targetBranch, }) {
|
|
25
25
|
const backportBranch = getBackportBranchName(targetBranch, commits);
|
|
26
26
|
const repoForkOwner = (0, git_1.getRepoForkOwner)(options);
|
|
@@ -103,7 +103,7 @@ function getBackportBranchName(targetBranch, commits) {
|
|
|
103
103
|
async function waitForCherrypick(options, commit, targetBranch) {
|
|
104
104
|
const spinnerText = `Cherry-picking: ${chalk_1.default.greenBright((0, commitFormatters_1.getFirstLine)(commit.sourceCommit.message))}`;
|
|
105
105
|
const mergedTargetPullRequest = commit.expectedTargetPullRequests.find((pr) => pr.state === 'MERGED' && pr.branch === targetBranch);
|
|
106
|
-
const cherrypickSpinner = ora(spinnerText).start();
|
|
106
|
+
const cherrypickSpinner = (0, ora_1.ora)(options.ci, spinnerText).start();
|
|
107
107
|
let conflictingFiles;
|
|
108
108
|
let unstagedFiles;
|
|
109
109
|
let needsResolving;
|
|
@@ -124,7 +124,7 @@ async function waitForCherrypick(options, commit, targetBranch) {
|
|
|
124
124
|
}
|
|
125
125
|
// resolve conflicts automatically
|
|
126
126
|
if (options.autoFixConflicts) {
|
|
127
|
-
const autoResolveSpinner = ora('Attempting to resolve conflicts automatically').start();
|
|
127
|
+
const autoResolveSpinner = (0, ora_1.ora)(options.ci, 'Attempting to resolve conflicts automatically').start();
|
|
128
128
|
const repoPath = (0, env_1.getRepoPath)(options);
|
|
129
129
|
const didAutoFix = await options.autoFixConflicts({
|
|
130
130
|
files: conflictingFiles.map((f) => f.absolute),
|
|
@@ -171,7 +171,7 @@ async function waitForCherrypick(options, commit, targetBranch) {
|
|
|
171
171
|
unstagedFiles,
|
|
172
172
|
});
|
|
173
173
|
// Conflicts should be resolved and files staged at this point
|
|
174
|
-
const stagingSpinner = ora(`Finalizing cherrypick`).start();
|
|
174
|
+
const stagingSpinner = (0, ora_1.ora)(options.ci, `Finalizing cherrypick`).start();
|
|
175
175
|
try {
|
|
176
176
|
// Run `git commit`
|
|
177
177
|
await (0, git_1.commitChanges)(commit, options);
|
|
@@ -131,7 +131,7 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
131
131
|
- [My original commit message (#1000)](foo)
|
|
132
132
|
- [My other commit message (#2000)](foo)
|
|
133
133
|
|
|
134
|
-
<!--- Backport version: 1.2.3 -->
|
|
134
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
135
135
|
|
|
136
136
|
### Questions ?
|
|
137
137
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
@@ -219,7 +219,7 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
219
219
|
This will backport the following commits from \`7.x\` to \`6.x\`:
|
|
220
220
|
- My original commit message (mySha)
|
|
221
221
|
|
|
222
|
-
<!--- Backport version: 1.2.3 -->
|
|
222
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
223
223
|
|
|
224
224
|
### Questions ?
|
|
225
225
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
|
@@ -295,7 +295,7 @@ describe('cherrypickAndCreateTargetPullRequest', () => {
|
|
|
295
295
|
This will backport the following commits from \`7.x\` to \`6.x\`:
|
|
296
296
|
- My original commit message (mySha)
|
|
297
297
|
|
|
298
|
-
<!--- Backport version: 1.2.3 -->
|
|
298
|
+
<!--- Backport version: 1.2.3-mocked -->
|
|
299
299
|
|
|
300
300
|
### Questions ?
|
|
301
301
|
Please refer to the [Backport tool documentation](https://github.com/sqren/backport)",
|
package/dist/ui/getCommits.js
CHANGED
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getCommits = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const ora_1 = __importDefault(require("ora"));
|
|
9
8
|
const HandledError_1 = require("../services/HandledError");
|
|
10
9
|
const commitFormatters_1 = require("../services/github/commitFormatters");
|
|
11
10
|
const fetchCommitByPullNumber_1 = require("../services/github/v4/fetchCommits/fetchCommitByPullNumber");
|
|
@@ -13,6 +12,7 @@ const fetchCommitBySha_1 = require("../services/github/v4/fetchCommits/fetchComm
|
|
|
13
12
|
const fetchCommitsByAuthor_1 = require("../services/github/v4/fetchCommits/fetchCommitsByAuthor");
|
|
14
13
|
const fetchPullRequestBySearchQuery_1 = require("../services/github/v4/fetchCommits/fetchPullRequestBySearchQuery");
|
|
15
14
|
const prompts_1 = require("../services/prompts");
|
|
15
|
+
const ora_1 = require("./ora");
|
|
16
16
|
function getOraPersistsOption(question, answer) {
|
|
17
17
|
return {
|
|
18
18
|
symbol: chalk_1.default.green('?'),
|
|
@@ -20,7 +20,7 @@ function getOraPersistsOption(question, answer) {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
async function getCommits(options) {
|
|
23
|
-
const spinner = (0, ora_1.
|
|
23
|
+
const spinner = (0, ora_1.ora)(options.ci).start();
|
|
24
24
|
try {
|
|
25
25
|
if (options.sha) {
|
|
26
26
|
spinner.text = `Loading commit "${(0, commitFormatters_1.getShortSha)(options.sha)}"`;
|
package/dist/ui/ora.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import oraOriginal from 'ora';
|
|
2
|
+
export declare function ora(ci: boolean | undefined, options?: string | oraOriginal.Options | undefined): oraOriginal.Ora | {
|
|
3
|
+
start: (text?: string | undefined) => any;
|
|
4
|
+
succeed: () => void;
|
|
5
|
+
stop: () => void;
|
|
6
|
+
fail: () => void;
|
|
7
|
+
stopAndPersist: () => void;
|
|
8
|
+
text: string;
|
|
9
|
+
};
|
package/dist/ui/ora.js
ADDED
|
@@ -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.ora = void 0;
|
|
7
|
+
const ora_1 = __importDefault(require("ora"));
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
9
|
+
const oraMock = {
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
|
+
start: (text) => oraMock,
|
|
12
|
+
succeed: () => { },
|
|
13
|
+
stop: () => { },
|
|
14
|
+
fail: () => { },
|
|
15
|
+
stopAndPersist: () => { },
|
|
16
|
+
set text(value) { },
|
|
17
|
+
};
|
|
18
|
+
function ora(ci, options) {
|
|
19
|
+
return ci ? oraMock : (0, ora_1.default)(options);
|
|
20
|
+
}
|
|
21
|
+
exports.ora = ora;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "7.
|
|
1
|
+
export declare const PACKAGE_VERSION = "7.1.0";
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"branches",
|
|
15
15
|
"branching"
|
|
16
16
|
],
|
|
17
|
-
"version": "7.
|
|
17
|
+
"version": "7.1.0",
|
|
18
18
|
"main": "./dist/entrypoint.module.js",
|
|
19
19
|
"types": "dist/entrypoint.module.d.ts",
|
|
20
20
|
"bin": {
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"del": "^6.0.0",
|
|
69
69
|
"dotenv": "^16.0.0",
|
|
70
70
|
"find-up": "^5.0.0",
|
|
71
|
+
"graphql": "^16.3.0",
|
|
71
72
|
"graphql-tag": "^2.12.6",
|
|
72
73
|
"inquirer": "^8.2.0",
|
|
73
74
|
"lodash": "^4.17.21",
|
|
@@ -98,7 +99,6 @@
|
|
|
98
99
|
"eslint-plugin-import": "^2.25.4",
|
|
99
100
|
"eslint-plugin-jest": "^26.1.0",
|
|
100
101
|
"eslint-plugin-prettier": "^4.0.0",
|
|
101
|
-
"graphql": "^16.3.0",
|
|
102
102
|
"graphql-config": "^4.1.0",
|
|
103
103
|
"husky": "^7.0.4",
|
|
104
104
|
"jest": "^27.5.1",
|