backport 6.3.0-beta-6 → 6.3.0-beta-7
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/dist/options/options.js +42 -14
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.d.ts +1 -0
- package/dist/services/github/v4/getOptionsFromGithub/getOptionsFromGithub.js +0 -4
- package/dist/utils/packageVersion.d.ts +1 -1
- package/dist/utils/packageVersion.js +1 -1
- package/package.json +1 -1
package/dist/options/options.js
CHANGED
|
@@ -47,7 +47,7 @@ async function getOptions(processArgs, optionsFromModule) {
|
|
|
47
47
|
defaultConfigOptions,
|
|
48
48
|
});
|
|
49
49
|
// combined options from cli and config files
|
|
50
|
-
const combined =
|
|
50
|
+
const combined = getMergedOptionsFromConfigAndCli({
|
|
51
51
|
optionsFromConfigFiles,
|
|
52
52
|
optionsFromCliArgs,
|
|
53
53
|
});
|
|
@@ -61,7 +61,7 @@ async function getOptions(processArgs, optionsFromModule) {
|
|
|
61
61
|
repoName,
|
|
62
62
|
repoOwner,
|
|
63
63
|
});
|
|
64
|
-
const
|
|
64
|
+
const options = {
|
|
65
65
|
// default author
|
|
66
66
|
author: optionsFromGithub.authenticatedUsername,
|
|
67
67
|
// default values have lowest precedence
|
|
@@ -77,8 +77,8 @@ async function getOptions(processArgs, optionsFromModule) {
|
|
|
77
77
|
repoName,
|
|
78
78
|
repoOwner,
|
|
79
79
|
};
|
|
80
|
-
|
|
81
|
-
return
|
|
80
|
+
throwForRequiredOptions(options);
|
|
81
|
+
return options;
|
|
82
82
|
}
|
|
83
83
|
exports.getOptions = getOptions;
|
|
84
84
|
async function getRequiredOptions(combined) {
|
|
@@ -109,19 +109,47 @@ async function getRequiredOptions(combined) {
|
|
|
109
109
|
repoOwner: gitRemote.repoOwner,
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function throwForRequiredOptions(options) {
|
|
113
|
+
// ensure `targetBranches` or `targetBranchChoices` are given
|
|
114
|
+
if ((0, lodash_1.isEmpty)(options.targetBranches) &&
|
|
115
|
+
(0, lodash_1.isEmpty)(options.targetBranchChoices) &&
|
|
116
|
+
// this is primarily necessary on CI where `targetBranches` and `targetBranchChoices` and not given
|
|
117
|
+
(0, lodash_1.isEmpty)(options.branchLabelMapping)) {
|
|
118
|
+
throw new HandledError_1.HandledError(`Please specify a target branch: "--branch 6.1".\n\nRead more: ${PROJECT_CONFIG_DOCS_LINK}`);
|
|
119
|
+
}
|
|
120
|
+
const optionKeys = [
|
|
121
|
+
'accessToken',
|
|
122
|
+
'author',
|
|
123
|
+
'autoMergeMethod',
|
|
124
|
+
'backportBinary',
|
|
125
|
+
'configFile',
|
|
126
|
+
'dir',
|
|
127
|
+
'editor',
|
|
128
|
+
'gitHostname',
|
|
129
|
+
'githubApiBaseUrlV3',
|
|
130
|
+
'githubApiBaseUrlV4',
|
|
131
|
+
'logFilePath',
|
|
132
|
+
'prDescription',
|
|
133
|
+
'prFilter',
|
|
134
|
+
'prTitle',
|
|
135
|
+
'repoName',
|
|
136
|
+
'repoOwner',
|
|
137
|
+
'sha',
|
|
138
|
+
'sourceBranch',
|
|
139
|
+
'username',
|
|
140
|
+
];
|
|
141
|
+
// Disallow empty strings
|
|
142
|
+
optionKeys.forEach((optionName) => {
|
|
143
|
+
const option = options[optionName];
|
|
144
|
+
if (option === '') {
|
|
145
|
+
throw new HandledError_1.HandledError(`"${optionName}" cannot be empty!`);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function getMergedOptionsFromConfigAndCli({ optionsFromConfigFiles, optionsFromCliArgs, }) {
|
|
113
150
|
return {
|
|
114
151
|
...defaultConfigOptions,
|
|
115
152
|
...optionsFromConfigFiles,
|
|
116
153
|
...optionsFromCliArgs,
|
|
117
154
|
};
|
|
118
155
|
}
|
|
119
|
-
function requireTargetBranch(config) {
|
|
120
|
-
// ensure `targetBranches` or `targetBranchChoices` are given
|
|
121
|
-
if ((0, lodash_1.isEmpty)(config.targetBranches) &&
|
|
122
|
-
(0, lodash_1.isEmpty)(config.targetBranchChoices) &&
|
|
123
|
-
// this is primarily necessary on CI where `targetBranches` and `targetBranchChoices` and not given
|
|
124
|
-
(0, lodash_1.isEmpty)(config.branchLabelMapping)) {
|
|
125
|
-
throw new HandledError_1.HandledError(`Please specify a target branch: "--branch 6.1".\n\nRead more: ${PROJECT_CONFIG_DOCS_LINK}`);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
@@ -9,10 +9,6 @@ const logger_1 = require("../../../logger");
|
|
|
9
9
|
const apiRequestV4_1 = require("../apiRequestV4");
|
|
10
10
|
const throwOnInvalidAccessToken_1 = require("../throwOnInvalidAccessToken");
|
|
11
11
|
const query_1 = require("./query");
|
|
12
|
-
// fetches the default source branch for the repo (normally "master")
|
|
13
|
-
// startup checks:
|
|
14
|
-
// - verify the access token
|
|
15
|
-
// - ensure no branch named "backport" exists
|
|
16
12
|
async function getOptionsFromGithub(options) {
|
|
17
13
|
const { accessToken, githubApiBaseUrlV4, repoName, repoOwner } = options;
|
|
18
14
|
let res;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "6.3.0-beta-
|
|
1
|
+
export declare const PACKAGE_VERSION = "6.3.0-beta-6";
|