backport 5.6.4 → 6.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.
Files changed (253) hide show
  1. package/README.md +166 -41
  2. package/dist/entrypoint.cli.js +3 -1
  3. package/dist/entrypoint.module.d.ts +18 -5
  4. package/dist/entrypoint.module.js +42 -12
  5. package/dist/entrypoint.module.private.test.d.ts +1 -0
  6. package/dist/entrypoint.module.private.test.js +33 -0
  7. package/dist/ink.d.ts +1 -0
  8. package/dist/ink.js +49 -0
  9. package/dist/main.d.ts +11 -6
  10. package/dist/main.js +40 -25
  11. package/dist/options/ConfigOptions.d.ts +56 -39
  12. package/dist/options/cliArgs.d.ts +38 -45
  13. package/dist/options/cliArgs.js +123 -104
  14. package/dist/options/cliArgs.test.js +106 -119
  15. package/dist/options/config/config.d.ts +56 -2
  16. package/dist/options/config/config.js +12 -6
  17. package/dist/options/config/config.test.js +11 -6
  18. package/dist/options/config/getOptionsFromGit.d.ts +4 -0
  19. package/dist/options/config/getOptionsFromGit.js +8 -0
  20. package/dist/options/config/globalConfig.d.ts +2 -1
  21. package/dist/options/config/globalConfig.js +9 -12
  22. package/dist/options/config/globalConfig.test.js +7 -5
  23. package/dist/options/config/projectConfig.d.ts +2 -1
  24. package/dist/options/config/projectConfig.js +3 -3
  25. package/dist/options/config/projectConfig.test.js +54 -17
  26. package/dist/options/config/readConfigFile.d.ts +53 -2
  27. package/dist/options/config/readConfigFile.js +31 -5
  28. package/dist/options/options.d.ts +67 -35
  29. package/dist/options/options.js +99 -16
  30. package/dist/options/options.test.js +214 -67
  31. package/dist/options/parseRequiredOptions.d.ts +71 -0
  32. package/dist/options/parseRequiredOptions.js +68 -0
  33. package/dist/options/parseRequiredOptions.test.d.ts +1 -0
  34. package/dist/options/parseRequiredOptions.test.js +122 -0
  35. package/dist/runSequentially.d.ts +20 -0
  36. package/dist/runSequentially.js +41 -0
  37. package/dist/runSequentially.test.d.ts +1 -0
  38. package/dist/runSequentially.test.js +192 -0
  39. package/dist/runWithOptions.js +7 -14
  40. package/dist/runWithOptions.test.js +142 -16
  41. package/dist/scripts/generate-gql.d.ts +1 -0
  42. package/dist/scripts/generate-gql.js +15 -0
  43. package/dist/scripts/postinstall.js +4 -4
  44. package/dist/scripts/postinstall.test.js +9 -2
  45. package/dist/scripts/runPostinstall.js +1 -1
  46. package/dist/services/HandledError.d.ts +11 -1
  47. package/dist/services/HandledError.js +2 -1
  48. package/dist/services/child-process-promisified.d.ts +1 -1
  49. package/dist/services/child-process-promisified.js +2 -2
  50. package/dist/services/env.js +5 -5
  51. package/dist/services/env.test.js +11 -4
  52. package/dist/services/fs-promisified.js +4 -4
  53. package/dist/services/getExpectedTarget.d.ts +9 -0
  54. package/dist/services/getExpectedTarget.js +77 -0
  55. package/dist/services/getExpectedTargetPullRequests.d.ts +9 -0
  56. package/dist/services/getExpectedTargetPullRequests.js +77 -0
  57. package/dist/services/git.d.ts +23 -5
  58. package/dist/services/git.integration.test.d.ts +1 -0
  59. package/dist/services/git.integration.test.js +168 -0
  60. package/dist/services/git.js +133 -60
  61. package/dist/services/git.test.js +160 -53
  62. package/dist/services/github/commitFormatters.d.ts +3 -7
  63. package/dist/services/github/commitFormatters.js +10 -19
  64. package/dist/services/github/commitFormatters.test.js +2 -24
  65. package/dist/services/github/v3/addAssigneesToPullRequest.d.ts +1 -1
  66. package/dist/services/github/v3/addAssigneesToPullRequest.js +3 -8
  67. package/dist/services/github/v3/addAssigneesToPullRequest.test.js +6 -8
  68. package/dist/services/github/v3/addLabelsToPullRequest.d.ts +1 -1
  69. package/dist/services/github/v3/addLabelsToPullRequest.js +2 -6
  70. package/dist/services/github/v3/addReviewersToPullRequest.d.ts +2 -0
  71. package/dist/services/github/v3/addReviewersToPullRequest.js +34 -0
  72. package/dist/services/github/v3/createPullRequest.d.ts +3 -2
  73. package/dist/services/github/v3/createPullRequest.js +32 -26
  74. package/dist/services/github/v3/createPullRequest.test.d.ts +1 -0
  75. package/dist/services/github/v3/createPullRequest.test.js +78 -0
  76. package/dist/services/github/v3/createStatusComment.d.ts +11 -0
  77. package/dist/services/github/v3/createStatusComment.js +97 -0
  78. package/dist/services/github/v3/createStatusComment.test.d.ts +1 -0
  79. package/dist/services/github/v3/createStatusComment.test.js +209 -0
  80. package/dist/services/github/v4/FetchPullRequestId.d.ts +9 -0
  81. package/dist/services/github/v4/FetchPullRequestId.js +32 -0
  82. package/dist/services/github/v4/apiRequestV4.d.ts +2 -2
  83. package/dist/services/github/v4/apiRequestV4.js +9 -11
  84. package/dist/services/github/v4/apiRequestV4.test.js +7 -7
  85. package/dist/services/github/v4/disablePullRequestAutoMerge.d.ts +9 -0
  86. package/dist/services/github/v4/disablePullRequestAutoMerge.js +28 -0
  87. package/dist/services/github/v4/enablePullRequestAutoMerge.d.ts +9 -0
  88. package/dist/services/github/v4/enablePullRequestAutoMerge.js +51 -0
  89. package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.d.ts +1 -0
  90. package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +112 -0
  91. package/dist/services/github/v4/fetchAuthorId.d.ts +10 -2
  92. package/dist/services/github/v4/fetchAuthorId.js +6 -7
  93. package/dist/services/github/v4/fetchAuthorId.private.test.js +6 -9
  94. package/dist/services/github/v4/fetchCommitByPullNumber.js +11 -9
  95. package/dist/services/github/v4/fetchCommitByPullNumber.private.test.js +6 -6
  96. package/dist/services/github/v4/fetchCommitBySha.js +14 -12
  97. package/dist/services/github/v4/fetchCommitBySha.private.test.js +7 -5
  98. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +12 -0
  99. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +46 -0
  100. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +1 -0
  101. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +70 -0
  102. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.d.ts +12 -0
  103. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +36 -0
  104. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +1 -0
  105. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +55 -0
  106. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +27 -0
  107. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +88 -0
  108. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +1 -0
  109. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +128 -0
  110. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +1 -0
  111. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +125 -0
  112. package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.d.ts +28 -0
  113. package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.js +52 -0
  114. package/dist/services/github/v4/fetchCommits/fetchProjectConfig.d.ts +3 -0
  115. package/dist/services/github/v4/fetchCommits/fetchProjectConfig.js +55 -0
  116. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +10 -0
  117. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +49 -0
  118. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +1 -0
  119. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +77 -0
  120. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.d.ts +1 -0
  121. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.js +252 -0
  122. package/dist/services/github/v4/fetchCommitsByAuthor.d.ts +3 -2
  123. package/dist/services/github/v4/fetchCommitsByAuthor.js +81 -70
  124. package/dist/services/github/v4/fetchCommitsByAuthor.private.test.js +81 -8
  125. package/dist/services/github/v4/fetchCommitsByAuthor.test.js +29 -21
  126. package/dist/services/github/v4/fetchDefaultBranch.d.ts +1 -1
  127. package/dist/services/github/v4/fetchDefaultBranch.js +1 -1
  128. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.d.ts +4 -0
  129. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.js +52 -0
  130. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.d.ts +1 -0
  131. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/fetchDefaultRepoBranchAndPerformStartupChecks.private.test.js +32 -0
  132. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.d.ts +4 -0
  133. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.js +72 -0
  134. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.d.ts +1 -0
  135. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/index.private.test.js +34 -0
  136. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.d.ts +40 -0
  137. package/dist/services/github/v4/fetchDefaultRepoBranchAndPerformStartupChecks/query.js +72 -0
  138. package/dist/services/github/v4/fetchExistingPullRequest.js +2 -3
  139. package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +3 -5
  140. package/dist/services/github/v4/fetchMergedPullRequests.d.ts +19 -20
  141. package/dist/services/github/v4/fetchMergedPullRequests.js +22 -68
  142. package/dist/services/github/v4/fetchMergedPullRequests.private.test.js +8 -9
  143. package/dist/services/github/v4/fetchProjectConfig.d.ts +8 -0
  144. package/dist/services/github/v4/fetchProjectConfig.js +56 -0
  145. package/dist/services/github/v4/fetchProjectConfig.private.test.d.ts +1 -0
  146. package/dist/services/github/v4/fetchProjectConfig.private.test.js +52 -0
  147. package/dist/services/github/v4/fetchProjectConfig.test.d.ts +1 -0
  148. package/dist/services/github/v4/fetchProjectConfig.test.js +37 -0
  149. package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.d.ts +11 -0
  150. package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.js +35 -0
  151. package/dist/services/github/v4/fetchPullRequestBySearchQuery.d.ts +1 -1
  152. package/dist/services/github/v4/fetchPullRequestBySearchQuery.js +12 -10
  153. package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.js +8 -6
  154. package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.js +2 -2
  155. package/dist/services/github/v4/getExistingTargetPullRequests.d.ts +4 -58
  156. package/dist/services/github/v4/getExistingTargetPullRequests.js +3 -58
  157. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +66 -0
  158. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +130 -0
  159. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +1 -0
  160. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +130 -0
  161. package/dist/services/github/v4/getOptionsFromGithub/index.d.ts +63 -0
  162. package/dist/services/github/v4/getOptionsFromGithub/index.js +139 -0
  163. package/dist/services/github/v4/getOptionsFromGithub/index.private.test.d.ts +1 -0
  164. package/dist/services/github/v4/getOptionsFromGithub/index.private.test.js +147 -0
  165. package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +37 -0
  166. package/dist/services/github/v4/getOptionsFromGithub/query.js +47 -0
  167. package/dist/services/github/v4/getTargetBranchesFromLabels.d.ts +0 -7
  168. package/dist/services/github/v4/getTargetBranchesFromLabels.js +1 -26
  169. package/dist/services/github/v4/getTargetBranchesFromLabels.test.js +69 -32
  170. package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +2 -2
  171. package/dist/services/github/v4/mocks/commitsByAuthorMock.js +39 -25
  172. package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.d.ts +2 -2
  173. package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.js +10 -0
  174. package/dist/services/github/v4/mocks/getCommitsByAuthorMock.d.ts +2 -2
  175. package/dist/services/github/v4/mocks/getCommitsByAuthorMock.js +4 -1
  176. package/dist/services/github/v4/mocks/getPullRequestNodeMock.d.ts +1 -1
  177. package/dist/services/github/v4/mocks/getPullRequestNodeMock.js +1 -0
  178. package/dist/services/github/v4/throwOnInvalidAccessToken.d.ts +1 -1
  179. package/dist/services/github/v4/throwOnInvalidAccessToken.js +10 -15
  180. package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +7 -7
  181. package/dist/services/logger.d.ts +3 -3
  182. package/dist/services/logger.js +24 -24
  183. package/dist/services/prompt.test.d.ts +1 -0
  184. package/dist/services/prompt.test.js +87 -0
  185. package/dist/services/prompts.d.ts +10 -4
  186. package/dist/services/prompts.js +85 -22
  187. package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +9 -0
  188. package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +92 -0
  189. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +1 -0
  190. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +396 -0
  191. package/dist/services/sourceCommit/getMockSourceCommit.d.ts +21 -0
  192. package/dist/services/sourceCommit/getMockSourceCommit.js +67 -0
  193. package/dist/services/sourceCommit/getTargetBranchesFromLabels.d.ts +5 -0
  194. package/dist/services/sourceCommit/getTargetBranchesFromLabels.js +20 -0
  195. package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.d.ts +1 -0
  196. package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.js +201 -0
  197. package/dist/services/sourceCommit/parseSourceCommit.d.ts +82 -0
  198. package/dist/services/sourceCommit/parseSourceCommit.js +96 -0
  199. package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +1 -0
  200. package/dist/services/sourceCommit/parseSourceCommit.test.js +229 -0
  201. package/dist/services/sourceCommit/sourceCommit.d.ts +78 -0
  202. package/dist/services/sourceCommit/sourceCommit.js +86 -0
  203. package/dist/services/sourceCommit/sourceCommit.test.d.ts +1 -0
  204. package/dist/services/sourceCommit/sourceCommit.test.js +287 -0
  205. package/dist/services/sourceCommit.d.ts +78 -0
  206. package/dist/services/sourceCommit.js +86 -0
  207. package/dist/services/sourceCommit.test.d.ts +1 -0
  208. package/dist/services/sourceCommit.test.js +280 -0
  209. package/dist/test/inquirer.private.test.js +105 -61
  210. package/dist/test/integration/createSpies.d.ts +1 -1
  211. package/dist/test/integration/createSpies.js +21 -9
  212. package/dist/test/integration/envConstants.js +5 -6
  213. package/dist/test/integration/helpers.js +1 -1
  214. package/dist/test/integration/integration.private.test.d.ts +1 -0
  215. package/dist/test/integration/integration.private.test.js +317 -0
  216. package/dist/test/integration/integration.test.js +30 -31
  217. package/dist/test/mockConfigFiles.d.ts +5 -0
  218. package/dist/test/mockConfigFiles.js +37 -0
  219. package/dist/test/nockHelpers.d.ts +3 -3
  220. package/dist/test/nockHelpers.js +7 -11
  221. package/dist/test/private/getDevAccessToken.js +1 -1
  222. package/dist/test/setupFiles/automatic-mocks.d.ts +0 -1
  223. package/dist/test/setupFiles/automatic-mocks.js +1 -51
  224. package/dist/types/Commit.d.ts +85 -0
  225. package/dist/types/Commit.js +139 -0
  226. package/dist/types/commitNode.d.ts +89 -0
  227. package/dist/types/commitNode.js +139 -0
  228. package/dist/types/commitNode.test.d.ts +1 -0
  229. package/dist/types/commitNode.test.js +255 -0
  230. package/dist/types/commitWithAssociatedPullRequests.d.ts +86 -0
  231. package/dist/types/commitWithAssociatedPullRequests.js +145 -0
  232. package/dist/ui/cherrypickAndCreatePullRequest.test.js +333 -76
  233. package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +11 -1
  234. package/dist/ui/cherrypickAndCreateTargetPullRequest.js +138 -67
  235. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +1 -0
  236. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +468 -0
  237. package/dist/ui/getCommits.d.ts +1 -1
  238. package/dist/ui/getCommits.js +55 -25
  239. package/dist/ui/getTargetBranches.d.ts +3 -2
  240. package/dist/ui/getTargetBranches.js +33 -18
  241. package/dist/ui/getTargetBranches.test.js +75 -99
  242. package/dist/ui/getTargetBranchesFromLabels.d.ts +6 -0
  243. package/dist/ui/getTargetBranchesFromLabels.js +40 -0
  244. package/dist/ui/getTargetBranchesFromLabels.test.d.ts +1 -0
  245. package/dist/ui/getTargetBranchesFromLabels.test.js +288 -0
  246. package/dist/ui/maybeSetupRepo.js +11 -10
  247. package/dist/ui/maybeSetupRepo.test.js +54 -4
  248. package/dist/utils/excludeUndefined.d.ts +6 -0
  249. package/dist/utils/excludeUndefined.js +7 -0
  250. package/dist/utils/excludeUndefined.test.d.ts +1 -0
  251. package/dist/utils/excludeUndefined.test.js +24 -0
  252. package/package.json +37 -51
  253. package/yarn.lock +2416 -2987
@@ -0,0 +1,192 @@
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
+ const os_1 = __importDefault(require("os"));
26
+ const lodash_1 = require("lodash");
27
+ const nock_1 = __importDefault(require("nock"));
28
+ const runSequentially_1 = require("./runSequentially");
29
+ const childProcess = __importStar(require("./services/child-process-promisified"));
30
+ const nockHelpers_1 = require("./test/nockHelpers");
31
+ jest.mock('./services/child-process-promisified', () => {
32
+ return {
33
+ exec: jest.fn(async (cmd) => {
34
+ throw new Error(`Mock required for exec with cmd: "${cmd}"`);
35
+ }),
36
+ execAsCallback: jest.fn((...args) => {
37
+ (0, lodash_1.last)(args)();
38
+ return {
39
+ stderr: {
40
+ on: () => null,
41
+ },
42
+ };
43
+ }),
44
+ };
45
+ });
46
+ describe('runSequentially', () => {
47
+ let rpcExecMock;
48
+ let rpcExecOriginalMock;
49
+ let res;
50
+ let createPullRequestCalls;
51
+ afterEach(() => {
52
+ jest.clearAllMocks();
53
+ nock_1.default.cleanAll();
54
+ });
55
+ beforeEach(async () => {
56
+ jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
57
+ const options = {
58
+ accessToken: 'myAccessToken',
59
+ authenticatedUsername: 'sqren_authenticated',
60
+ assignees: [],
61
+ autoAssign: false,
62
+ autoFixConflicts: undefined,
63
+ autoMerge: false,
64
+ autoMergeMethod: 'merge',
65
+ branchLabelMapping: undefined,
66
+ historicalBranchLabelMappings: [],
67
+ cherrypickRef: true,
68
+ ci: false,
69
+ commitPaths: [],
70
+ details: false,
71
+ editor: 'code',
72
+ skipRemoteConfig: undefined,
73
+ fork: true,
74
+ gitHostname: 'github.com',
75
+ githubApiBaseUrlV3: 'https://api.github.com',
76
+ githubApiBaseUrlV4: 'http://localhost/graphql',
77
+ mainline: undefined,
78
+ maxNumber: 10,
79
+ multipleBranches: false,
80
+ multipleCommits: false,
81
+ noVerify: true,
82
+ prDescription: 'myPrDescription',
83
+ prFilter: undefined,
84
+ prTitle: 'myPrTitle {targetBranch} {commitMessages}',
85
+ pullNumber: undefined,
86
+ repoName: 'kibana',
87
+ repoOwner: 'elastic',
88
+ resetAuthor: false,
89
+ reviewers: [],
90
+ sha: undefined,
91
+ sourceBranch: 'my-source-branch-from-options',
92
+ sourcePRLabels: [],
93
+ targetBranches: [],
94
+ targetBranchChoices: [
95
+ { name: '6.x' },
96
+ { name: '6.0' },
97
+ { name: '5.6' },
98
+ { name: '5.5' },
99
+ { name: '5.4' },
100
+ ],
101
+ targetPRLabels: [],
102
+ author: 'sqren',
103
+ verbose: false,
104
+ };
105
+ rpcExecMock = jest
106
+ .spyOn(childProcess, 'exec')
107
+ .mockResolvedValue({ stdout: 'success', stderr: '' });
108
+ rpcExecOriginalMock = jest.spyOn(childProcess, 'execAsCallback');
109
+ const scope = (0, nock_1.default)('https://api.github.com')
110
+ .post('/repos/elastic/kibana/pulls')
111
+ .reply(200, {
112
+ number: 1337,
113
+ html_url: 'myHtmlUrl',
114
+ });
115
+ createPullRequestCalls = (0, nockHelpers_1.listenForCallsToNockScope)(scope);
116
+ const commits = [
117
+ {
118
+ sha: 'abcd',
119
+ committedDate: '1',
120
+ expectedTargetPullRequests: [],
121
+ originalMessage: 'My commit message',
122
+ sourceBranch: 'master',
123
+ pullNumber: 55,
124
+ },
125
+ ];
126
+ const targetBranches = ['7.x'];
127
+ res = await (0, runSequentially_1.runSequentially)({ options, commits, targetBranches });
128
+ scope.done();
129
+ });
130
+ it('returns pull request', () => {
131
+ expect(res).toEqual([
132
+ {
133
+ didUpdate: false,
134
+ pullRequestNumber: 1337,
135
+ pullRequestUrl: 'myHtmlUrl',
136
+ status: 'success',
137
+ targetBranch: '7.x',
138
+ },
139
+ ]);
140
+ });
141
+ it('creates pull request', () => {
142
+ expect(createPullRequestCalls).toMatchInlineSnapshot(`
143
+ Array [
144
+ Object {
145
+ "base": "7.x",
146
+ "body": "This is an automatic backport of pull request #55 to 7.x.
147
+
148
+ Please refer to the [Backport tool documentation](https://github.com/sqren/backport) for additional information
149
+
150
+ myPrDescription",
151
+ "head": "sqren_authenticated:backport/7.x/pr-55",
152
+ "title": "myPrTitle 7.x My commit message",
153
+ },
154
+ ]
155
+ `);
156
+ });
157
+ it('should run all commands in the correct directory', () => {
158
+ expect(rpcExecMock.mock.calls.every(
159
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
160
+ ([cmd, opts]) => opts.cwd === '/myHomeDir/.backport/repositories/elastic/kibana')).toBe(true);
161
+ });
162
+ it('exec should be called with correct args', () => {
163
+ expect(rpcExecMock).toHaveBeenCalledTimes(10);
164
+ expect(rpcExecMock.mock.calls.map(([cmd]) => cmd)).toEqual([
165
+ 'git remote rm origin',
166
+ 'git remote rm sqren_authenticated',
167
+ 'git remote add sqren_authenticated https://x-access-token:myAccessToken@github.com/sqren_authenticated/kibana.git',
168
+ 'git remote rm elastic',
169
+ 'git remote add elastic https://x-access-token:myAccessToken@github.com/elastic/kibana.git',
170
+ 'git reset --hard && git clean -d --force && git fetch elastic 7.x && git checkout -B backport/7.x/pr-55 elastic/7.x --no-track',
171
+ 'git fetch elastic master:master --force',
172
+ 'git cherry-pick -x abcd',
173
+ 'git push sqren_authenticated backport/7.x/pr-55:backport/7.x/pr-55 --force',
174
+ 'git reset --hard && git checkout my-source-branch-from-options && git branch -D backport/7.x/pr-55',
175
+ ]);
176
+ });
177
+ it('git clone should be called with correct args', () => {
178
+ expect(rpcExecOriginalMock).toHaveBeenCalledTimes(1);
179
+ expect(rpcExecOriginalMock.mock.calls).toMatchInlineSnapshot(`
180
+ Array [
181
+ Array [
182
+ "git clone https://x-access-token:myAccessToken@github.com/elastic/kibana.git --progress",
183
+ Object {
184
+ "cwd": "/myHomeDir/.backport/repositories/elastic",
185
+ "maxBuffer": 104857600,
186
+ },
187
+ [Function],
188
+ ],
189
+ ]
190
+ `);
191
+ });
192
+ });
@@ -1,10 +1,6 @@
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.runWithOptions = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
4
  const HandledError_1 = require("./services/HandledError");
9
5
  const logger_1 = require("./services/logger");
10
6
  const sequentially_1 = require("./services/sequentially");
@@ -14,17 +10,14 @@ const getTargetBranches_1 = require("./ui/getTargetBranches");
14
10
  const maybeSetupRepo_1 = require("./ui/maybeSetupRepo");
15
11
  async function runWithOptions(options) {
16
12
  logger_1.logger.verbose('Backport options', options);
17
- if (options.dryRun) {
18
- logger_1.consoleLog(chalk_1.default.red('Dry run: Nothing will be pushed to Github\n'));
19
- }
20
- const commits = await getCommits_1.getCommits(options);
21
- const targetBranches = await getTargetBranches_1.getTargetBranches(options, commits);
22
- await maybeSetupRepo_1.maybeSetupRepo(options);
13
+ const commits = await (0, getCommits_1.getCommits)(options);
14
+ const targetBranches = await (0, getTargetBranches_1.getTargetBranches)(options, commits);
15
+ await (0, maybeSetupRepo_1.maybeSetupRepo)(options);
23
16
  const results = [];
24
- await sequentially_1.sequentially(targetBranches, async (targetBranch) => {
17
+ await (0, sequentially_1.sequentially)(targetBranches, async (targetBranch) => {
25
18
  logger_1.logger.info(`Backporting ${JSON.stringify(commits)} to ${targetBranch}`);
26
19
  try {
27
- const pullRequest = await cherrypickAndCreateTargetPullRequest_1.cherrypickAndCreateTargetPullRequest({
20
+ const pullRequest = await (0, cherrypickAndCreateTargetPullRequest_1.cherrypickAndCreateTargetPullRequest)({
28
21
  options,
29
22
  commits,
30
23
  targetBranch,
@@ -38,10 +31,10 @@ async function runWithOptions(options) {
38
31
  catch (e) {
39
32
  const isHandledError = e instanceof HandledError_1.HandledError;
40
33
  const errorMessage = isHandledError
41
- ? logger_1.redact(e.message)
34
+ ? (0, logger_1.redact)(e.message)
42
35
  : 'An unhandled error occurred. Please consult the logs';
43
36
  results.push({ targetBranch, success: false, errorMessage, error: e });
44
- logger_1.consoleLog(errorMessage);
37
+ (0, logger_1.consoleLog)(errorMessage);
45
38
  }
46
39
  });
47
40
  // return the results for consumers to programatically read
@@ -22,13 +22,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
+ const os_1 = __importDefault(require("os"));
25
26
  const inquirer_1 = __importDefault(require("inquirer"));
27
+ const lodash_1 = require("lodash");
26
28
  const nock_1 = __importDefault(require("nock"));
27
29
  const runWithOptions_1 = require("./runWithOptions");
28
30
  const childProcess = __importStar(require("./services/child-process-promisified"));
29
31
  const fs = __importStar(require("./services/fs-promisified"));
30
32
  const commitsByAuthorMock_1 = require("./services/github/v4/mocks/commitsByAuthorMock");
31
33
  const nockHelpers_1 = require("./test/nockHelpers");
34
+ jest.mock('./services/child-process-promisified', () => {
35
+ return {
36
+ exec: jest.fn(async (cmd) => {
37
+ throw new Error(`Mock required for exec with cmd: "${cmd}"`);
38
+ }),
39
+ execAsCallback: jest.fn((...args) => {
40
+ (0, lodash_1.last)(args)();
41
+ return {
42
+ stderr: {
43
+ on: () => null,
44
+ },
45
+ };
46
+ }),
47
+ };
48
+ });
32
49
  describe('runWithOptions', () => {
33
50
  let rpcExecMock;
34
51
  let rpcExecOriginalMock;
@@ -42,16 +59,23 @@ describe('runWithOptions', () => {
42
59
  nock_1.default.cleanAll();
43
60
  });
44
61
  beforeEach(async () => {
62
+ jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
45
63
  const options = {
46
64
  accessToken: 'myAccessToken',
47
65
  all: false,
48
66
  assignees: [],
49
67
  author: 'sqren',
68
+ autoAssign: false,
50
69
  autoFixConflicts: undefined,
70
+ autoMerge: false,
71
+ autoMergeMethod: 'merge',
51
72
  branchLabelMapping: undefined,
52
73
  ci: false,
53
- dryRun: false,
74
+ cherrypickRef: true,
75
+ commitPaths: [],
76
+ details: false,
54
77
  editor: 'code',
78
+ forceLocalConfig: undefined,
55
79
  fork: true,
56
80
  gitHostname: 'github.com',
57
81
  githubApiBaseUrlV3: 'https://api.github.com',
@@ -61,18 +85,18 @@ describe('runWithOptions', () => {
61
85
  multipleBranches: false,
62
86
  multipleCommits: false,
63
87
  noVerify: true,
64
- path: undefined,
65
88
  prDescription: 'myPrDescription',
89
+ prFilter: undefined,
66
90
  prTitle: 'myPrTitle {targetBranch} {commitMessages}',
67
91
  pullNumber: undefined,
68
92
  repoName: 'kibana',
69
93
  repoOwner: 'elastic',
70
94
  resetAuthor: false,
71
95
  sha: undefined,
72
- sourceBranch: 'mySourceBranch',
96
+ sourceBranch: 'my-source-branch-from-options',
73
97
  sourcePRLabels: [],
74
- prFilter: undefined,
75
98
  targetBranches: [],
99
+ upstream: 'elastic/kibana',
76
100
  targetBranchChoices: [
77
101
  { name: '6.x' },
78
102
  { name: '6.0' },
@@ -97,21 +121,21 @@ describe('runWithOptions', () => {
97
121
  .mockImplementationOnce((async (args) => {
98
122
  return { promptResult: args[0].choices[0].name };
99
123
  }));
100
- authorIdCalls = nockHelpers_1.mockGqlRequest({
124
+ authorIdCalls = (0, nockHelpers_1.mockGqlRequest)({
101
125
  name: 'AuthorId',
102
126
  statusCode: 200,
103
127
  body: { data: { user: { id: 'sqren_author_id' } } },
104
128
  });
105
- commitsByAuthorCalls = nockHelpers_1.mockGqlRequest({
129
+ commitsByAuthorCalls = (0, nockHelpers_1.mockGqlRequest)({
106
130
  name: 'CommitsByAuthor',
107
131
  statusCode: 200,
108
- body: { data: commitsByAuthorMock_1.commitsWithPullRequestsMock },
132
+ body: { data: commitsByAuthorMock_1.commitsByAuthorMock },
109
133
  });
110
- const scope = nock_1.default('https://api.github.com')
134
+ const scope = (0, nock_1.default)('https://api.github.com')
111
135
  .post('/repos/elastic/kibana/pulls')
112
136
  .reply(200, { html_url: 'pull request url', number: 1337 });
113
- createPullRequestCalls = nockHelpers_1.getNockCallsForScope(scope);
114
- res = await runWithOptions_1.runWithOptions(options);
137
+ createPullRequestCalls = (0, nockHelpers_1.getNockCallsForScope)(scope);
138
+ res = await (0, runWithOptions_1.runWithOptions)(options);
115
139
  scope.done();
116
140
  });
117
141
  it('returns pull request', () => {
@@ -129,7 +153,7 @@ describe('runWithOptions', () => {
129
153
  base: '6.x',
130
154
  body: 'Backports the following commits to 6.x:\n - Add 👻 (2e63475c)\n\nmyPrDescription',
131
155
  head: 'sqren:backport/6.x/commit-2e63475c',
132
- title: 'myPrTitle 6.x Add 👻 (2e63475c)',
156
+ title: 'myPrTitle 6.x Add 👻',
133
157
  },
134
158
  ]);
135
159
  });
@@ -155,24 +179,126 @@ describe('runWithOptions', () => {
155
179
  expect(commitsByAuthorCalls.map((body) => body.variables)).toEqual([
156
180
  {
157
181
  authorId: 'sqren_author_id',
158
- historyPath: null,
159
182
  maxNumber: 10,
183
+ commitPath: null,
160
184
  repoName: 'kibana',
161
185
  repoOwner: 'elastic',
162
- sourceBranch: 'mySourceBranch',
186
+ sourceBranch: 'my-source-branch-from-options',
163
187
  },
164
188
  ]);
165
189
  });
166
190
  it('prompt calls should match snapshot', () => {
167
191
  expect(inquirer_1.default.prompt).toHaveBeenCalledTimes(2);
168
- expect(inquirerPromptMock.mock.calls).toMatchSnapshot();
192
+ expect(
193
+ // @ts-expect-error
194
+ inquirerPromptMock.mock.calls[0][0][0].choices.map(({ name, short }) => ({
195
+ name,
196
+ short,
197
+ }))).toMatchInlineSnapshot(`
198
+ Array [
199
+ Object {
200
+ "name": "1. Add 👻 ",
201
+ "short": "2e63475c",
202
+ },
203
+ Object {
204
+ "name": "2. Add witch (#85) ",
205
+ "short": "#85 (f3b618b9)",
206
+ },
207
+ Object {
208
+ "name": "3. Add SF mention (#80) 6.3",
209
+ "short": "#80 (79cf1845)",
210
+ },
211
+ Object {
212
+ "name": "4. Add backport config ",
213
+ "short": "3827bbba",
214
+ },
215
+ Object {
216
+ "name": "5. Initial commit ",
217
+ "short": "5ea0da55",
218
+ },
219
+ ]
220
+ `);
169
221
  });
170
222
  it('exec should be called with correct args', () => {
171
223
  expect(rpcExecMock).toHaveBeenCalledTimes(10);
172
- expect(rpcExecMock.mock.calls).toMatchSnapshot();
224
+ expect(rpcExecMock.mock.calls).toMatchInlineSnapshot(`
225
+ Array [
226
+ Array [
227
+ "git remote rm origin",
228
+ Object {
229
+ "cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
230
+ },
231
+ ],
232
+ Array [
233
+ "git remote rm sqren",
234
+ Object {
235
+ "cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
236
+ },
237
+ ],
238
+ Array [
239
+ "git remote add sqren https://x-access-token:myAccessToken@github.com/sqren/kibana.git",
240
+ Object {
241
+ "cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
242
+ },
243
+ ],
244
+ Array [
245
+ "git remote rm elastic",
246
+ Object {
247
+ "cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
248
+ },
249
+ ],
250
+ Array [
251
+ "git remote add elastic https://x-access-token:myAccessToken@github.com/elastic/kibana.git",
252
+ Object {
253
+ "cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
254
+ },
255
+ ],
256
+ Array [
257
+ "git reset --hard && git clean -d --force && git fetch elastic 6.x && git checkout -B backport/6.x/commit-2e63475c elastic/6.x --no-track",
258
+ Object {
259
+ "cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
260
+ },
261
+ ],
262
+ Array [
263
+ "git fetch elastic my-source-branch-from-options:my-source-branch-from-options --force",
264
+ Object {
265
+ "cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
266
+ },
267
+ ],
268
+ Array [
269
+ "git cherry-pick 2e63475c483f7844b0f2833bc57fdee32095bacb",
270
+ Object {
271
+ "cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
272
+ },
273
+ ],
274
+ Array [
275
+ "git push sqren backport/6.x/commit-2e63475c:backport/6.x/commit-2e63475c --force",
276
+ Object {
277
+ "cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
278
+ },
279
+ ],
280
+ Array [
281
+ "git reset --hard && git checkout my-source-branch-from-options && git branch -D backport/6.x/commit-2e63475c",
282
+ Object {
283
+ "cwd": "/myHomeDir/.backport/repositories/elastic/kibana",
284
+ },
285
+ ],
286
+ ]
287
+ `);
173
288
  });
174
289
  it('git clone should be called with correct args', () => {
175
290
  expect(rpcExecOriginalMock).toHaveBeenCalledTimes(1);
176
- expect(rpcExecOriginalMock.mock.calls).toMatchSnapshot();
291
+ expect(rpcExecOriginalMock.mock.calls).toMatchInlineSnapshot(`
292
+ Array [
293
+ Array [
294
+ "git clone https://x-access-token:myAccessToken@github.com/elastic/kibana.git --progress",
295
+ Object {
296
+ "cwd": "/myHomeDir/.backport/repositories/elastic",
297
+ "maxBuffer": 104857600,
298
+ },
299
+ [Function],
300
+ ],
301
+ ]
302
+ `);
177
303
  });
178
304
  });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fetchCommitBySha_1 = require("../services/github/v4/fetchCommits/fetchCommitBySha");
4
+ const getDevAccessToken_1 = require("../test/private/getDevAccessToken");
5
+ async function init() {
6
+ const accessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
7
+ const res = (0, fetchCommitBySha_1.fetchCommitBySha)({
8
+ accessToken,
9
+ githubApiBaseUrlV4: 'https://api.github.com/graphql',
10
+ repoName: 'backport-org',
11
+ repoOwner: 'backport-e2e',
12
+ sha: 'b484e161b705b39dbbfc5005e67ca24d05b23c37',
13
+ sourceBranch: 'main',
14
+ });
15
+ }
@@ -6,14 +6,14 @@ const env_1 = require("../services/env");
6
6
  const logger_1 = require("../services/logger");
7
7
  async function postinstall() {
8
8
  try {
9
- const didCreate = await globalConfig_1.createGlobalConfigAndFolderIfNotExist();
9
+ const didCreate = await (0, globalConfig_1.createGlobalConfigAndFolderIfNotExist)();
10
10
  if (didCreate) {
11
- const GLOBAL_CONFIG_PATH = env_1.getGlobalConfigPath();
12
- logger_1.consoleLog(`Global config successfully created in ${GLOBAL_CONFIG_PATH}`);
11
+ const GLOBAL_CONFIG_PATH = (0, env_1.getGlobalConfigPath)();
12
+ (0, logger_1.consoleLog)(`Global config successfully created in ${GLOBAL_CONFIG_PATH}`);
13
13
  }
14
14
  }
15
15
  catch (e) {
16
- logger_1.consoleLog(`Global config could not be created:\n${e.stack}`);
16
+ (0, logger_1.consoleLog)(`Global config could not be created:\n${e.stack}`);
17
17
  }
18
18
  }
19
19
  exports.postinstall = postinstall;
@@ -18,19 +18,26 @@ var __importStar = (this && this.__importStar) || function (mod) {
18
18
  __setModuleDefault(result, mod);
19
19
  return result;
20
20
  };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
21
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
+ const os_1 = __importDefault(require("os"));
22
26
  const globalConfig = __importStar(require("../options/config/globalConfig"));
23
27
  const logger = __importStar(require("../services/logger"));
24
28
  const postinstall_1 = require("./postinstall");
25
29
  describe('postinstall', () => {
26
30
  beforeEach(() => {
31
+ jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
32
+ });
33
+ afterEach(() => {
27
34
  jest.clearAllMocks();
28
35
  });
29
36
  it("should create global config if it doesn't exist", async () => {
30
37
  const createGlobalConfigAndFolderIfNotExistSpy = jest
31
38
  .spyOn(globalConfig, 'createGlobalConfigAndFolderIfNotExist')
32
39
  .mockResolvedValueOnce(true);
33
- await postinstall_1.postinstall();
40
+ await (0, postinstall_1.postinstall)();
34
41
  expect(createGlobalConfigAndFolderIfNotExistSpy).toBeCalledTimes(1);
35
42
  expect(logger.consoleLog).toBeCalledWith('Global config successfully created in /myHomeDir/.backport/config.json');
36
43
  });
@@ -39,7 +46,7 @@ describe('postinstall', () => {
39
46
  const createGlobalConfigAndFolderIfNotExistSpy = jest
40
47
  .spyOn(globalConfig, 'createGlobalConfigAndFolderIfNotExist')
41
48
  .mockResolvedValueOnce(false);
42
- await postinstall_1.postinstall();
49
+ await (0, postinstall_1.postinstall)();
43
50
  expect(createGlobalConfigAndFolderIfNotExistSpy).toBeCalledTimes(1);
44
51
  expect(consoleSpy).toBeCalledTimes(0);
45
52
  });
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const postinstall_1 = require("./postinstall");
4
- postinstall_1.postinstall();
4
+ (0, postinstall_1.postinstall)();
@@ -1,3 +1,13 @@
1
+ import { Commit } from './sourceCommit/parseSourceCommit';
2
+ declare type Meta = {
3
+ type: 'commitsWithoutBackports';
4
+ commitsWithoutBackports: {
5
+ formatted: string;
6
+ commit: Commit;
7
+ }[];
8
+ };
1
9
  export declare class HandledError extends Error {
2
- constructor(message: string);
10
+ meta?: Meta;
11
+ constructor(message: string, meta?: Meta);
3
12
  }
13
+ export {};
@@ -2,10 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HandledError = void 0;
4
4
  class HandledError extends Error {
5
- constructor(message) {
5
+ constructor(message, meta) {
6
6
  super(message);
7
7
  Error.captureStackTrace(this, HandledError);
8
8
  this.name = 'HandledError';
9
+ this.meta = meta;
9
10
  }
10
11
  }
11
12
  exports.HandledError = HandledError;
@@ -4,4 +4,4 @@ export declare function exec(cmd: string, options: child_process.ExecOptions): P
4
4
  stdout: string;
5
5
  stderr: string;
6
6
  }>;
7
- export declare const execAsCallback: (command: string, options: (import("fs").BaseEncodingOptions & child_process.ExecOptions) | null | undefined, callback?: ((error: child_process.ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined) => child_process.ChildProcess;
7
+ export declare const execAsCallback: (command: string, options: (import("fs").ObjectEncodingOptions & child_process.ExecOptions) | null | undefined, callback?: ((error: child_process.ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined) => child_process.ChildProcess;
@@ -8,7 +8,7 @@ const child_process_1 = __importDefault(require("child_process"));
8
8
  const util_1 = require("util");
9
9
  const logger_1 = require("./logger");
10
10
  async function exec(cmd, options) {
11
- const execPromisified = util_1.promisify(child_process_1.default.exec);
11
+ const execPromisified = (0, util_1.promisify)(child_process_1.default.exec);
12
12
  try {
13
13
  const res = await execPromisified(cmd, {
14
14
  maxBuffer: 100 * 1024 * 1024,
@@ -18,7 +18,7 @@ async function exec(cmd, options) {
18
18
  return res;
19
19
  }
20
20
  catch (e) {
21
- logger_1.logger.info(`exec error '${cmd}':`, e);
21
+ logger_1.logger.info(`exec error '${cmd}': ${JSON.stringify(e, null, 2)}`);
22
22
  throw e;
23
23
  }
24
24
  }
@@ -7,22 +7,22 @@ exports.getRepoPath = exports.getRepoOwnerPath = exports.getReposPath = exports.
7
7
  const os_1 = require("os");
8
8
  const path_1 = __importDefault(require("path"));
9
9
  function getLogfilePath() {
10
- return path_1.default.join(os_1.homedir(), '.backport', 'backport.log');
10
+ return path_1.default.join((0, os_1.homedir)(), '.backport', 'backport.log');
11
11
  }
12
12
  exports.getLogfilePath = getLogfilePath;
13
13
  function getGlobalConfigPath() {
14
- return path_1.default.join(os_1.homedir(), '.backport', 'config.json');
14
+ return path_1.default.join((0, os_1.homedir)(), '.backport', 'config.json');
15
15
  }
16
16
  exports.getGlobalConfigPath = getGlobalConfigPath;
17
17
  function getReposPath() {
18
- return path_1.default.join(os_1.homedir(), '.backport', 'repositories');
18
+ return path_1.default.join((0, os_1.homedir)(), '.backport', 'repositories');
19
19
  }
20
20
  exports.getReposPath = getReposPath;
21
21
  function getRepoOwnerPath({ repoOwner }) {
22
- return path_1.default.join(os_1.homedir(), '.backport', 'repositories', repoOwner);
22
+ return path_1.default.join((0, os_1.homedir)(), '.backport', 'repositories', repoOwner);
23
23
  }
24
24
  exports.getRepoOwnerPath = getRepoOwnerPath;
25
25
  function getRepoPath({ repoOwner, repoName }) {
26
- return path_1.default.join(os_1.homedir(), '.backport', 'repositories', repoOwner, repoName);
26
+ return path_1.default.join((0, os_1.homedir)(), '.backport', 'repositories', repoOwner, repoName);
27
27
  }
28
28
  exports.getRepoPath = getRepoPath;