backport 7.0.1-beta.2 → 7.2.0-beta.2

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.
Files changed (163) hide show
  1. package/dist/backportRun.d.ts +1 -0
  2. package/dist/backportRun.js +3 -2
  3. package/dist/entrypoint.cli.js +12 -1
  4. package/dist/entrypoint.module.d.ts +4 -3
  5. package/dist/entrypoint.module.js +2 -7
  6. package/dist/options/ConfigOptions.d.ts +1 -1
  7. package/dist/options/cliArgs.d.ts +2 -1
  8. package/dist/options/cliArgs.js +4 -0
  9. package/dist/options/config/config.d.ts +1 -1
  10. package/dist/options/config/readConfigFile.d.ts +2 -2
  11. package/dist/options/options.d.ts +3 -6
  12. package/dist/runSequentially.js +1 -0
  13. package/dist/services/HandledError.js +3 -1
  14. package/dist/services/git.d.ts +2 -0
  15. package/dist/services/git.js +47 -10
  16. package/dist/services/github/v3/addAssigneesToPullRequest.d.ts +1 -1
  17. package/dist/services/github/v3/addAssigneesToPullRequest.js +3 -6
  18. package/dist/services/github/v3/addLabelsToPullRequest.d.ts +1 -1
  19. package/dist/services/github/v3/addLabelsToPullRequest.js +3 -6
  20. package/dist/services/github/v3/addReviewersToPullRequest.d.ts +1 -1
  21. package/dist/services/github/v3/addReviewersToPullRequest.js +3 -6
  22. package/dist/services/github/v3/createPullRequest.js +2 -5
  23. package/dist/services/github/v3/createStatusComment.js +1 -1
  24. package/dist/services/github/v4/FetchPullRequestId.js +5 -1
  25. package/dist/services/github/v4/apiRequestV4.d.ts +7 -4
  26. package/dist/services/github/v4/apiRequestV4.js +22 -21
  27. package/dist/services/github/v4/disablePullRequestAutoMerge.js +5 -1
  28. package/dist/services/github/v4/enablePullRequestAutoMerge.js +4 -3
  29. package/dist/services/github/v4/fetchAuthorId.js +5 -1
  30. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +0 -1
  31. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +24 -13
  32. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.d.ts +0 -1
  33. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +24 -13
  34. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +0 -1
  35. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +20 -10
  36. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +20 -9
  37. package/dist/services/github/v4/fetchExistingPullRequest.js +5 -1
  38. package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.js +5 -1
  39. package/dist/services/github/v4/fetchRemoteProjectConfig.d.ts +1 -1
  40. package/dist/services/github/v4/fetchRemoteProjectConfig.js +13 -20
  41. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +1 -5
  42. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +12 -66
  43. package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +3 -16
  44. package/dist/services/github/v4/getOptionsFromGithub/query.js +9 -19
  45. package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.js +5 -1
  46. package/dist/services/github/v4/throwOnInvalidAccessToken.js +6 -6
  47. package/dist/services/logger.d.ts +5 -5
  48. package/dist/services/logger.js +24 -23
  49. package/dist/services/remoteConfig.d.ts +20 -0
  50. package/dist/services/remoteConfig.js +52 -0
  51. package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +4 -1
  52. package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +5 -1
  53. package/dist/services/sourceCommit/getMockSourceCommit.d.ts +4 -0
  54. package/dist/services/sourceCommit/getMockSourceCommit.js +21 -6
  55. package/dist/services/sourceCommit/parseSourceCommit.d.ts +3 -4
  56. package/dist/services/sourceCommit/parseSourceCommit.js +73 -77
  57. package/dist/ui/cherrypickAndCreateTargetPullRequest.js +16 -22
  58. package/dist/ui/getCommits.js +8 -6
  59. package/dist/ui/maybeSetupRepo.js +7 -14
  60. package/dist/ui/ora.d.ts +9 -0
  61. package/dist/ui/ora.js +21 -0
  62. package/dist/utils/packageVersion.d.ts +1 -1
  63. package/dist/utils/packageVersion.js +1 -1
  64. package/package.json +10 -10
  65. package/yarn.lock +121 -114
  66. package/dist/entrypoint.cli.e2e.private.test.d.ts +0 -1
  67. package/dist/entrypoint.cli.e2e.private.test.js +0 -319
  68. package/dist/entrypoint.cli.private.test.d.ts +0 -1
  69. package/dist/entrypoint.cli.private.test.js +0 -46
  70. package/dist/options/cliArgs.test.d.ts +0 -1
  71. package/dist/options/cliArgs.test.js +0 -182
  72. package/dist/options/config/config.test.d.ts +0 -1
  73. package/dist/options/config/config.test.js +0 -32
  74. package/dist/options/config/globalConfig.test.d.ts +0 -1
  75. package/dist/options/config/globalConfig.test.js +0 -61
  76. package/dist/options/config/projectConfig.test.d.ts +0 -1
  77. package/dist/options/config/projectConfig.test.js +0 -109
  78. package/dist/options/options.test.d.ts +0 -1
  79. package/dist/options/options.test.js +0 -386
  80. package/dist/runSequentially.test.d.ts +0 -1
  81. package/dist/runSequentially.test.js +0 -218
  82. package/dist/scripts/postinstall.test.d.ts +0 -1
  83. package/dist/scripts/postinstall.test.js +0 -53
  84. package/dist/services/env.test.d.ts +0 -1
  85. package/dist/services/env.test.js +0 -21
  86. package/dist/services/git.integration.test.d.ts +0 -1
  87. package/dist/services/git.integration.test.js +0 -267
  88. package/dist/services/git.test.d.ts +0 -1
  89. package/dist/services/git.test.js +0 -518
  90. package/dist/services/github/commitFormatters.test.d.ts +0 -1
  91. package/dist/services/github/commitFormatters.test.js +0 -11
  92. package/dist/services/github/v3/addAssigneesToPullRequest.test.d.ts +0 -1
  93. package/dist/services/github/v3/addAssigneesToPullRequest.test.js +0 -27
  94. package/dist/services/github/v3/createPullRequest.test.d.ts +0 -1
  95. package/dist/services/github/v3/createPullRequest.test.js +0 -325
  96. package/dist/services/github/v3/createStatusComment.test.d.ts +0 -1
  97. package/dist/services/github/v3/createStatusComment.test.js +0 -386
  98. package/dist/services/github/v3/index.d.ts +0 -1
  99. package/dist/services/github/v3/index.js +0 -61
  100. package/dist/services/github/v4/apiRequestV4.test.d.ts +0 -1
  101. package/dist/services/github/v4/apiRequestV4.test.js +0 -82
  102. package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.d.ts +0 -1
  103. package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +0 -112
  104. package/dist/services/github/v4/fetchAuthorId.private.test.d.ts +0 -1
  105. package/dist/services/github/v4/fetchAuthorId.private.test.js +0 -28
  106. package/dist/services/github/v4/fetchCommits/allFetchers.private.test.d.ts +0 -1
  107. package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +0 -96
  108. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +0 -1
  109. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +0 -143
  110. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +0 -1
  111. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +0 -124
  112. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +0 -1
  113. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +0 -200
  114. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +0 -1
  115. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +0 -153
  116. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +0 -1
  117. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +0 -102
  118. package/dist/services/github/v4/fetchExistingPullRequest.private.test.d.ts +0 -1
  119. package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +0 -47
  120. package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.d.ts +0 -1
  121. package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +0 -52
  122. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +0 -1
  123. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +0 -136
  124. package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.d.ts +0 -1
  125. package/dist/services/github/v4/getRepoOwnerAndNameFromGitRemotes.private.test.js +0 -71
  126. package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +0 -2
  127. package/dist/services/github/v4/mocks/commitsByAuthorMock.js +0 -154
  128. package/dist/services/github/v4/throwOnInvalidAccessToken.test.d.ts +0 -1
  129. package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +0 -87
  130. package/dist/services/prompt.test.d.ts +0 -1
  131. package/dist/services/prompt.test.js +0 -134
  132. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +0 -1
  133. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +0 -433
  134. package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +0 -1
  135. package/dist/services/sourceCommit/parseSourceCommit.test.js +0 -235
  136. package/dist/test/ExecError.d.ts +0 -16
  137. package/dist/test/ExecError.js +0 -15
  138. package/dist/test/backport-e2e.mutation.test.d.ts +0 -1
  139. package/dist/test/backport-e2e.mutation.test.js +0 -347
  140. package/dist/test/handleUnbackportedPullRequests.private.test.d.ts +0 -1
  141. package/dist/test/handleUnbackportedPullRequests.private.test.js +0 -57
  142. package/dist/test/mockConfigFiles.d.ts +0 -5
  143. package/dist/test/mockConfigFiles.js +0 -21
  144. package/dist/test/mocks.d.ts +0 -10
  145. package/dist/test/mocks.js +0 -23
  146. package/dist/test/nockHelpers.d.ts +0 -16
  147. package/dist/test/nockHelpers.js +0 -32
  148. package/dist/test/private/getDevAccessToken.d.ts +0 -2
  149. package/dist/test/private/getDevAccessToken.js +0 -12
  150. package/dist/test/sandbox.d.ts +0 -5
  151. package/dist/test/sandbox.js +0 -43
  152. package/dist/test/setupFiles/automatic-mocks.d.ts +0 -1
  153. package/dist/test/setupFiles/automatic-mocks.js +0 -63
  154. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +0 -1
  155. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +0 -455
  156. package/dist/ui/getCommitsWithoutBackports.test.d.ts +0 -1
  157. package/dist/ui/getCommitsWithoutBackports.test.js +0 -311
  158. package/dist/ui/getTargetBranches.test.d.ts +0 -1
  159. package/dist/ui/getTargetBranches.test.js +0 -198
  160. package/dist/ui/maybeSetupRepo.test.d.ts +0 -1
  161. package/dist/ui/maybeSetupRepo.test.js +0 -204
  162. package/dist/utils/excludeUndefined.test.d.ts +0 -1
  163. package/dist/utils/excludeUndefined.test.js +0 -24
@@ -1,325 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const createPullRequest_1 = require("./createPullRequest");
4
- describe('getPullRequestBody', () => {
5
- it('when single pull request is backported', () => {
6
- expect((0, createPullRequest_1.getPullRequestBody)({
7
- options: {},
8
- commits: [
9
- {
10
- sourcePullRequest: {
11
- number: 55,
12
- url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
13
- mergeCommit: {
14
- sha: 'abcdefghi',
15
- message: 'My commit message (#55)',
16
- },
17
- },
18
- sourceCommit: {
19
- committedDate: '2020',
20
- sha: 'abcdefghi',
21
- message: 'My commit message (#55)',
22
- },
23
- expectedTargetPullRequests: [],
24
- sourceBranch: 'master',
25
- },
26
- ],
27
- targetBranch: '7.x',
28
- })).toMatchInlineSnapshot(`
29
- "# Backport
30
-
31
- This will backport the following commits from \`master\` to \`7.x\`:
32
- - [My commit message (#55)](https://github.com/backport-org/different-merge-strategies/pull/55)
33
-
34
- <!--- Backport version: 1.2.3-mocked -->
35
-
36
- ### Questions ?
37
- Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
38
- `);
39
- });
40
- it('when a single commit (non pull request) is backported', () => {
41
- expect((0, createPullRequest_1.getPullRequestBody)({
42
- options: {},
43
- commits: [
44
- {
45
- sourceCommit: {
46
- committedDate: '',
47
- sha: 'abcdefghijklmw',
48
- message: 'My commit message',
49
- },
50
- sourceBranch: 'main',
51
- expectedTargetPullRequests: [],
52
- },
53
- ],
54
- targetBranch: '7.x',
55
- })).toMatchInlineSnapshot(`
56
- "# Backport
57
-
58
- This will backport the following commits from \`main\` to \`7.x\`:
59
- - My commit message (abcdefgh)
60
-
61
- <!--- Backport version: 1.2.3-mocked -->
62
-
63
- ### Questions ?
64
- Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
65
- `);
66
- });
67
- it('when multiple commits are backported', () => {
68
- expect((0, createPullRequest_1.getPullRequestBody)({
69
- options: {},
70
- commits: [
71
- {
72
- sourcePullRequest: {
73
- number: 55,
74
- url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
75
- mergeCommit: {
76
- sha: 'abcdefghijklm',
77
- message: 'My commit message (#55)',
78
- },
79
- },
80
- sourceCommit: {
81
- committedDate: '',
82
- sha: 'abcdefghijklm',
83
- message: 'My commit message (#55)',
84
- },
85
- sourceBranch: 'main',
86
- expectedTargetPullRequests: [],
87
- },
88
- {
89
- sourceCommit: {
90
- committedDate: '',
91
- sha: 'qwertyuiop',
92
- message: 'Another commit message',
93
- },
94
- sourceBranch: 'main',
95
- expectedTargetPullRequests: [],
96
- },
97
- ],
98
- targetBranch: '7.x',
99
- })).toMatchInlineSnapshot(`
100
- "# Backport
101
-
102
- This will backport the following commits from \`main\` to \`7.x\`:
103
- - [My commit message (#55)](https://github.com/backport-org/different-merge-strategies/pull/55)
104
- - Another commit message (qwertyui)
105
-
106
- <!--- Backport version: 1.2.3-mocked -->
107
-
108
- ### Questions ?
109
- Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
110
- `);
111
- });
112
- it('when a PR is merged (instead of squashed) and the individual commits are selected', () => {
113
- expect((0, createPullRequest_1.getPullRequestBody)({
114
- options: {},
115
- commits: [
116
- {
117
- sourceCommit: {
118
- committedDate: '2022-02-07T23:53:14Z',
119
- message: 'Merge strategy: Second commit',
120
- sha: 'e8df5eaa4db7b94474b48e2320b02d33a830d9fb',
121
- },
122
- sourcePullRequest: {
123
- number: 1,
124
- url: 'https://github.com/backport-org/different-merge-strategies/pull/1',
125
- mergeCommit: {
126
- message: 'Merge pull request #1 from backport-org/merge-strategy\n\nMerge commits to `main`',
127
- sha: '0db7f1ac1233461563d8708511d1c14adbab46da',
128
- },
129
- },
130
- sourceBranch: 'main',
131
- expectedTargetPullRequests: [],
132
- },
133
- {
134
- sourceCommit: {
135
- committedDate: '2022-02-07T23:51:59Z',
136
- message: 'Merge strategy: First commit',
137
- sha: '5411b1c1144093e422220008f23f2c2b909ed113',
138
- },
139
- sourcePullRequest: {
140
- number: 1,
141
- url: 'https://github.com/backport-org/different-merge-strategies/pull/1',
142
- mergeCommit: {
143
- message: 'Merge pull request #1 from backport-org/merge-strategy\n\nMerge commits to `main`',
144
- sha: '0db7f1ac1233461563d8708511d1c14adbab46da',
145
- },
146
- },
147
- sourceBranch: 'main',
148
- expectedTargetPullRequests: [],
149
- },
150
- ],
151
- targetBranch: '7.x',
152
- })).toMatchInlineSnapshot(`
153
- "# Backport
154
-
155
- This will backport the following commits from \`main\` to \`7.x\`:
156
- - [Merge strategy: Second commit](https://github.com/backport-org/different-merge-strategies/pull/1)
157
- - [Merge strategy: First commit](https://github.com/backport-org/different-merge-strategies/pull/1)
158
-
159
- <!--- Backport version: 1.2.3-mocked -->
160
-
161
- ### Questions ?
162
- Please refer to the [Backport tool documentation](https://github.com/sqren/backport)"
163
- `);
164
- });
165
- it('replaces template variables in PR description', () => {
166
- expect((0, createPullRequest_1.getPullRequestBody)({
167
- options: {
168
- prDescription: 'Backporting the following to {targetBranch}:\n{commitMessages}',
169
- },
170
- commits: [
171
- {
172
- sourcePullRequest: {
173
- number: 55,
174
- url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
175
- mergeCommit: {
176
- sha: 'abcdefghijklm',
177
- message: 'My commit message (#55)',
178
- },
179
- },
180
- sourceCommit: {
181
- committedDate: '',
182
- sha: 'abcdefghijklm',
183
- message: 'My commit message (#55)',
184
- },
185
- sourceBranch: 'main',
186
- expectedTargetPullRequests: [],
187
- },
188
- {
189
- sourceCommit: {
190
- committedDate: '',
191
- sha: 'qwertyuiop',
192
- message: 'Another commit message',
193
- },
194
- sourceBranch: 'main',
195
- expectedTargetPullRequests: [],
196
- },
197
- ],
198
- targetBranch: '7.x',
199
- })).toMatchInlineSnapshot(`
200
- "Backporting the following to 7.x:
201
- - [My commit message (#55)](https://github.com/backport-org/different-merge-strategies/pull/55)
202
- - Another commit message (qwertyui)"
203
- `);
204
- });
205
- it('appends text to the default descriptions', () => {
206
- expect((0, createPullRequest_1.getPullRequestBody)({
207
- options: {
208
- prDescription: '{defaultPrDescription}\n\ntext to append',
209
- },
210
- commits: [
211
- {
212
- sourcePullRequest: {
213
- number: 55,
214
- url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
215
- mergeCommit: {
216
- sha: 'abcdefghijklm',
217
- message: 'My commit message (#55)',
218
- },
219
- },
220
- sourceCommit: {
221
- committedDate: '',
222
- sha: 'abcdefghijklm',
223
- message: 'My commit message (#55)',
224
- },
225
- sourceBranch: 'main',
226
- expectedTargetPullRequests: [],
227
- },
228
- {
229
- sourceCommit: {
230
- committedDate: '',
231
- sha: 'qwertyuiop',
232
- message: 'Another commit message',
233
- },
234
- sourceBranch: 'main',
235
- expectedTargetPullRequests: [],
236
- },
237
- ],
238
- targetBranch: '7.x',
239
- })).toMatchInlineSnapshot(`
240
- "# Backport
241
-
242
- This will backport the following commits from \`main\` to \`7.x\`:
243
- - [My commit message (#55)](https://github.com/backport-org/different-merge-strategies/pull/55)
244
- - Another commit message (qwertyui)
245
-
246
- <!--- Backport version: 1.2.3-mocked -->
247
-
248
- ### Questions ?
249
- Please refer to the [Backport tool documentation](https://github.com/sqren/backport)
250
-
251
- text to append"
252
- `);
253
- });
254
- });
255
- describe('getTitle', () => {
256
- it('has the default title', () => {
257
- expect((0, createPullRequest_1.getTitle)({
258
- options: {},
259
- commits: [
260
- {
261
- sourceBranch: 'main',
262
- sourcePullRequest: {
263
- number: 55,
264
- url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
265
- mergeCommit: {
266
- sha: 'abcdefghi',
267
- message: 'My commit message (#55)',
268
- },
269
- },
270
- sourceCommit: {
271
- committedDate: '2020',
272
- sha: 'abcdefghi',
273
- message: 'My commit message (#55)',
274
- },
275
- expectedTargetPullRequests: [],
276
- },
277
- {
278
- sourcePullRequest: {
279
- number: 56,
280
- url: 'https://github.com/backport-org/different-merge-strategies/pull/56',
281
- mergeCommit: {
282
- sha: 'jklmnopqr',
283
- message: 'Another commit message (#56)',
284
- },
285
- },
286
- sourceCommit: {
287
- committedDate: '2020',
288
- sha: 'jklmnopqr',
289
- message: 'Another commit message (#56)',
290
- },
291
- sourceBranch: 'main',
292
- expectedTargetPullRequests: [],
293
- },
294
- ],
295
- targetBranch: '7.x',
296
- })).toEqual('[7.x] My commit message (#55) | Another commit message (#56)');
297
- });
298
- it('replaces template variables in PR title', () => {
299
- expect((0, createPullRequest_1.getTitle)({
300
- options: {
301
- prTitle: 'Branch: "{targetBranch}". Messages: {commitMessages}',
302
- },
303
- commits: [
304
- {
305
- sourcePullRequest: {
306
- number: 55,
307
- url: 'https://github.com/backport-org/different-merge-strategies/pull/55',
308
- mergeCommit: {
309
- sha: 'abcdefghi',
310
- message: 'My commit message (#55)',
311
- },
312
- },
313
- sourceCommit: {
314
- committedDate: '',
315
- sha: 'abcdefghi',
316
- message: 'My commit message (#55)',
317
- },
318
- sourceBranch: 'main',
319
- expectedTargetPullRequests: [],
320
- },
321
- ],
322
- targetBranch: '7.x',
323
- })).toEqual('Branch: "7.x". Messages: My commit message (#55)');
324
- });
325
- });
@@ -1 +0,0 @@
1
- export {};