@contentstack/cli-cm-branches 1.0.21 → 1.0.23
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 +1 -1
- package/lib/commands/cm/branches/merge.js +22 -16
- package/lib/utils/entry-create-script.js +1 -1
- package/lib/utils/entry-create-update-script.js +1 -1
- package/lib/utils/entry-update-script.js +1 -1
- package/lib/utils/index.js +21 -1
- package/oclif.manifest.json +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ $ npm install -g @contentstack/cli-cm-branches
|
|
|
37
37
|
$ csdx COMMAND
|
|
38
38
|
running command...
|
|
39
39
|
$ csdx (--version)
|
|
40
|
-
@contentstack/cli-cm-branches/1.0.
|
|
40
|
+
@contentstack/cli-cm-branches/1.0.23 linux-x64 node-v18.19.1
|
|
41
41
|
$ csdx --help [COMMAND]
|
|
42
42
|
USAGE
|
|
43
43
|
$ csdx COMMAND
|
|
@@ -21,22 +21,28 @@ class BranchMergeCommand extends cli_command_1.Command {
|
|
|
21
21
|
host: this.cmaHost,
|
|
22
22
|
format: 'compact-text',
|
|
23
23
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
const isCompareDataValid = (0, utils_1.validateCompareData)(branchCompareData);
|
|
25
|
+
if (isCompareDataValid) {
|
|
26
|
+
await new branch_1.MergeHandler({
|
|
27
|
+
stackAPIKey: branchMergeFlags['stack-api-key'],
|
|
28
|
+
compareBranch: branchMergeFlags['compare-branch'],
|
|
29
|
+
strategy: branchMergeFlags.strategy,
|
|
30
|
+
strategySubOption: branchMergeFlags['strategy-sub-options'],
|
|
31
|
+
baseBranch: branchMergeFlags['base-branch'],
|
|
32
|
+
branchCompareData: branchCompareData,
|
|
33
|
+
mergeComment: branchMergeFlags.comment,
|
|
34
|
+
executeOption: branchMergeFlags['merge-action'],
|
|
35
|
+
noRevert: branchMergeFlags['no-revert'],
|
|
36
|
+
format: 'compact-text',
|
|
37
|
+
exportSummaryPath: branchMergeFlags['export-summary-path'],
|
|
38
|
+
mergeSummary: branchMergeFlags.mergeSummary,
|
|
39
|
+
host: this.cmaHost,
|
|
40
|
+
enableEntryExp: false,
|
|
41
|
+
}).start();
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
cli_utilities_1.cliux.print("No changes found to merge.");
|
|
45
|
+
}
|
|
40
46
|
}
|
|
41
47
|
catch (error) {
|
|
42
48
|
console.log('Error in Merge operations', error);
|
|
@@ -185,7 +185,7 @@ function entryCreateScript(contentType) {
|
|
|
185
185
|
text = JSON.stringify(_entry);
|
|
186
186
|
}
|
|
187
187
|
markdownRegEx = new RegExp(
|
|
188
|
-
'(https://(assets|(eu-|azure-na-|azure-eu-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))',
|
|
188
|
+
'(https://(assets|(eu-|azure-na-|azure-eu-|gcp-na-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))',
|
|
189
189
|
'g',
|
|
190
190
|
);
|
|
191
191
|
while ((markdownMatch = markdownRegEx.exec(text)) !== null) {
|
|
@@ -207,7 +207,7 @@ function entryCreateUpdateScript(contentType) {
|
|
|
207
207
|
text = JSON.stringify(_entry);
|
|
208
208
|
}
|
|
209
209
|
markdownRegEx = new RegExp(
|
|
210
|
-
'(https://(assets|(eu-|azure-na-|azure-eu-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))',
|
|
210
|
+
'(https://(assets|(eu-|azure-na-|azure-eu-|gcp-na-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))',
|
|
211
211
|
'g',
|
|
212
212
|
);
|
|
213
213
|
while ((markdownMatch = markdownRegEx.exec(text)) !== null) {
|
|
@@ -207,7 +207,7 @@ function entryUpdateScript(contentType) {
|
|
|
207
207
|
text = JSON.stringify(_entry);
|
|
208
208
|
}
|
|
209
209
|
markdownRegEx = new RegExp(
|
|
210
|
-
'(https://(assets|(eu-|azure-na-|azure-eu-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))',
|
|
210
|
+
'(https://(assets|(eu-|azure-na-|azure-eu-|gcp-na-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))',
|
|
211
211
|
'g',
|
|
212
212
|
);
|
|
213
213
|
while ((markdownMatch = markdownRegEx.exec(text)) !== null) {
|
package/lib/utils/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteBranchUtility = exports.branchDiffUtility = exports.interactive = exports.handleErrorMsg = exports.executeMergeRequest = exports.getMergeQueueStatus = exports.readFile = exports.writeFile = exports.refreshbranchConfig = exports.getbranchConfig = exports.getbranchesList = void 0;
|
|
3
|
+
exports.deleteBranchUtility = exports.branchDiffUtility = exports.interactive = exports.validateCompareData = exports.handleErrorMsg = exports.executeMergeRequest = exports.getMergeQueueStatus = exports.readFile = exports.writeFile = exports.refreshbranchConfig = exports.getbranchConfig = exports.getbranchesList = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
/**
|
|
6
6
|
* Command specific utilities can be written here
|
|
7
7
|
*/
|
|
8
8
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
9
9
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
10
|
+
const forEach_1 = tslib_1.__importDefault(require("lodash/forEach"));
|
|
10
11
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
11
12
|
const getbranchesList = (branchResult, baseBranch) => {
|
|
12
13
|
const branches = [];
|
|
@@ -106,6 +107,25 @@ function handleErrorMsg(err) {
|
|
|
106
107
|
process.exit(1);
|
|
107
108
|
}
|
|
108
109
|
exports.handleErrorMsg = handleErrorMsg;
|
|
110
|
+
function validateCompareData(branchCompareData) {
|
|
111
|
+
let validCompareData = false;
|
|
112
|
+
if (branchCompareData.content_types) {
|
|
113
|
+
(0, forEach_1.default)(branchCompareData.content_types, (value, key) => {
|
|
114
|
+
if ((value === null || value === void 0 ? void 0 : value.length) > 0) {
|
|
115
|
+
validCompareData = true;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
if (branchCompareData.global_fields) {
|
|
120
|
+
(0, forEach_1.default)(branchCompareData.global_fields, (value, key) => {
|
|
121
|
+
if ((value === null || value === void 0 ? void 0 : value.length) > 0) {
|
|
122
|
+
validCompareData = true;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return validCompareData;
|
|
127
|
+
}
|
|
128
|
+
exports.validateCompareData = validateCompareData;
|
|
109
129
|
tslib_1.__exportStar(require("./interactive"), exports);
|
|
110
130
|
tslib_1.__exportStar(require("./merge-helper"), exports);
|
|
111
131
|
tslib_1.__exportStar(require("./create-merge-scripts"), exports);
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-branches",
|
|
3
3
|
"description": "Contentstack CLI plugin to do branches operations",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.23",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@contentstack/cli-command": "~1.2.16",
|
|
9
|
-
"@contentstack/cli-utilities": "~1.
|
|
9
|
+
"@contentstack/cli-utilities": "~1.6.0",
|
|
10
10
|
"@oclif/core": "^2.9.3",
|
|
11
11
|
"async": "^3.2.4",
|
|
12
12
|
"big-json": "^3.2.0",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@contentstack/cli-auth": "~1.3.17",
|
|
29
|
-
"@contentstack/cli-config": "~1.
|
|
29
|
+
"@contentstack/cli-config": "~1.6.1",
|
|
30
30
|
"@contentstack/cli-dev-dependencies": "~1.2.4",
|
|
31
31
|
"@oclif/plugin-help": "^5.1.19",
|
|
32
|
-
"@oclif/test": "^
|
|
32
|
+
"@oclif/test": "^2.5.6",
|
|
33
33
|
"@types/flat": "^5.0.2",
|
|
34
34
|
"assert": "^2.0.0",
|
|
35
35
|
"chai": "^4.2.0",
|
|
@@ -95,4 +95,4 @@
|
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
"repository": "https://github.com/contentstack/cli"
|
|
98
|
-
}
|
|
98
|
+
}
|