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.
- package/README.md +186 -50
- package/dist/entrypoint.cli.js +3 -1
- package/dist/entrypoint.module.d.ts +18 -5
- package/dist/entrypoint.module.js +42 -12
- package/dist/entrypoint.module.private.test.d.ts +1 -0
- package/dist/entrypoint.module.private.test.js +34 -0
- package/dist/ink.d.ts +1 -0
- package/dist/ink.js +49 -0
- package/dist/main.d.ts +11 -6
- package/dist/main.js +40 -25
- package/dist/options/ConfigOptions.d.ts +28 -13
- package/dist/options/cliArgs.d.ts +36 -35
- package/dist/options/cliArgs.js +91 -52
- package/dist/options/cliArgs.test.js +35 -43
- package/dist/options/config/config.d.ts +35 -57
- package/dist/options/config/config.js +5 -39
- package/dist/options/config/config.test.js +11 -27
- package/dist/options/config/getOptionsFromGit.d.ts +3 -2
- package/dist/options/config/getOptionsFromGit.js +1 -3
- package/dist/options/config/globalConfig.d.ts +2 -51
- package/dist/options/config/globalConfig.js +9 -12
- package/dist/options/config/globalConfig.test.js +7 -5
- package/dist/options/config/projectConfig.d.ts +2 -51
- package/dist/options/config/projectConfig.js +2 -2
- package/dist/options/config/projectConfig.test.js +53 -16
- package/dist/options/config/readConfigFile.d.ts +44 -41
- package/dist/options/config/readConfigFile.js +30 -4
- package/dist/options/options.d.ts +59 -31
- package/dist/options/options.js +103 -10
- package/dist/options/options.test.js +266 -79
- package/dist/options/parseRequiredOptions.d.ts +19 -14
- package/dist/options/parseRequiredOptions.js +9 -15
- package/dist/options/parseRequiredOptions.test.js +30 -26
- package/dist/runSequentially.d.ts +20 -0
- package/dist/runSequentially.js +41 -0
- package/dist/runSequentially.test.d.ts +1 -0
- package/dist/runSequentially.test.js +196 -0
- package/dist/runWithOptions.js +7 -14
- package/dist/runWithOptions.test.js +138 -17
- package/dist/scripts/generate-gql.d.ts +1 -0
- package/dist/scripts/generate-gql.js +15 -0
- package/dist/scripts/postinstall.js +4 -4
- package/dist/scripts/postinstall.test.js +9 -2
- package/dist/scripts/runPostinstall.js +1 -1
- package/dist/services/HandledError.d.ts +11 -1
- package/dist/services/HandledError.js +2 -1
- package/dist/services/child-process-promisified.d.ts +1 -1
- package/dist/services/child-process-promisified.js +1 -1
- package/dist/services/env.js +5 -5
- package/dist/services/env.test.js +11 -4
- package/dist/services/fs-promisified.js +4 -4
- package/dist/services/getExpectedTarget.d.ts +9 -0
- package/dist/services/getExpectedTarget.js +77 -0
- package/dist/services/getExpectedTargetPullRequests.d.ts +9 -0
- package/dist/services/getExpectedTargetPullRequests.js +77 -0
- package/dist/services/git.d.ts +20 -6
- package/dist/services/git.integration.test.d.ts +1 -0
- package/dist/services/git.integration.test.js +168 -0
- package/dist/services/git.js +93 -67
- package/dist/services/git.test.js +68 -68
- package/dist/services/github/commitFormatters.d.ts +3 -7
- package/dist/services/github/commitFormatters.js +10 -19
- package/dist/services/github/commitFormatters.test.js +2 -24
- package/dist/services/github/v3/addAssigneesToPullRequest.d.ts +1 -1
- package/dist/services/github/v3/addAssigneesToPullRequest.js +3 -8
- package/dist/services/github/v3/addAssigneesToPullRequest.test.js +6 -8
- package/dist/services/github/v3/addLabelsToPullRequest.d.ts +1 -1
- package/dist/services/github/v3/addLabelsToPullRequest.js +2 -6
- package/dist/services/github/v3/addReviewersToPullRequest.d.ts +2 -0
- package/dist/services/github/v3/addReviewersToPullRequest.js +34 -0
- package/dist/services/github/v3/createPullRequest.d.ts +3 -2
- package/dist/services/github/v3/createPullRequest.js +31 -25
- package/dist/services/github/v3/createPullRequest.test.d.ts +1 -0
- package/dist/services/github/v3/createPullRequest.test.js +110 -0
- package/dist/services/github/v3/createStatusComment.d.ts +11 -0
- package/dist/services/github/v3/createStatusComment.js +95 -0
- package/dist/services/github/v3/createStatusComment.test.d.ts +1 -0
- package/dist/services/github/v3/createStatusComment.test.js +209 -0
- package/dist/services/github/v4/FetchPullRequestId.js +1 -1
- package/dist/services/github/v4/apiRequestV4.d.ts +2 -2
- package/dist/services/github/v4/apiRequestV4.js +6 -8
- package/dist/services/github/v4/apiRequestV4.test.js +7 -7
- package/dist/services/github/v4/disablePullRequestAutoMerge.js +3 -4
- package/dist/services/github/v4/enablePullRequestAutoMerge.js +9 -8
- package/dist/services/github/v4/enablePullRequestAutoMerge.private.test.js +93 -33
- package/dist/services/github/v4/fetchAuthorId.d.ts +5 -2
- package/dist/services/github/v4/fetchAuthorId.js +6 -7
- package/dist/services/github/v4/fetchAuthorId.private.test.js +6 -9
- package/dist/services/github/v4/fetchCommitByPullNumber.js +11 -9
- package/dist/services/github/v4/fetchCommitByPullNumber.private.test.js +4 -4
- package/dist/services/github/v4/fetchCommitBySha.js +14 -12
- package/dist/services/github/v4/fetchCommitBySha.private.test.js +4 -4
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.d.ts +12 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +46 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +70 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.d.ts +12 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +36 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +55 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +27 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +88 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +128 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +125 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.d.ts +28 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsInDateRange.js +52 -0
- package/dist/services/github/v4/fetchCommits/fetchProjectConfig.d.ts +3 -0
- package/dist/services/github/v4/fetchCommits/fetchProjectConfig.js +55 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.d.ts +10 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +49 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +77 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.test.js +252 -0
- package/dist/services/github/v4/fetchCommitsByAuthor.d.ts +2 -1
- package/dist/services/github/v4/fetchCommitsByAuthor.js +81 -70
- package/dist/services/github/v4/fetchCommitsByAuthor.private.test.js +78 -5
- package/dist/services/github/v4/fetchCommitsByAuthor.test.js +29 -21
- package/dist/services/github/v4/fetchDefaultBranch.js +1 -1
- package/dist/services/github/v4/fetchExistingPullRequest.js +2 -3
- package/dist/services/github/v4/fetchExistingPullRequest.private.test.js +3 -5
- package/dist/services/github/v4/fetchMergedPullRequests.d.ts +18 -19
- package/dist/services/github/v4/fetchMergedPullRequests.js +22 -69
- package/dist/services/github/v4/fetchMergedPullRequests.private.test.js +8 -9
- package/dist/services/github/v4/fetchProjectConfig.d.ts +8 -0
- package/dist/services/github/v4/fetchProjectConfig.js +56 -0
- package/dist/services/github/v4/fetchProjectConfig.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchProjectConfig.private.test.js +52 -0
- package/dist/services/github/v4/fetchProjectConfig.test.d.ts +1 -0
- package/dist/services/github/v4/fetchProjectConfig.test.js +37 -0
- package/dist/services/github/v4/fetchPullRequestAutoMergeMethod.js +2 -3
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.js +12 -10
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.private.test.js +3 -3
- package/dist/services/github/v4/fetchPullRequestBySearchQuery.test.js +2 -2
- package/dist/services/github/v4/getExistingTargetPullRequests.d.ts +4 -58
- package/dist/services/github/v4/getExistingTargetPullRequests.js +3 -58
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +67 -0
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +130 -0
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.d.ts +1 -0
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.private.test.js +130 -0
- package/dist/services/github/v4/getOptionsFromGithub/index.d.ts +19 -11
- package/dist/services/github/v4/getOptionsFromGithub/index.js +52 -22
- package/dist/services/github/v4/getOptionsFromGithub/index.private.test.js +46 -7
- package/dist/services/github/v4/getOptionsFromGithub/query.d.ts +16 -16
- package/dist/services/github/v4/getOptionsFromGithub/query.js +16 -15
- package/dist/services/github/v4/getTargetBranchesFromLabels.d.ts +0 -7
- package/dist/services/github/v4/getTargetBranchesFromLabels.js +1 -26
- package/dist/services/github/v4/getTargetBranchesFromLabels.test.js +69 -32
- package/dist/services/github/v4/mocks/commitsByAuthorMock.d.ts +2 -2
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +39 -25
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.d.ts +1 -1
- package/dist/services/github/v4/mocks/fetchPullRequestBySearchQueryMock.js +10 -0
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.d.ts +1 -1
- package/dist/services/github/v4/mocks/getCommitsByAuthorMock.js +2 -0
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.d.ts +1 -1
- package/dist/services/github/v4/mocks/getPullRequestNodeMock.js +1 -0
- package/dist/services/github/v4/throwOnInvalidAccessToken.js +10 -15
- package/dist/services/github/v4/throwOnInvalidAccessToken.test.js +7 -7
- package/dist/services/logger.d.ts +3 -3
- package/dist/services/logger.js +16 -15
- package/dist/services/prompt.test.d.ts +1 -0
- package/dist/services/prompt.test.js +87 -0
- package/dist/services/prompts.d.ts +10 -4
- package/dist/services/prompts.js +85 -22
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +9 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +92 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.d.ts +1 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +413 -0
- package/dist/services/sourceCommit/getMockSourceCommit.d.ts +21 -0
- package/dist/services/sourceCommit/getMockSourceCommit.js +67 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.d.ts +5 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.js +20 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.d.ts +1 -0
- package/dist/services/sourceCommit/getTargetBranchesFromLabels.test.js +201 -0
- package/dist/services/sourceCommit/parseSourceCommit.d.ts +82 -0
- package/dist/services/sourceCommit/parseSourceCommit.js +96 -0
- package/dist/services/sourceCommit/parseSourceCommit.test.d.ts +1 -0
- package/dist/services/sourceCommit/parseSourceCommit.test.js +229 -0
- package/dist/services/sourceCommit/sourceCommit.d.ts +78 -0
- package/dist/services/sourceCommit/sourceCommit.js +86 -0
- package/dist/services/sourceCommit/sourceCommit.test.d.ts +1 -0
- package/dist/services/sourceCommit/sourceCommit.test.js +287 -0
- package/dist/services/sourceCommit.d.ts +78 -0
- package/dist/services/sourceCommit.js +86 -0
- package/dist/services/sourceCommit.test.d.ts +1 -0
- package/dist/services/sourceCommit.test.js +280 -0
- package/dist/test/inquirer.private.test.js +55 -51
- package/dist/test/integration/createSpies.js +6 -6
- package/dist/test/integration/envConstants.js +5 -6
- package/dist/test/integration/helpers.js +1 -1
- package/dist/test/integration/integration.private.test.d.ts +1 -0
- package/dist/test/integration/integration.private.test.js +327 -0
- package/dist/test/integration/integration.test.js +28 -29
- package/dist/test/mockConfigFiles.d.ts +5 -0
- package/dist/test/mockConfigFiles.js +37 -0
- package/dist/test/nockHelpers.d.ts +1 -1
- package/dist/test/nockHelpers.js +7 -11
- package/dist/test/private/getDevAccessToken.js +1 -1
- package/dist/test/setupFiles/automatic-mocks.d.ts +0 -1
- package/dist/test/setupFiles/automatic-mocks.js +1 -51
- package/dist/types/Commit.d.ts +85 -0
- package/dist/types/Commit.js +139 -0
- package/dist/types/commitNode.d.ts +89 -0
- package/dist/types/commitNode.js +139 -0
- package/dist/types/commitNode.test.d.ts +1 -0
- package/dist/types/commitNode.test.js +255 -0
- package/dist/types/commitWithAssociatedPullRequests.d.ts +86 -0
- package/dist/types/commitWithAssociatedPullRequests.js +145 -0
- package/dist/ui/cherrypickAndCreatePullRequest.test.js +346 -76
- package/dist/ui/cherrypickAndCreateTargetPullRequest.d.ts +2 -1
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +95 -67
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.d.ts +1 -0
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +468 -0
- package/dist/ui/getCommits.d.ts +1 -1
- package/dist/ui/getCommits.js +55 -25
- package/dist/ui/getCommitsWithoutBackports.d.ts +11 -0
- package/dist/ui/getCommitsWithoutBackports.js +53 -0
- package/dist/ui/getTargetBranches.d.ts +3 -2
- package/dist/ui/getTargetBranches.js +33 -18
- package/dist/ui/getTargetBranches.test.js +75 -99
- package/dist/ui/getTargetBranchesFromLabels.d.ts +6 -0
- package/dist/ui/getTargetBranchesFromLabels.js +40 -0
- package/dist/ui/getTargetBranchesFromLabels.test.d.ts +1 -0
- package/dist/ui/getTargetBranchesFromLabels.test.js +288 -0
- package/dist/ui/maybeSetupRepo.js +11 -10
- package/dist/ui/maybeSetupRepo.test.js +54 -4
- package/dist/utils/excludeUndefined.d.ts +6 -0
- package/dist/utils/excludeUndefined.js +7 -0
- package/dist/utils/excludeUndefined.test.d.ts +1 -0
- package/dist/utils/excludeUndefined.test.js +24 -0
- package/package.json +37 -51
- 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.
|
|
35
|
-
await git_1.addRemote(options, options.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
await git_1.
|
|
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": "
|
|
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": ">=
|
|
58
|
+
"node": ">=16.0.0"
|
|
64
59
|
},
|
|
65
60
|
"dependencies": {
|
|
66
|
-
"@octokit/rest": "^18.0
|
|
67
|
-
"
|
|
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": "^
|
|
74
|
-
"lodash
|
|
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.
|
|
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": "^
|
|
75
|
+
"yargs": "^17.3.1"
|
|
86
76
|
},
|
|
87
77
|
"devDependencies": {
|
|
88
|
-
"@types/core-js": "^2.5.
|
|
78
|
+
"@types/core-js": "^2.5.5",
|
|
89
79
|
"@types/dedent": "^0.7.0",
|
|
90
|
-
"@types/inquirer": "^
|
|
91
|
-
"@types/jest": "^
|
|
92
|
-
"@types/lodash": "^4.14.
|
|
93
|
-
"@types/
|
|
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": "^
|
|
100
|
-
"@types/yargs-parser": "^20.2.
|
|
101
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
102
|
-
"@typescript-eslint/parser": "^
|
|
103
|
-
"eslint": "^
|
|
104
|
-
"eslint-config-prettier": "^
|
|
105
|
-
"eslint-plugin-import": "^2.
|
|
106
|
-
"eslint-plugin-jest": "^
|
|
107
|
-
"eslint-plugin-prettier": "^
|
|
108
|
-
"graphql": "^
|
|
109
|
-
"graphql-
|
|
110
|
-
"
|
|
111
|
-
"
|
|
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": "^
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"ts-
|
|
119
|
-
"
|
|
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
|
}
|