backport 6.1.2 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -37
- package/dist/backportRun.d.ts +14 -0
- package/dist/backportRun.js +75 -0
- package/dist/entrypoint.api.d.ts +22 -0
- package/dist/entrypoint.api.js +57 -0
- package/dist/entrypoint.api.private.test.d.ts +1 -0
- package/dist/entrypoint.api.private.test.js +37 -0
- package/dist/entrypoint.module.d.ts +4 -1
- package/dist/entrypoint.module.js +10 -4
- package/dist/entrypoint.module.private.test.js +4 -1
- package/dist/main.js +5 -1
- package/dist/options/ConfigOptions.d.ts +2 -0
- package/dist/options/cliArgs.d.ts +5 -1
- package/dist/options/cliArgs.js +24 -2
- package/dist/options/config/config.d.ts +6 -1
- package/dist/options/config/config.js +2 -2
- package/dist/options/config/config.test.js +1 -1
- package/dist/options/config/getProjectConfig.d.ts +0 -0
- package/dist/options/config/getProjectConfig.js +1 -0
- package/dist/options/config/globalConfig.d.ts +1 -1
- package/dist/options/config/globalConfig.js +4 -8
- package/dist/options/config/globalConfig.test.js +2 -2
- package/dist/options/config/readConfigFile.d.ts +3 -1
- package/dist/options/options.d.ts +8 -1
- package/dist/options/options.js +9 -2
- package/dist/options/options.test.js +7 -3
- package/dist/react-components/0-loadOptions.d.ts +6 -0
- package/dist/react-components/0-loadOptions.js +45 -0
- package/dist/react-components/1-loadCommit.d.ts +8 -0
- package/dist/react-components/1-loadCommit.js +88 -0
- package/dist/react-components/1a-loadCommit.d.ts +5 -0
- package/dist/react-components/1a-loadCommit.js +76 -0
- package/dist/react-components/1b-commitChoices.d.ts +5 -0
- package/dist/react-components/1b-commitChoices.js +98 -0
- package/dist/react-components/2-commitChoices.d.ts +8 -0
- package/dist/react-components/2-commitChoices.js +96 -0
- package/dist/react-components/2-commitsPrompt.d.ts +8 -0
- package/dist/react-components/2-commitsPrompt.js +96 -0
- package/dist/react-components/2-targetBranchChoices.d.ts +9 -0
- package/dist/react-components/2-targetBranchChoices.js +109 -0
- package/dist/react-components/3-cherrypick.d.ts +1 -0
- package/dist/react-components/3-cherrypick.js +2 -0
- package/dist/react-components/App.d.ts +2 -0
- package/dist/react-components/App.js +35 -0
- package/dist/react-components/BackportStateContext.d.ts +33 -0
- package/dist/react-components/BackportStateContext.js +42 -0
- package/dist/react-components/CommitPrompt/2-commitsPrompt.d.ts +8 -0
- package/dist/react-components/CommitPrompt/2-commitsPrompt.js +96 -0
- package/dist/react-components/CommitPrompt/CommitPrompt.d.ts +8 -0
- package/dist/react-components/CommitPrompt/CommitPrompt.js +96 -0
- package/dist/react-components/CommitPrompt/getCommits.d.ts +2 -0
- package/dist/react-components/CommitPrompt/getCommits.js +27 -0
- package/dist/react-components/CommitPrompt.d.ts +8 -0
- package/dist/react-components/CommitPrompt.js +96 -0
- package/dist/react-components/CustomMultiSelect.d.ts +13 -0
- package/dist/react-components/CustomMultiSelect.js +21 -0
- package/dist/react-components/CustomMultiSelectItem.d.ts +5 -0
- package/dist/react-components/CustomMultiSelectItem.js +12 -0
- package/dist/react-components/CustomSelect.d.ts +14 -0
- package/dist/react-components/CustomSelect.js +34 -0
- package/dist/react-components/ErrorBoundary.d.ts +15 -0
- package/dist/react-components/ErrorBoundary.js +53 -0
- package/dist/react-components/MultiSelect.d.ts +7 -0
- package/dist/react-components/MultiSelect.js +16 -0
- package/dist/react-components/hooks/useAsync.d.ts +12 -0
- package/dist/react-components/hooks/useAsync.js +73 -0
- package/dist/runSequentially.test.js +10 -7
- package/dist/services/HandledError.d.ts +1 -1
- package/dist/services/backportRun/backportRun.ci.d.ts +6 -0
- package/dist/services/backportRun/backportRun.ci.js +81 -0
- package/dist/services/backportRun/backportRun.d.ts +14 -0
- package/dist/services/backportRun/backportRun.interactive.d.ts +1 -0
- package/dist/services/backportRun/backportRun.interactive.js +4 -0
- package/dist/services/backportRun/backportRun.js +14 -0
- package/dist/services/backportRun/backportState.d.ts +4 -0
- package/dist/services/backportRun/backportState.js +28 -0
- package/dist/services/backportRun/getCommits.d.ts +2 -0
- package/dist/services/backportRun/getCommits.js +20 -0
- package/dist/services/backportRun/runSequentially.d.ts +20 -0
- package/dist/services/backportRun/runSequentially.js +41 -0
- package/dist/services/backportRun/runSequentially.test.d.ts +1 -0
- package/dist/services/backportRun/runSequentially.test.js +199 -0
- package/dist/services/cherrypickAndCreateTargetPullRequest.d.ts +12 -0
- package/dist/services/cherrypickAndCreateTargetPullRequest.js +206 -0
- package/dist/services/cherrypickAndCreateTargetPullRequest.test.d.ts +1 -0
- package/dist/services/cherrypickAndCreateTargetPullRequest.test.js +403 -0
- package/dist/services/env.d.ts +2 -3
- package/dist/services/env.js +9 -10
- package/dist/services/env.test.js +0 -6
- package/dist/services/getCommits.d.ts +2 -0
- package/dist/services/getCommits.js +38 -0
- package/dist/services/getCommitsWithoutBackports.d.ts +11 -0
- package/dist/services/getCommitsWithoutBackports.js +68 -0
- package/dist/services/getCommitsWithoutBackports.test.d.ts +1 -0
- package/dist/services/getCommitsWithoutBackports.test.js +259 -0
- package/dist/services/getTargetBranches.d.ts +5 -0
- package/dist/services/getTargetBranches.js +60 -0
- package/dist/services/getTargetBranches.test.d.ts +1 -0
- package/dist/services/getTargetBranches.test.js +180 -0
- package/dist/services/git.d.ts +2 -1
- package/dist/services/git.js +5 -3
- package/dist/services/github/v3/createPullRequest.js +1 -1
- package/dist/services/github/v3/createPullRequest.test.js +3 -3
- package/dist/services/github/v3/createStatusComment.d.ts +1 -1
- package/dist/services/github/v3/createStatusComment.js +40 -15
- package/dist/services/github/v3/createStatusComment.test.js +190 -73
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchCommits/allFetchers.private.test.js +78 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.js +1 -1
- package/dist/services/github/v4/fetchCommits/fetchCommitByPullNumber.private.test.js +64 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.js +5 -5
- package/dist/services/github/v4/fetchCommits/fetchCommitBySha.private.test.js +60 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.d.ts +2 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.js +17 -10
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.private.test.js +72 -0
- package/dist/services/github/v4/fetchCommits/fetchCommitsByAuthor.test.js +6 -0
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.js +8 -7
- package/dist/services/github/v4/fetchCommits/fetchPullRequestBySearchQuery.private.test.js +8 -0
- package/dist/services/github/v4/fetchProjectConfig.d.ts +1 -1
- package/dist/services/github/v4/fetchProjectConfig.js +3 -3
- package/dist/services/github/v4/fetchProjectConfig.private.test.js +5 -5
- package/dist/services/github/v4/fetchRemoteProjectConfig.d.ts +8 -0
- package/dist/services/github/v4/fetchRemoteProjectConfig.js +56 -0
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.d.ts +1 -0
- package/dist/services/github/v4/fetchRemoteProjectConfig.private.test.js +52 -0
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +2 -0
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +0 -7
- package/dist/services/github/v4/mocks/commitsByAuthorMock.js +16 -5
- package/dist/services/logger.d.ts +0 -1
- package/dist/services/logger.js +3 -3
- package/dist/services/maybeSetupRepo.d.ts +2 -0
- package/dist/services/maybeSetupRepo.js +33 -0
- package/dist/services/maybeSetupRepo.test.d.ts +1 -0
- package/dist/services/maybeSetupRepo.test.js +78 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.d.ts +4 -0
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.js +8 -2
- package/dist/services/sourceCommit/getExpectedTargetPullRequests.test.js +20 -0
- package/dist/services/sourceCommit/getMockSourceCommit.d.ts +1 -0
- package/dist/services/sourceCommit/getMockSourceCommit.js +72 -46
- package/dist/services/sourceCommit/parseSourceCommit.d.ts +22 -8
- package/dist/services/sourceCommit/parseSourceCommit.js +29 -10
- package/dist/services/sourceCommit/parseSourceCommit.test.js +10 -2
- package/dist/test/backport-e2e.private.test.d.ts +1 -0
- package/dist/test/backport-e2e.private.test.js +327 -0
- package/dist/test/handleUnbackportedPullRequests.private.test.d.ts +1 -0
- package/dist/test/handleUnbackportedPullRequests.private.test.js +43 -0
- package/dist/test/inquirer.private.test.js +1 -1
- package/dist/test/integration/integration.private.test.js +2 -2
- package/dist/test/nockHelpers.js +1 -3
- package/dist/test/setupFiles/automatic-mocks.js +1 -0
- package/dist/todo-delete.d.ts +1 -0
- package/dist/todo-delete.js +17 -0
- package/dist/ui/cherrypickAndCreateTargetPullRequest.js +4 -3
- package/dist/ui/cherrypickAndCreateTargetPullRequest.test.js +224 -260
- package/dist/ui/getCommits.js +1 -1
- package/dist/ui/getCommitsWithoutBackports.js +17 -2
- package/dist/ui/getCommitsWithoutBackports.test.d.ts +1 -0
- package/dist/ui/getCommitsWithoutBackports.test.js +259 -0
- package/dist/ui/maybeSetupRepo.js +0 -6
- package/dist/ui/maybeSetupRepo.test.js +8 -4
- package/dist/utils/redact.d.ts +1 -0
- package/dist/utils/redact.js +7 -0
- package/dist/utils/sequentially.d.ts +1 -0
- package/dist/utils/sequentially.js +10 -0
- package/package.json +3 -3
- package/yarn.lock +462 -284
package/README.md
CHANGED
|
@@ -67,42 +67,44 @@ See [configuration.md](https://github.com/sqren/backport/blob/master/docs/config
|
|
|
67
67
|
|
|
68
68
|
### CLI options
|
|
69
69
|
|
|
70
|
-
| Option | Shorthand notation | Description
|
|
71
|
-
| ------------------- | ------------------ |
|
|
72
|
-
| --access-token | | Github access token
|
|
73
|
-
| --all | -a | Show commits from any author
|
|
74
|
-
| --assignee | --assign | Assign users to the target PR
|
|
75
|
-
| --author | | Filter commits by Github username. Opposite of `--all`
|
|
76
|
-
| --auto-assign | | Assign current user to the target PR
|
|
77
|
-
| --branch | -b | Target branch to backport to
|
|
78
|
-
| --ci | | Disable interactive prompts
|
|
79
|
-
| --
|
|
80
|
-
| --
|
|
81
|
-
| --
|
|
82
|
-
| --
|
|
83
|
-
| --
|
|
84
|
-
| --
|
|
85
|
-
| --
|
|
86
|
-
| --multiple
|
|
87
|
-
| --multiple-
|
|
88
|
-
| --
|
|
89
|
-
| --no-
|
|
90
|
-
| --
|
|
91
|
-
| --
|
|
92
|
-
| --
|
|
93
|
-
| --pr-
|
|
94
|
-
| --
|
|
95
|
-
| --
|
|
96
|
-
| --
|
|
97
|
-
| --
|
|
98
|
-
| --
|
|
99
|
-
| --
|
|
100
|
-
| --
|
|
101
|
-
| --
|
|
102
|
-
| --
|
|
103
|
-
| --
|
|
104
|
-
| --
|
|
105
|
-
| -
|
|
70
|
+
| Option | Shorthand notation | Description | Default |
|
|
71
|
+
| ------------------- | ------------------ | -------------------------------------------------------------------------- | ------------------------- |
|
|
72
|
+
| --access-token | | Github access token | |
|
|
73
|
+
| --all | -a | Show commits from any author | false |
|
|
74
|
+
| --assignee | --assign | Assign users to the target PR | |
|
|
75
|
+
| --author | | Filter commits by Github username. Opposite of `--all` | _Current user_ |
|
|
76
|
+
| --auto-assign | | Assign current user to the target PR | false |
|
|
77
|
+
| --branch | -b | Target branch to backport to | |
|
|
78
|
+
| --ci | | Disable interactive prompts | false |
|
|
79
|
+
| --dir | | Clone repository into custom directory | ~/.backport/repositories/ |
|
|
80
|
+
| --dry-run | | Perform backport without pushing to Github | false |
|
|
81
|
+
| --editor | | Editor (eg. `code`) to open and resolve conflicts | nano |
|
|
82
|
+
| --fork | | Create backports in fork repo | true |
|
|
83
|
+
| --git-hostname | | Hostname for Git | github.com |
|
|
84
|
+
| --mainline | | Parent id of merge commit | 1 |
|
|
85
|
+
| --max-number | --number, -n | Number of commits to choose from | 10 |
|
|
86
|
+
| --multiple | | Multi-select for commits and branches | false |
|
|
87
|
+
| --multiple-branches | | Multi-select for branches | true |
|
|
88
|
+
| --multiple-commits | | Multi-select for commits | false |
|
|
89
|
+
| --no-cherrypick-ref | | Do not append "(cherry picked from commit...)". [Git Docs][1] | false |
|
|
90
|
+
| --no-status-comment | | Do not publish a status comment to Github with the results of the backport | false |
|
|
91
|
+
| --no-verify | | Bypass the pre-commit and commit-msg hooks | false |
|
|
92
|
+
| --path | -p | Filter commits by path | |
|
|
93
|
+
| --pr-description | --description | Pull request description suffix | |
|
|
94
|
+
| --pr-filter | | Find PRs using [Github's search syntax][2] | |
|
|
95
|
+
| --pr-title | --title | Title of pull request | |
|
|
96
|
+
| --pull-number | --pr | Backport pull request by number | |
|
|
97
|
+
| --repo-name | | Name of repository | |
|
|
98
|
+
| --repo-owner | | Owner of repository | |
|
|
99
|
+
| --reset-author | | Set yourself as commit author | |
|
|
100
|
+
| --reviewer | | Add reviewer to the target PR | |
|
|
101
|
+
| --sha | | Sha of commit to backport | |
|
|
102
|
+
| --source-branch | | Specify a non-default branch to backport from | |
|
|
103
|
+
| --source-pr-label | | Labels added to the source PR | |
|
|
104
|
+
| --target-branch | -b | Target branch(es) to backport to | |
|
|
105
|
+
| --target-pr-label | --label, -l | Labels added to the target PR | |
|
|
106
|
+
| --help | | Show help | |
|
|
107
|
+
| -v, --version | | Show version number | |
|
|
106
108
|
|
|
107
109
|
The CLI options will override the [configuration options](https://github.com/sqren/backport/blob/master/docs/configuration.md).
|
|
108
110
|
|
|
@@ -238,7 +240,7 @@ This tools is for anybody who is working on a codebase where they have to mainta
|
|
|
238
240
|
- ability to see which commits have been backported and to which branches
|
|
239
241
|
- ability to customize the title, description and labels of the created backport PRs
|
|
240
242
|
- all git operations are handled in a separate directory to not interfere with unstaged files
|
|
241
|
-
- Conflicts are handled gracefully, and hints are provided to help the user understand the source of the conflict
|
|
243
|
+
- Conflicts are handled gracefully, and hints are provided to help the user understand the source of the conflict
|
|
242
244
|
- backport a commit by specifying a PR: `backport --pr 1337`
|
|
243
245
|
- list and backport commits by a particular user: `backport --author john`
|
|
244
246
|
- list and backport commits by a particular path: `backport --path src/plugins/chatbot`
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ConfigFileOptions } from './options/ConfigOptions';
|
|
2
|
+
import { Result } from './runSequentially';
|
|
3
|
+
import { Commit } from './services/sourceCommit/parseSourceCommit';
|
|
4
|
+
export declare type BackportResponse = {
|
|
5
|
+
status: 'success';
|
|
6
|
+
commits: Commit[];
|
|
7
|
+
results: Result[];
|
|
8
|
+
} | {
|
|
9
|
+
status: 'failure';
|
|
10
|
+
commits: Commit[];
|
|
11
|
+
errorMessage: string;
|
|
12
|
+
error: Error;
|
|
13
|
+
};
|
|
14
|
+
export declare function backportRun(processArgs: string[], optionsFromModule?: ConfigFileOptions): Promise<BackportResponse>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.backportRun = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const ora_1 = __importDefault(require("ora"));
|
|
9
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
10
|
+
const options_1 = require("./options/options");
|
|
11
|
+
const runSequentially_1 = require("./runSequentially");
|
|
12
|
+
const HandledError_1 = require("./services/HandledError");
|
|
13
|
+
const env_1 = require("./services/env");
|
|
14
|
+
const createStatusComment_1 = require("./services/github/v3/createStatusComment");
|
|
15
|
+
const logger_1 = require("./services/logger");
|
|
16
|
+
const getCommits_1 = require("./ui/getCommits");
|
|
17
|
+
const getTargetBranches_1 = require("./ui/getTargetBranches");
|
|
18
|
+
async function backportRun(processArgs, optionsFromModule = {}) {
|
|
19
|
+
const argv = (0, yargs_1.default)(processArgs).argv;
|
|
20
|
+
const ci = argv.ci ?? optionsFromModule.ci;
|
|
21
|
+
const logFilePath = argv.logFilePath ?? optionsFromModule.logFilePath;
|
|
22
|
+
(0, logger_1.initLogger)({ ci, logFilePath });
|
|
23
|
+
const spinner = (0, ora_1.default)().start('Initializing...');
|
|
24
|
+
let options = null;
|
|
25
|
+
let commits = [];
|
|
26
|
+
try {
|
|
27
|
+
options = await (0, options_1.getOptions)(processArgs, optionsFromModule);
|
|
28
|
+
spinner.stop();
|
|
29
|
+
commits = await (0, getCommits_1.getCommits)(options);
|
|
30
|
+
const targetBranches = await (0, getTargetBranches_1.getTargetBranches)(options, commits);
|
|
31
|
+
const results = await (0, runSequentially_1.runSequentially)({ options, commits, targetBranches });
|
|
32
|
+
const backportResponse = {
|
|
33
|
+
status: 'success',
|
|
34
|
+
commits,
|
|
35
|
+
results,
|
|
36
|
+
};
|
|
37
|
+
await (0, createStatusComment_1.createStatusComment)({
|
|
38
|
+
options,
|
|
39
|
+
backportResponse,
|
|
40
|
+
});
|
|
41
|
+
return backportResponse;
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
spinner.stop();
|
|
45
|
+
const backportResponse = {
|
|
46
|
+
status: 'failure',
|
|
47
|
+
commits,
|
|
48
|
+
errorMessage: e.message,
|
|
49
|
+
error: e,
|
|
50
|
+
};
|
|
51
|
+
if (options) {
|
|
52
|
+
await (0, createStatusComment_1.createStatusComment)({
|
|
53
|
+
options,
|
|
54
|
+
backportResponse,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (e instanceof HandledError_1.HandledError) {
|
|
58
|
+
(0, logger_1.consoleLog)(e.message);
|
|
59
|
+
}
|
|
60
|
+
else if (e instanceof Error) {
|
|
61
|
+
// output
|
|
62
|
+
(0, logger_1.consoleLog)('\n');
|
|
63
|
+
(0, logger_1.consoleLog)(chalk_1.default.bold('⚠️ Ouch! An unhandled error occured 😿'));
|
|
64
|
+
(0, logger_1.consoleLog)(`Error message: ${e.message}`);
|
|
65
|
+
(0, logger_1.consoleLog)('Please open an issue in https://github.com/sqren/backport/issues or contact me directly on https://twitter.com/sorenlouv');
|
|
66
|
+
(0, logger_1.consoleLog)(chalk_1.default.italic(`For additional details see the logs: ${(0, env_1.getLogfilePath)({
|
|
67
|
+
logFilePath,
|
|
68
|
+
})}`));
|
|
69
|
+
// log file
|
|
70
|
+
logger_1.logger.info('Unknown error:', e);
|
|
71
|
+
}
|
|
72
|
+
return backportResponse;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.backportRun = backportRun;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ConfigFileOptions } from './options/ConfigOptions';
|
|
2
|
+
import { ValidConfigOptions } from './options/options';
|
|
3
|
+
export { BackportResponse } from './services/backportRun/backportRun';
|
|
4
|
+
export { ConfigFileOptions } from './options/ConfigOptions';
|
|
5
|
+
export { Commit } from './services/sourceCommit/parseSourceCommit';
|
|
6
|
+
export { fetchRemoteProjectConfig as getRemoteProjectConfig } from './services/github/v4/fetchRemoteProjectConfig';
|
|
7
|
+
export { getGlobalConfig as getLocalGlobalConfig } from './options/config/globalConfig';
|
|
8
|
+
export declare function backportRun(options: ConfigFileOptions, args?: string[]): Promise<import("./services/backportRun/backportRun").BackportResponse | undefined>;
|
|
9
|
+
export declare function getCommits(options: {
|
|
10
|
+
accessToken: string;
|
|
11
|
+
repoName: string;
|
|
12
|
+
repoOwner: string;
|
|
13
|
+
author?: string;
|
|
14
|
+
branchLabelMapping?: ValidConfigOptions['branchLabelMapping'];
|
|
15
|
+
githubApiBaseUrlV4?: string;
|
|
16
|
+
pullNumber?: number;
|
|
17
|
+
sha?: string;
|
|
18
|
+
skipRemoteConfig?: boolean;
|
|
19
|
+
sourceBranch?: string;
|
|
20
|
+
dateUntil?: string;
|
|
21
|
+
dateSince?: string;
|
|
22
|
+
}): Promise<import("./services/sourceCommit/parseSourceCommit").Commit[]>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCommits = exports.backportRun = exports.getLocalGlobalConfig = exports.getRemoteProjectConfig = void 0;
|
|
4
|
+
const backportRun_1 = require("./services/backportRun/backportRun");
|
|
5
|
+
const fetchCommitByPullNumber_1 = require("./services/github/v4/fetchCommits/fetchCommitByPullNumber");
|
|
6
|
+
const fetchCommitBySha_1 = require("./services/github/v4/fetchCommits/fetchCommitBySha");
|
|
7
|
+
const fetchCommitsByAuthor_1 = require("./services/github/v4/fetchCommits/fetchCommitsByAuthor");
|
|
8
|
+
const getOptionsFromGithub_1 = require("./services/github/v4/getOptionsFromGithub/getOptionsFromGithub");
|
|
9
|
+
const logger_1 = require("./services/logger");
|
|
10
|
+
const excludeUndefined_1 = require("./utils/excludeUndefined");
|
|
11
|
+
(0, logger_1.initLogger)();
|
|
12
|
+
var fetchRemoteProjectConfig_1 = require("./services/github/v4/fetchRemoteProjectConfig");
|
|
13
|
+
Object.defineProperty(exports, "getRemoteProjectConfig", { enumerable: true, get: function () { return fetchRemoteProjectConfig_1.fetchRemoteProjectConfig; } });
|
|
14
|
+
var globalConfig_1 = require("./options/config/globalConfig");
|
|
15
|
+
Object.defineProperty(exports, "getLocalGlobalConfig", { enumerable: true, get: function () { return globalConfig_1.getGlobalConfig; } });
|
|
16
|
+
function backportRun(options,
|
|
17
|
+
// cli args will not automatically be forwarded when it is consumed as a module
|
|
18
|
+
// It is simple to forward args manually via `process.argv`:
|
|
19
|
+
//
|
|
20
|
+
// import { backportRun } from `backport
|
|
21
|
+
// const args = process.argv.slice(2);
|
|
22
|
+
// backportRun(options, args)
|
|
23
|
+
//
|
|
24
|
+
args = []) {
|
|
25
|
+
return (0, backportRun_1.backportRun)(args, (0, excludeUndefined_1.excludeUndefined)(options));
|
|
26
|
+
}
|
|
27
|
+
exports.backportRun = backportRun;
|
|
28
|
+
async function getCommits(options) {
|
|
29
|
+
const optionsFromGithub = await (0, getOptionsFromGithub_1.getOptionsFromGithub)(options);
|
|
30
|
+
if (options.pullNumber) {
|
|
31
|
+
return [
|
|
32
|
+
await (0, fetchCommitByPullNumber_1.fetchCommitByPullNumber)({
|
|
33
|
+
...optionsFromGithub,
|
|
34
|
+
...options,
|
|
35
|
+
pullNumber: options.pullNumber,
|
|
36
|
+
}),
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
if (options.sha) {
|
|
40
|
+
return [
|
|
41
|
+
await (0, fetchCommitBySha_1.fetchCommitBySha)({
|
|
42
|
+
...optionsFromGithub,
|
|
43
|
+
...options,
|
|
44
|
+
sha: options.sha,
|
|
45
|
+
}),
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
return (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
|
|
49
|
+
...optionsFromGithub,
|
|
50
|
+
...options,
|
|
51
|
+
// filters
|
|
52
|
+
author: options.author ?? null,
|
|
53
|
+
dateSince: options.dateSince ?? null,
|
|
54
|
+
dateUntil: options.dateUntil ?? null,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
exports.getCommits = getCommits;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const entrypoint_api_1 = require("./entrypoint.api");
|
|
4
|
+
const getDevAccessToken_1 = require("./test/private/getDevAccessToken");
|
|
5
|
+
describe('entrypoint.api', () => {
|
|
6
|
+
it('getCommits', async () => {
|
|
7
|
+
const accessToken = await (0, getDevAccessToken_1.getDevAccessToken)();
|
|
8
|
+
const commits = await (0, entrypoint_api_1.getCommits)({
|
|
9
|
+
accessToken: accessToken,
|
|
10
|
+
repoName: 'backport-e2e',
|
|
11
|
+
repoOwner: 'backport-org',
|
|
12
|
+
pullNumber: 2,
|
|
13
|
+
});
|
|
14
|
+
expect(commits).toEqual([
|
|
15
|
+
{
|
|
16
|
+
committedDate: '2020-08-15T10:44:04Z',
|
|
17
|
+
expectedTargetPullRequests: [
|
|
18
|
+
{
|
|
19
|
+
branch: '7.x',
|
|
20
|
+
number: 4,
|
|
21
|
+
state: 'MERGED',
|
|
22
|
+
url: 'https://github.com/backport-org/backport-e2e/pull/4',
|
|
23
|
+
mergeCommit: {
|
|
24
|
+
message: 'Add family emoji (#2) (#4)',
|
|
25
|
+
sha: 'f8b4f6ae7ffaf2732fa5e33e98b3ea772bdfff1d',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
originalMessage: 'Add family emoji (#2)',
|
|
30
|
+
pullNumber: 2,
|
|
31
|
+
pullUrl: 'https://github.com/backport-org/backport-e2e/pull/2',
|
|
32
|
+
sha: '59d6ff1ca90a4ce210c0a4f0e159214875c19d60',
|
|
33
|
+
sourceBranch: 'master',
|
|
34
|
+
},
|
|
35
|
+
]);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -3,7 +3,8 @@ import { ValidConfigOptions } from './options/options';
|
|
|
3
3
|
export { BackportResponse } from './main';
|
|
4
4
|
export { ConfigFileOptions } from './options/ConfigOptions';
|
|
5
5
|
export { Commit } from './services/sourceCommit/parseSourceCommit';
|
|
6
|
-
export {
|
|
6
|
+
export { fetchRemoteProjectConfig as getRemoteProjectConfig } from './services/github/v4/fetchRemoteProjectConfig';
|
|
7
|
+
export { getGlobalConfig as getLocalGlobalConfig } from './options/config/globalConfig';
|
|
7
8
|
export declare function backportRun(options: ConfigFileOptions, args?: string[]): Promise<import("./main").BackportResponse>;
|
|
8
9
|
export declare function getCommits(options: {
|
|
9
10
|
accessToken: string;
|
|
@@ -16,4 +17,6 @@ export declare function getCommits(options: {
|
|
|
16
17
|
sha?: string;
|
|
17
18
|
skipRemoteConfig?: boolean;
|
|
18
19
|
sourceBranch?: string;
|
|
20
|
+
dateUntil?: string;
|
|
21
|
+
dateSince?: string;
|
|
19
22
|
}): Promise<import("./services/sourceCommit/parseSourceCommit").Commit[]>;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCommits = exports.backportRun = exports.
|
|
3
|
+
exports.getCommits = exports.backportRun = exports.getLocalGlobalConfig = exports.getRemoteProjectConfig = void 0;
|
|
4
4
|
const main_1 = require("./main");
|
|
5
5
|
const fetchCommitByPullNumber_1 = require("./services/github/v4/fetchCommits/fetchCommitByPullNumber");
|
|
6
6
|
const fetchCommitBySha_1 = require("./services/github/v4/fetchCommits/fetchCommitBySha");
|
|
7
7
|
const fetchCommitsByAuthor_1 = require("./services/github/v4/fetchCommits/fetchCommitsByAuthor");
|
|
8
8
|
const getOptionsFromGithub_1 = require("./services/github/v4/getOptionsFromGithub/getOptionsFromGithub");
|
|
9
9
|
const logger_1 = require("./services/logger");
|
|
10
|
+
const excludeUndefined_1 = require("./utils/excludeUndefined");
|
|
10
11
|
(0, logger_1.initLogger)();
|
|
11
|
-
var
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
var fetchRemoteProjectConfig_1 = require("./services/github/v4/fetchRemoteProjectConfig");
|
|
13
|
+
Object.defineProperty(exports, "getRemoteProjectConfig", { enumerable: true, get: function () { return fetchRemoteProjectConfig_1.fetchRemoteProjectConfig; } });
|
|
14
|
+
var globalConfig_1 = require("./options/config/globalConfig");
|
|
15
|
+
Object.defineProperty(exports, "getLocalGlobalConfig", { enumerable: true, get: function () { return globalConfig_1.getGlobalConfig; } });
|
|
13
16
|
function backportRun(options,
|
|
14
17
|
// cli args will not automatically be forwarded when it is consumed as a module
|
|
15
18
|
// It is simple to forward args manually via `process.argv`:
|
|
@@ -19,7 +22,7 @@ function backportRun(options,
|
|
|
19
22
|
// backportRun(options, args)
|
|
20
23
|
//
|
|
21
24
|
args = []) {
|
|
22
|
-
return (0, main_1.main)(args, options);
|
|
25
|
+
return (0, main_1.main)(args, (0, excludeUndefined_1.excludeUndefined)(options));
|
|
23
26
|
}
|
|
24
27
|
exports.backportRun = backportRun;
|
|
25
28
|
async function getCommits(options) {
|
|
@@ -45,7 +48,10 @@ async function getCommits(options) {
|
|
|
45
48
|
return (0, fetchCommitsByAuthor_1.fetchCommitsByAuthor)({
|
|
46
49
|
...optionsFromGithub,
|
|
47
50
|
...options,
|
|
51
|
+
// filters
|
|
48
52
|
author: options.author ?? null,
|
|
53
|
+
dateSince: options.dateSince ?? null,
|
|
54
|
+
dateUntil: options.dateUntil ?? null,
|
|
49
55
|
});
|
|
50
56
|
}
|
|
51
57
|
exports.getCommits = getCommits;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
jest.unmock('./services/logger');
|
|
4
3
|
const entrypoint_module_1 = require("./entrypoint.module");
|
|
5
4
|
const getDevAccessToken_1 = require("./test/private/getDevAccessToken");
|
|
6
5
|
describe('entrypoint.module', () => {
|
|
@@ -21,6 +20,10 @@ describe('entrypoint.module', () => {
|
|
|
21
20
|
number: 4,
|
|
22
21
|
state: 'MERGED',
|
|
23
22
|
url: 'https://github.com/backport-org/backport-e2e/pull/4',
|
|
23
|
+
mergeCommit: {
|
|
24
|
+
message: 'Add family emoji (#2) (#4)',
|
|
25
|
+
sha: 'f8b4f6ae7ffaf2732fa5e33e98b3ea772bdfff1d',
|
|
26
|
+
},
|
|
24
27
|
},
|
|
25
28
|
],
|
|
26
29
|
originalMessage: 'Add family emoji (#2)',
|
package/dist/main.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.main = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const ora_1 = __importDefault(require("ora"));
|
|
8
9
|
const options_1 = require("./options/options");
|
|
9
10
|
const runSequentially_1 = require("./runSequentially");
|
|
10
11
|
const HandledError_1 = require("./services/HandledError");
|
|
@@ -14,10 +15,12 @@ const logger_1 = require("./services/logger");
|
|
|
14
15
|
const getCommits_1 = require("./ui/getCommits");
|
|
15
16
|
const getTargetBranches_1 = require("./ui/getTargetBranches");
|
|
16
17
|
async function main(argv, optionsFromModule) {
|
|
18
|
+
const spinner = (0, ora_1.default)().start('Initializing...');
|
|
17
19
|
let options = null;
|
|
18
20
|
let commits = [];
|
|
19
21
|
try {
|
|
20
22
|
options = await (0, options_1.getOptions)(argv, optionsFromModule);
|
|
23
|
+
spinner.stop();
|
|
21
24
|
commits = await (0, getCommits_1.getCommits)(options);
|
|
22
25
|
const targetBranches = await (0, getTargetBranches_1.getTargetBranches)(options, commits);
|
|
23
26
|
const results = await (0, runSequentially_1.runSequentially)({ options, commits, targetBranches });
|
|
@@ -33,13 +36,14 @@ async function main(argv, optionsFromModule) {
|
|
|
33
36
|
return backportResponse;
|
|
34
37
|
}
|
|
35
38
|
catch (e) {
|
|
39
|
+
spinner.stop();
|
|
36
40
|
const backportResponse = {
|
|
37
41
|
status: 'failure',
|
|
38
42
|
commits,
|
|
39
43
|
errorMessage: e.message,
|
|
40
44
|
error: e,
|
|
41
45
|
};
|
|
42
|
-
if (options
|
|
46
|
+
if (options) {
|
|
43
47
|
await (0, createStatusComment_1.createStatusComment)({
|
|
44
48
|
options,
|
|
45
49
|
backportResponse,
|
|
@@ -22,6 +22,7 @@ declare type Options = Partial<{
|
|
|
22
22
|
cherrypickRef: boolean;
|
|
23
23
|
ci: boolean;
|
|
24
24
|
commitPaths: string[];
|
|
25
|
+
dir: string;
|
|
25
26
|
details: boolean;
|
|
26
27
|
editor: string;
|
|
27
28
|
fork: boolean;
|
|
@@ -36,6 +37,7 @@ declare type Options = Partial<{
|
|
|
36
37
|
prDescription: string;
|
|
37
38
|
prFilter: string;
|
|
38
39
|
prTitle: string;
|
|
40
|
+
publishStatusComment: boolean;
|
|
39
41
|
pullNumber: number;
|
|
40
42
|
repoName: string;
|
|
41
43
|
repoOwner: string;
|
|
@@ -3,7 +3,9 @@ export declare function getOptionsFromCliArgs(argv: readonly string[], { exitOnE
|
|
|
3
3
|
exitOnError?: boolean;
|
|
4
4
|
}): {
|
|
5
5
|
fork?: boolean | undefined;
|
|
6
|
+
dir?: string | undefined;
|
|
6
7
|
verbose?: boolean | undefined;
|
|
8
|
+
ci?: boolean | undefined;
|
|
7
9
|
accessToken?: string | undefined;
|
|
8
10
|
assignees?: string[] | undefined;
|
|
9
11
|
author?: string | null | undefined;
|
|
@@ -11,7 +13,6 @@ export declare function getOptionsFromCliArgs(argv: readonly string[], { exitOnE
|
|
|
11
13
|
autoMerge?: boolean | undefined;
|
|
12
14
|
autoMergeMethod?: string | undefined;
|
|
13
15
|
cherrypickRef?: boolean | undefined;
|
|
14
|
-
ci?: boolean | undefined;
|
|
15
16
|
commitPaths?: string[] | undefined;
|
|
16
17
|
details?: boolean | undefined;
|
|
17
18
|
editor?: string | undefined;
|
|
@@ -25,6 +26,7 @@ export declare function getOptionsFromCliArgs(argv: readonly string[], { exitOnE
|
|
|
25
26
|
prDescription?: string | undefined;
|
|
26
27
|
prFilter?: string | undefined;
|
|
27
28
|
prTitle?: string | undefined;
|
|
29
|
+
publishStatusComment?: boolean | undefined;
|
|
28
30
|
pullNumber?: number | undefined;
|
|
29
31
|
repoName?: string | undefined;
|
|
30
32
|
repoOwner?: string | undefined;
|
|
@@ -38,4 +40,6 @@ export declare function getOptionsFromCliArgs(argv: readonly string[], { exitOnE
|
|
|
38
40
|
targetBranches?: string[] | undefined;
|
|
39
41
|
targetPRLabels?: string[] | undefined;
|
|
40
42
|
mainline?: number | undefined;
|
|
43
|
+
dateSince?: string | undefined;
|
|
44
|
+
dateUntil?: string | undefined;
|
|
41
45
|
};
|
package/dist/options/cliArgs.js
CHANGED
|
@@ -56,6 +56,18 @@ function getOptionsFromCliArgs(argv, { exitOnError = true } = {}) {
|
|
|
56
56
|
description: 'Append commit message with "(cherry picked from commit...)',
|
|
57
57
|
type: 'boolean',
|
|
58
58
|
conflicts: ['noCherrypickRef'],
|
|
59
|
+
})
|
|
60
|
+
.option('since', {
|
|
61
|
+
description: 'ISO-8601 date for filtering commits',
|
|
62
|
+
type: 'string',
|
|
63
|
+
})
|
|
64
|
+
.option('until', {
|
|
65
|
+
description: 'ISO-8601 date for filtering commits',
|
|
66
|
+
type: 'string',
|
|
67
|
+
})
|
|
68
|
+
.option('dir', {
|
|
69
|
+
description: 'Location where the temporary repository will be stored',
|
|
70
|
+
type: 'string',
|
|
59
71
|
})
|
|
60
72
|
.option('details', {
|
|
61
73
|
description: 'Show details about each commit',
|
|
@@ -135,6 +147,10 @@ function getOptionsFromCliArgs(argv, { exitOnError = true } = {}) {
|
|
|
135
147
|
description: 'Do not append commit message with "(cherry picked from commit...)"',
|
|
136
148
|
type: 'boolean',
|
|
137
149
|
conflicts: ['cherrypickRef'],
|
|
150
|
+
})
|
|
151
|
+
.option('noStatusComment', {
|
|
152
|
+
description: "Don't publish status comment to Github",
|
|
153
|
+
type: 'boolean',
|
|
138
154
|
})
|
|
139
155
|
.option('noVerify', {
|
|
140
156
|
description: 'Bypass the pre-commit and commit-msg hooks',
|
|
@@ -256,14 +272,19 @@ function getOptionsFromCliArgs(argv, { exitOnError = true } = {}) {
|
|
|
256
272
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
257
273
|
$0, _,
|
|
258
274
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
259
|
-
multiple, multipleBranches, multipleCommits, all,
|
|
275
|
+
multiple, multipleBranches, multipleCommits, all,
|
|
276
|
+
// filters
|
|
277
|
+
author, since, until,
|
|
260
278
|
// negations
|
|
261
|
-
|
|
279
|
+
noCherrypickRef, noFork, noStatusComment, noVerify, verify,
|
|
262
280
|
// array types (should be renamed to plural form)
|
|
263
281
|
assignee, path, reviewer, sourcePRLabel, targetBranch, targetBranchChoice, targetPRLabel, ...restOptions } = yargsInstance.parseSync();
|
|
264
282
|
return (0, excludeUndefined_1.excludeUndefined)({
|
|
265
283
|
...restOptions,
|
|
284
|
+
// filters
|
|
266
285
|
author: all ? null : author,
|
|
286
|
+
dateSince: since,
|
|
287
|
+
dateUntil: until,
|
|
267
288
|
// `multiple` is a cli-only flag to override `multipleBranches` and `multipleCommits`
|
|
268
289
|
multipleBranches: multiple ?? multipleBranches,
|
|
269
290
|
multipleCommits: multiple ?? multipleCommits,
|
|
@@ -279,6 +300,7 @@ function getOptionsFromCliArgs(argv, { exitOnError = true } = {}) {
|
|
|
279
300
|
cherrypickRef: noCherrypickRef === true ? false : restOptions.cherrypickRef,
|
|
280
301
|
fork: noFork === true ? false : restOptions.fork,
|
|
281
302
|
noVerify: verify ?? noVerify,
|
|
303
|
+
publishStatusComment: noStatusComment === true ? false : undefined,
|
|
282
304
|
});
|
|
283
305
|
}
|
|
284
306
|
exports.getOptionsFromCliArgs = getOptionsFromCliArgs;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ConfigFileOptions } from '../ConfigOptions';
|
|
2
2
|
export declare type OptionsFromConfigFiles = Awaited<ReturnType<typeof getOptionsFromConfigFiles>>;
|
|
3
|
-
export declare function getOptionsFromConfigFiles(optionsFromModule
|
|
3
|
+
export declare function getOptionsFromConfigFiles({ optionsFromModule, ci, }: {
|
|
4
|
+
optionsFromModule?: ConfigFileOptions;
|
|
5
|
+
ci: boolean;
|
|
6
|
+
}): Promise<{
|
|
4
7
|
accessToken?: string | undefined;
|
|
5
8
|
assignees?: string[] | undefined;
|
|
6
9
|
author?: string | null | undefined;
|
|
@@ -23,6 +26,7 @@ export declare function getOptionsFromConfigFiles(optionsFromModule?: ConfigFile
|
|
|
23
26
|
cherrypickRef?: boolean | undefined;
|
|
24
27
|
ci?: boolean | undefined;
|
|
25
28
|
commitPaths?: string[] | undefined;
|
|
29
|
+
dir?: string | undefined;
|
|
26
30
|
details?: boolean | undefined;
|
|
27
31
|
editor?: string | undefined;
|
|
28
32
|
fork?: boolean | undefined;
|
|
@@ -37,6 +41,7 @@ export declare function getOptionsFromConfigFiles(optionsFromModule?: ConfigFile
|
|
|
37
41
|
prDescription?: string | undefined;
|
|
38
42
|
prFilter?: string | undefined;
|
|
39
43
|
prTitle?: string | undefined;
|
|
44
|
+
publishStatusComment?: boolean | undefined;
|
|
40
45
|
pullNumber?: number | undefined;
|
|
41
46
|
repoName?: string | undefined;
|
|
42
47
|
repoOwner?: string | undefined;
|
|
@@ -4,11 +4,11 @@ exports.getOptionsFromConfigFiles = void 0;
|
|
|
4
4
|
const getOptionsFromGit_1 = require("./getOptionsFromGit");
|
|
5
5
|
const globalConfig_1 = require("./globalConfig");
|
|
6
6
|
const projectConfig_1 = require("./projectConfig");
|
|
7
|
-
async function getOptionsFromConfigFiles(optionsFromModule) {
|
|
7
|
+
async function getOptionsFromConfigFiles({ optionsFromModule, ci, }) {
|
|
8
8
|
const [gitConfig, projectConfig, globalConfig] = await Promise.all([
|
|
9
9
|
(0, getOptionsFromGit_1.getOptionsFromGit)(),
|
|
10
10
|
(0, projectConfig_1.getProjectConfig)(),
|
|
11
|
-
(0, globalConfig_1.getGlobalConfig)(
|
|
11
|
+
ci ? undefined : (0, globalConfig_1.getGlobalConfig)(),
|
|
12
12
|
]);
|
|
13
13
|
return {
|
|
14
14
|
...gitConfig,
|
|
@@ -9,7 +9,7 @@ describe('getOptionsFromConfigFiles', () => {
|
|
|
9
9
|
globalConfig: { accessToken: 'abc', editor: 'vim' },
|
|
10
10
|
projectConfig: { repoName: 'kibana', repoOwner: 'elastic' },
|
|
11
11
|
});
|
|
12
|
-
res = await (0, config_1.getOptionsFromConfigFiles)();
|
|
12
|
+
res = await (0, config_1.getOptionsFromConfigFiles)({ ci: false });
|
|
13
13
|
});
|
|
14
14
|
it('should return values from config files', () => {
|
|
15
15
|
expect(res).toEqual({
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ConfigFileOptions } from '../ConfigOptions';
|
|
2
|
-
export declare function getGlobalConfig(
|
|
2
|
+
export declare function getGlobalConfig(): Promise<ConfigFileOptions>;
|
|
3
3
|
export declare function createGlobalConfigAndFolderIfNotExist(): Promise<boolean>;
|
|
4
4
|
export declare function createGlobalConfigIfNotExist(globalConfigPath: string, configTemplate: string): Promise<boolean>;
|