backport 5.6.6 → 6.1.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 (234) hide show
  1. package/README.md +186 -50
  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 +34 -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 +28 -13
  12. package/dist/options/cliArgs.d.ts +36 -35
  13. package/dist/options/cliArgs.js +91 -52
  14. package/dist/options/cliArgs.test.js +35 -43
  15. package/dist/options/config/config.d.ts +35 -57
  16. package/dist/options/config/config.js +5 -39
  17. package/dist/options/config/config.test.js +11 -27
  18. package/dist/options/config/getOptionsFromGit.d.ts +3 -2
  19. package/dist/options/config/getOptionsFromGit.js +1 -3
  20. package/dist/options/config/globalConfig.d.ts +2 -51
  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 -51
  24. package/dist/options/config/projectConfig.js +2 -2
  25. package/dist/options/config/projectConfig.test.js +53 -16
  26. package/dist/options/config/readConfigFile.d.ts +44 -41
  27. package/dist/options/config/readConfigFile.js +30 -4
  28. package/dist/options/options.d.ts +59 -31
  29. package/dist/options/options.js +103 -10
  30. package/dist/options/options.test.js +266 -79
  31. package/dist/options/parseRequiredOptions.d.ts +19 -14
  32. package/dist/options/parseRequiredOptions.js +9 -15
  33. package/dist/options/parseRequiredOptions.test.js +30 -26
  34. package/dist/runSequentially.d.ts +20 -0
  35. package/dist/runSequentially.js +41 -0
  36. package/dist/runSequentially.test.d.ts +1 -0
  37. package/dist/runSequentially.test.js +196 -0
  38. package/dist/runWithOptions.js +7 -14
  39. package/dist/runWithOptions.test.js +138 -17
  40. package/dist/scripts/generate-gql.d.ts +1 -0
  41. package/dist/scripts/generate-gql.js +15 -0
  42. package/dist/scripts/postinstall.js +4 -4
  43. package/dist/scripts/postinstall.test.js +9 -2
  44. package/dist/scripts/runPostinstall.js +1 -1
  45. package/dist/services/HandledError.d.ts +11 -1
  46. package/dist/services/HandledError.js +2 -1
  47. package/dist/services/child-process-promisified.d.ts +1 -1
  48. package/dist/services/child-process-promisified.js +1 -1
  49. package/dist/services/env.js +5 -5
  50. package/dist/services/env.test.js +11 -4
  51. package/dist/services/fs-promisified.js +4 -4
  52. package/dist/services/getExpectedTarget.d.ts +9 -0
  53. package/dist/services/getExpectedTarget.js +77 -0
  54. package/dist/services/getExpectedTargetPullRequests.d.ts +9 -0
  55. package/dist/services/getExpectedTargetPullRequests.js +77 -0
  56. package/dist/services/git.d.ts +20 -6
  57. package/dist/services/git.integration.test.d.ts +1 -0
  58. package/dist/services/git.integration.test.js +168 -0
  59. package/dist/services/git.js +93 -67
  60. package/dist/services/git.test.js +68 -68
  61. package/dist/services/github/commitFormatters.d.ts +3 -7
  62. package/dist/services/github/commitFormatters.js +10 -19
  63. package/dist/services/github/commitFormatters.test.js +2 -24
  64. package/dist/services/github/v3/addAssigneesToPullRequest.d.ts +1 -1
  65. package/dist/services/github/v3/addAssigneesToPullRequest.js +3 -8
  66. package/dist/services/github/v3/addAssigneesToPullRequest.test.js +6 -8
  67. package/dist/services/github/v3/addLabelsToPullRequest.d.ts +1 -1
  68. package/dist/services/github/v3/addLabelsToPullRequest.js +2 -6
  69. package/dist/services/github/v3/addReviewersToPullRequest.d.ts +2 -0
  70. package/dist/services/github/v3/addReviewersToPullRequest.js +34 -0
  71. package/dist/services/github/v3/createPullRequest.d.ts +3 -2
  72. package/dist/services/github/v3/createPullRequest.js +31 -25
  73. package/dist/services/github/v3/createPullRequest.test.d.ts +1 -0
  74. package/dist/services/github/v3/createPullRequest.test.js +110 -0
  75. package/dist/services/github/v3/createStatusComment.d.ts +11 -0
  76. package/dist/services/github/v3/createStatusComment.js +95 -0
  77. package/dist/services/github/v3/createStatusComment.test.d.ts +1 -0
  78. package/dist/services/github/v3/createStatusComment.test.js +209 -0
  79. package/dist/services/github/v4/FetchPullRequestId.js +1 -1
  80. package/dist/services/github/v4/apiRequestV4.d.ts +2 -2
  81. package/dist/services/github/v4/apiRequestV4.js +6 -8
  82. package/dist/services/github/v4/apiRequestV4.test.js +7 -7
  83. package/dist/services/github/v4/disablePullRequestAutoMerge.js +3 -4
  84. package/dist/services/github/v4/enablePullRequestAutoMerge.js +9 -8
  85. package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +93 -33
  86. package/dist/services/github/v4/fetchAuthorId.d.ts +5 -2
  87. package/dist/services/github/v4/fetchAuthorId.js +6 -7
  88. package/dist/services/github/v4/fetchAuthorId.private.test.js +6 -9
  89. package/dist/services/github/v4/fetchCommitByPullNumber.js +11 -9
  90. package/dist/services/github/v4/fetchCommitByPullNumber.private.test.js +4 -4
  91. package/dist/services/github/v4/fetchCommitBySha.js +14 -12
  92. package/dist/services/github/v4/fetchCommitBySha.private.test.js +4 -4
  93. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +12 -0
  94. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +46 -0
  95. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +1 -0
  96. package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +70 -0
  97. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.d.ts +12 -0
  98. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +36 -0
  99. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +1 -0
  100. package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +55 -0
  101. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +27 -0
  102. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +88 -0
  103. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +1 -0
  104. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +128 -0
  105. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +1 -0
  106. package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +125 -0
  107. package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.d.ts +28 -0
  108. package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.js +52 -0
  109. package/dist/services/github/v4/fetchCommits/fetchProjectConfig.d.ts +3 -0
  110. package/dist/services/github/v4/fetchCommits/fetchProjectConfig.js +55 -0
  111. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +10 -0
  112. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +49 -0
  113. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +1 -0
  114. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +77 -0
  115. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.d.ts +1 -0
  116. package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.js +252 -0
  117. package/dist/services/github/v4/fetchCommitsByAuthor.d.ts +2 -1
  118. package/dist/services/github/v4/fetchCommitsByAuthor.js +81 -70
  119. package/dist/services/github/v4/fetchCommitsByAuthor.private.test.js +78 -5
  120. package/dist/services/github/v4/fetchCommitsByAuthor.test.js +29 -21
  121. package/dist/services/github/v4/fetchDefaultBranch.js +1 -1
  122. package/dist/services/github/v4/fetchExistingPullRequest.js +2 -3
  123. package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +3 -5
  124. package/dist/services/github/v4/fetchMergedPullRequests.d.ts +18 -19
  125. package/dist/services/github/v4/fetchMergedPullRequests.js +22 -69
  126. package/dist/services/github/v4/fetchMergedPullRequests.private.test.js +8 -9
  127. package/dist/services/github/v4/fetchProjectConfig.d.ts +8 -0
  128. package/dist/services/github/v4/fetchProjectConfig.js +56 -0
  129. package/dist/services/github/v4/fetchProjectConfig.private.test.d.ts +1 -0
  130. package/dist/services/github/v4/fetchProjectConfig.private.test.js +52 -0
  131. package/dist/services/github/v4/fetchProjectConfig.test.d.ts +1 -0
  132. package/dist/services/github/v4/fetchProjectConfig.test.js +37 -0
  133. package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.js +2 -3
  134. package/dist/services/github/v4/fetchPullRequestBySearchQuery.js +12 -10
  135. package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.js +3 -3
  136. package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.js +2 -2
  137. package/dist/services/github/v4/getExistingTargetPullRequests.d.ts +4 -58
  138. package/dist/services/github/v4/getExistingTargetPullRequests.js +3 -58
  139. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +67 -0
  140. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +130 -0
  141. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +1 -0
  142. package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +130 -0
  143. package/dist/services/github/v4/getOptionsFromGithub/index.d.ts +19 -11
  144. package/dist/services/github/v4/getOptionsFromGithub/index.js +52 -22
  145. package/dist/services/github/v4/getOptionsFromGithub/index.private.test.js +46 -7
  146. package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +16 -16
  147. package/dist/services/github/v4/getOptionsFromGithub/query.js +16 -15
  148. package/dist/services/github/v4/getTargetBranchesFromLabels.d.ts +0 -7
  149. package/dist/services/github/v4/getTargetBranchesFromLabels.js +1 -26
  150. package/dist/services/github/v4/getTargetBranchesFromLabels.test.js +69 -32
  151. package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +2 -2
  152. package/dist/services/github/v4/mocks/commitsByAuthorMock.js +39 -25
  153. package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.d.ts +1 -1
  154. package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.js +10 -0
  155. package/dist/services/github/v4/mocks/getCommitsByAuthorMock.d.ts +1 -1
  156. package/dist/services/github/v4/mocks/getCommitsByAuthorMock.js +2 -0
  157. package/dist/services/github/v4/mocks/getPullRequestNodeMock.d.ts +1 -1
  158. package/dist/services/github/v4/mocks/getPullRequestNodeMock.js +1 -0
  159. package/dist/services/github/v4/throwOnInvalidAccessToken.js +10 -15
  160. package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +7 -7
  161. package/dist/services/logger.d.ts +3 -3
  162. package/dist/services/logger.js +16 -15
  163. package/dist/services/prompt.test.d.ts +1 -0
  164. package/dist/services/prompt.test.js +87 -0
  165. package/dist/services/prompts.d.ts +10 -4
  166. package/dist/services/prompts.js +85 -22
  167. package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +9 -0
  168. package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +92 -0
  169. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +1 -0
  170. package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +413 -0
  171. package/dist/services/sourceCommit/getMockSourceCommit.d.ts +21 -0
  172. package/dist/services/sourceCommit/getMockSourceCommit.js +67 -0
  173. package/dist/services/sourceCommit/getTargetBranchesFromLabels.d.ts +5 -0
  174. package/dist/services/sourceCommit/getTargetBranchesFromLabels.js +20 -0
  175. package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.d.ts +1 -0
  176. package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.js +201 -0
  177. package/dist/services/sourceCommit/parseSourceCommit.d.ts +82 -0
  178. package/dist/services/sourceCommit/parseSourceCommit.js +96 -0
  179. package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +1 -0
  180. package/dist/services/sourceCommit/parseSourceCommit.test.js +229 -0
  181. package/dist/services/sourceCommit/sourceCommit.d.ts +78 -0
  182. package/dist/services/sourceCommit/sourceCommit.js +86 -0
  183. package/dist/services/sourceCommit/sourceCommit.test.d.ts +1 -0
  184. package/dist/services/sourceCommit/sourceCommit.test.js +287 -0
  185. package/dist/services/sourceCommit.d.ts +78 -0
  186. package/dist/services/sourceCommit.js +86 -0
  187. package/dist/services/sourceCommit.test.d.ts +1 -0
  188. package/dist/services/sourceCommit.test.js +280 -0
  189. package/dist/test/inquirer.private.test.js +55 -51
  190. package/dist/test/integration/createSpies.js +6 -6
  191. package/dist/test/integration/envConstants.js +5 -6
  192. package/dist/test/integration/helpers.js +1 -1
  193. package/dist/test/integration/integration.private.test.d.ts +1 -0
  194. package/dist/test/integration/integration.private.test.js +327 -0
  195. package/dist/test/integration/integration.test.js +28 -29
  196. package/dist/test/mockConfigFiles.d.ts +5 -0
  197. package/dist/test/mockConfigFiles.js +37 -0
  198. package/dist/test/nockHelpers.d.ts +1 -1
  199. package/dist/test/nockHelpers.js +7 -11
  200. package/dist/test/private/getDevAccessToken.js +1 -1
  201. package/dist/test/setupFiles/automatic-mocks.d.ts +0 -1
  202. package/dist/test/setupFiles/automatic-mocks.js +1 -51
  203. package/dist/types/Commit.d.ts +85 -0
  204. package/dist/types/Commit.js +139 -0
  205. package/dist/types/commitNode.d.ts +89 -0
  206. package/dist/types/commitNode.js +139 -0
  207. package/dist/types/commitNode.test.d.ts +1 -0
  208. package/dist/types/commitNode.test.js +255 -0
  209. package/dist/types/commitWithAssociatedPullRequests.d.ts +86 -0
  210. package/dist/types/commitWithAssociatedPullRequests.js +145 -0
  211. package/dist/ui/cherrypickAndCreatePullRequest.test.js +346 -76
  212. package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +2 -1
  213. package/dist/ui/cherrypickAndCreateTargetPullRequest.js +95 -67
  214. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +1 -0
  215. package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +468 -0
  216. package/dist/ui/getCommits.d.ts +1 -1
  217. package/dist/ui/getCommits.js +55 -25
  218. package/dist/ui/getCommitsWithoutBackports.d.ts +11 -0
  219. package/dist/ui/getCommitsWithoutBackports.js +53 -0
  220. package/dist/ui/getTargetBranches.d.ts +3 -2
  221. package/dist/ui/getTargetBranches.js +33 -18
  222. package/dist/ui/getTargetBranches.test.js +75 -99
  223. package/dist/ui/getTargetBranchesFromLabels.d.ts +6 -0
  224. package/dist/ui/getTargetBranchesFromLabels.js +40 -0
  225. package/dist/ui/getTargetBranchesFromLabels.test.d.ts +1 -0
  226. package/dist/ui/getTargetBranchesFromLabels.test.js +288 -0
  227. package/dist/ui/maybeSetupRepo.js +11 -10
  228. package/dist/ui/maybeSetupRepo.test.js +54 -4
  229. package/dist/utils/excludeUndefined.d.ts +6 -0
  230. package/dist/utils/excludeUndefined.js +7 -0
  231. package/dist/utils/excludeUndefined.test.d.ts +1 -0
  232. package/dist/utils/excludeUndefined.test.js +24 -0
  233. package/package.json +37 -51
  234. package/yarn.lock +2414 -2993
@@ -9,33 +9,34 @@ const ora = require("ora");
9
9
  const env_1 = require("../services/env");
10
10
  const git_1 = require("../services/git");
11
11
  async function maybeSetupRepo(options) {
12
- const isAlreadyCloned = await git_1.repoExists(options);
12
+ const isAlreadyCloned = await (0, git_1.repoExists)(options);
13
13
  // clone repo if folder does not already exists
14
14
  if (!isAlreadyCloned) {
15
15
  const spinner = ora().start();
16
16
  try {
17
17
  const spinnerCloneText = 'Cloning repository (one-time operation)';
18
18
  spinner.text = `0% ${spinnerCloneText}`;
19
- await make_dir_1.default(env_1.getRepoOwnerPath(options));
20
- await git_1.cloneRepo(options, (progress) => {
19
+ await (0, make_dir_1.default)((0, env_1.getRepoOwnerPath)(options));
20
+ await (0, git_1.cloneRepo)(options, (progress) => {
21
21
  spinner.text = `${progress}% ${spinnerCloneText}`;
22
22
  });
23
23
  spinner.succeed(`100% ${spinnerCloneText}`);
24
24
  }
25
25
  catch (e) {
26
26
  spinner.fail();
27
- await git_1.deleteRepo(options);
27
+ await (0, git_1.deleteRepo)(options);
28
28
  throw e;
29
29
  }
30
30
  }
31
31
  // delete default "origin" remote to avoid confusion
32
- await git_1.deleteRemote(options, 'origin');
32
+ await (0, git_1.deleteRemote)(options, 'origin');
33
33
  // ensure remote are setup with latest accessToken
34
- await git_1.deleteRemote(options, options.username);
35
- await git_1.addRemote(options, options.username);
36
- if (options.username !== options.repoOwner) {
37
- await git_1.deleteRemote(options, options.repoOwner);
38
- await git_1.addRemote(options, options.repoOwner);
34
+ await (0, git_1.deleteRemote)(options, options.authenticatedUsername);
35
+ await (0, git_1.addRemote)(options, options.authenticatedUsername);
36
+ // update remote for origin (if the above is a fork)
37
+ if (options.authenticatedUsername !== options.repoOwner) {
38
+ await (0, git_1.deleteRemote)(options, options.repoOwner);
39
+ await (0, git_1.addRemote)(options, options.repoOwner);
39
40
  }
40
41
  }
41
42
  exports.maybeSetupRepo = maybeSetupRepo;
@@ -1,24 +1,74 @@
1
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
+ };
2
21
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
23
  };
5
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
+ const os_1 = __importDefault(require("os"));
6
26
  const del_1 = __importDefault(require("del"));
7
27
  const makeDir = require("make-dir");
28
+ const childProcess = __importStar(require("../services/child-process-promisified"));
29
+ const fs = __importStar(require("../services/fs-promisified"));
8
30
  const maybeSetupRepo_1 = require("./maybeSetupRepo");
9
31
  describe('maybeSetupRepo', () => {
32
+ let execSpy;
33
+ beforeEach(() => {
34
+ jest.spyOn(os_1.default, 'homedir').mockReturnValue('/myHomeDir');
35
+ execSpy = jest
36
+ .spyOn(childProcess, 'exec')
37
+ .mockResolvedValue({ stderr: '', stdout: '' });
38
+ });
10
39
  it('should delete repo if an error occurs', async () => {
11
40
  expect.assertions(2);
12
41
  makeDir.mockImplementationOnce(() => {
13
42
  throw new Error('makeDir failed');
14
43
  });
15
- await expect(maybeSetupRepo_1.maybeSetupRepo({
16
- repoOwner: 'elastic',
17
- repoName: 'kibana',
18
- username: 'sqren',
44
+ await expect((0, maybeSetupRepo_1.maybeSetupRepo)({
19
45
  accessToken: 'myAccessToken',
20
46
  gitHostname: 'github.com',
47
+ repoName: 'kibana',
48
+ repoOwner: 'elastic',
21
49
  })).rejects.toThrowError('makeDir failed');
22
50
  expect(del_1.default).toHaveBeenCalledWith('/myHomeDir/.backport/repositories/elastic/kibana');
23
51
  });
52
+ describe('if repo already exists', () => {
53
+ beforeEach(() => {
54
+ // @ts-expect-error
55
+ jest.spyOn(fs, 'stat').mockResolvedValue({ isDirectory: () => true });
56
+ });
57
+ it('should re-create remotes for both source repo and fork', async () => {
58
+ await (0, maybeSetupRepo_1.maybeSetupRepo)({
59
+ accessToken: 'myAccessToken',
60
+ authenticatedUsername: 'sqren_authenticated',
61
+ gitHostname: 'github.com',
62
+ repoName: 'kibana',
63
+ repoOwner: 'elastic',
64
+ });
65
+ expect(execSpy.mock.calls.map(([cmd]) => cmd)).toEqual([
66
+ 'git remote rm origin',
67
+ 'git remote rm sqren_authenticated',
68
+ 'git remote add sqren_authenticated https://x-access-token:myAccessToken@github.com/sqren_authenticated/kibana.git',
69
+ 'git remote rm elastic',
70
+ 'git remote add elastic https://x-access-token:myAccessToken@github.com/elastic/kibana.git',
71
+ ]);
72
+ });
73
+ });
24
74
  });
@@ -0,0 +1,6 @@
1
+ import { Assign } from 'utility-types';
2
+ declare type ExcludeUndefined<T extends Record<string, any>> = Assign<T, Partial<Pick<T, {
3
+ [key in keyof T]-?: undefined extends T[key] ? key : never;
4
+ }[keyof T]>>>;
5
+ export declare function excludeUndefined<T extends Record<string, any>>(obj: T): ExcludeUndefined<T>;
6
+ export {};
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.excludeUndefined = void 0;
4
+ function excludeUndefined(obj) {
5
+ return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined));
6
+ }
7
+ exports.excludeUndefined = excludeUndefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const excludeUndefined_1 = require("./excludeUndefined");
4
+ describe('excludeUndefined', () => {
5
+ it('removes undefined values', () => {
6
+ expect((0, excludeUndefined_1.excludeUndefined)({
7
+ foo: 'foo',
8
+ bar: undefined,
9
+ baz: null,
10
+ })).toEqual({ foo: 'foo', baz: null });
11
+ });
12
+ it('has the correct types after merging', () => {
13
+ const obj = (0, excludeUndefined_1.excludeUndefined)({
14
+ foo: 'foo',
15
+ bar: undefined,
16
+ baz: null,
17
+ });
18
+ const res = {
19
+ bar: 'bar',
20
+ ...obj,
21
+ };
22
+ expect(res).toEqual({ bar: 'bar', foo: 'foo', baz: null });
23
+ });
24
+ });
package/package.json CHANGED
@@ -14,21 +14,16 @@
14
14
  "branches",
15
15
  "branching"
16
16
  ],
17
- "version": "5.6.6",
17
+ "version": "6.1.2",
18
18
  "main": "./dist/entrypoint.module.js",
19
19
  "types": "dist/entrypoint.module.d.ts",
20
20
  "bin": {
21
21
  "backport": "./dist/entrypoint.cli.js"
22
22
  },
23
- "husky": {
24
- "hooks": {
25
- "pre-commit": "lint-staged",
26
- "pre-push": "yarn lint"
27
- }
28
- },
29
23
  "license": "MIT",
30
24
  "scripts": {
31
25
  "lint": "tsc --project ./tsconfig.test.json && eslint './**/*.{ts,js}'",
26
+ "prepare": "husky install",
32
27
  "postinstall": "test -f ./dist/scripts/runPostinstall.js && node ./dist/scripts/runPostinstall.js || echo 'Dist folder missing'",
33
28
  "prepublishOnly": "tsc --project ./tsconfig.prod.json",
34
29
  "test": "jest",
@@ -60,63 +55,54 @@
60
55
  ]
61
56
  },
62
57
  "engines": {
63
- "node": ">=10.0.0"
58
+ "node": ">=16.0.0"
64
59
  },
65
60
  "dependencies": {
66
- "@octokit/rest": "^18.0.12",
67
- "@types/lodash.difference": "^4.5.6",
68
- "@types/lodash.intersection": "^4.4.6",
69
- "axios": "^0.21.1",
61
+ "@octokit/rest": "^18.12.0",
62
+ "axios": "^0.24.0",
70
63
  "dedent": "^0.7.0",
71
64
  "del": "^6.0.0",
72
65
  "find-up": "^5.0.0",
73
- "inquirer": "^7.3.3",
74
- "lodash.difference": "^4.5.0",
75
- "lodash.flatmap": "^4.5.0",
76
- "lodash.intersection": "^4.4.0",
77
- "lodash.isempty": "^4.4.0",
78
- "lodash.isstring": "^4.0.1",
79
- "lodash.uniq": "^4.5.0",
66
+ "inquirer": "^8.2.0",
67
+ "lodash": "^4.17.21",
80
68
  "make-dir": "^3.1.0",
81
- "ora": "^5.3.0",
69
+ "ora": "^5.4.1",
82
70
  "safe-json-stringify": "^1.2.0",
83
71
  "strip-json-comments": "^3.1.1",
72
+ "terminal-link": "^2.1.1",
73
+ "utility-types": "^3.10.0",
84
74
  "winston": "^3.3.3",
85
- "yargs": "^16.2.0"
75
+ "yargs": "^17.3.1"
86
76
  },
87
77
  "devDependencies": {
88
- "@types/core-js": "^2.5.4",
78
+ "@types/core-js": "^2.5.5",
89
79
  "@types/dedent": "^0.7.0",
90
- "@types/inquirer": "^7.3.1",
91
- "@types/jest": "^26.0.20",
92
- "@types/lodash": "^4.14.168",
93
- "@types/lodash.flatmap": "^4.5.6",
94
- "@types/lodash.isempty": "^4.4.6",
95
- "@types/lodash.isstring": "^4.0.6",
96
- "@types/lodash.uniq": "^4.5.6",
97
- "@types/node": "^14.14.22",
80
+ "@types/inquirer": "^8.1.3",
81
+ "@types/jest": "^27.4.0",
82
+ "@types/lodash": "^4.14.178",
83
+ "@types/node": "^16.11.17",
98
84
  "@types/safe-json-stringify": "^1.1.2",
99
- "@types/yargs": "^15.0.12",
100
- "@types/yargs-parser": "^20.2.0",
101
- "@typescript-eslint/eslint-plugin": "^4.14.0",
102
- "@typescript-eslint/parser": "^4.14.0",
103
- "eslint": "^7.18.0",
104
- "eslint-config-prettier": "^7.2.0",
105
- "eslint-plugin-import": "^2.22.1",
106
- "eslint-plugin-jest": "^24.1.3",
107
- "eslint-plugin-prettier": "^3.3.1",
108
- "graphql": "^15.4.0",
109
- "graphql-tag": "^2.11.0",
110
- "husky": "^4.3.8",
111
- "jest": "^26.6.3",
85
+ "@types/yargs": "^17.0.8",
86
+ "@types/yargs-parser": "^20.2.1",
87
+ "@typescript-eslint/eslint-plugin": "^5.9.0",
88
+ "@typescript-eslint/parser": "^5.9.0",
89
+ "eslint": "^8.6.0",
90
+ "eslint-config-prettier": "^8.3.0",
91
+ "eslint-plugin-import": "^2.25.4",
92
+ "eslint-plugin-jest": "^25.3.4",
93
+ "eslint-plugin-prettier": "^4.0.0",
94
+ "graphql": "^16.2.0",
95
+ "graphql-config": "^4.1.0",
96
+ "graphql-tag": "^2.12.6",
97
+ "husky": "^7.0.4",
98
+ "jest": "^27.4.5",
112
99
  "jest-snapshot-serializer-ansi": "^1.0.0",
113
- "lint-staged": "^10.5.3",
114
- "lodash": "^4.17.20",
115
- "nock": "^13.0.6",
116
- "prettier": "^2.2.0",
117
- "strip-ansi": "^6.0.0",
118
- "ts-jest": "^26.4.4",
119
- "ts-node": "^9.1.1",
120
- "typescript": "^4.1.3"
100
+ "lint-staged": "^12.1.5",
101
+ "nock": "^13.2.1",
102
+ "prettier": "^2.5.1",
103
+ "strip-ansi": "^6.0.1",
104
+ "ts-jest": "^27.1.2",
105
+ "ts-node": "^10.4.0",
106
+ "typescript": "^4.5.4"
121
107
  }
122
108
  }