@contentstack/cli-cm-branches 1.1.4 → 1.2.1
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 +18 -17
- package/lib/commands/cm/branches/create.js +2 -2
- package/lib/commands/cm/branches/diff.js +5 -5
- package/lib/commands/cm/branches/index.js +2 -2
- package/lib/commands/cm/branches/merge.js +10 -10
- package/lib/utils/entry-create-script.js +45 -34
- package/lib/utils/entry-create-update-script.js +46 -34
- package/lib/utils/entry-update-script.js +46 -35
- package/oclif.manifest.json +20 -20
- package/package.json +15 -32
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.1
|
|
40
|
+
@contentstack/cli-cm-branches/1.2.1 linux-x64 node-v18.20.6
|
|
41
41
|
$ csdx --help [COMMAND]
|
|
42
42
|
USAGE
|
|
43
43
|
$ csdx COMMAND
|
|
@@ -63,8 +63,8 @@ USAGE
|
|
|
63
63
|
$ csdx cm:branches
|
|
64
64
|
|
|
65
65
|
FLAGS
|
|
66
|
-
-k, --stack-api-key=<value> Stack API
|
|
67
|
-
--verbose Verbose
|
|
66
|
+
-k, --stack-api-key=<value> Stack API key
|
|
67
|
+
--verbose Verbose, display information in detailed format.
|
|
68
68
|
|
|
69
69
|
DESCRIPTION
|
|
70
70
|
List the branches
|
|
@@ -91,8 +91,8 @@ USAGE
|
|
|
91
91
|
|
|
92
92
|
FLAGS
|
|
93
93
|
-k, --stack-api-key=<value> Stack API key
|
|
94
|
-
--source=<value> Source branch from which new branch to be created
|
|
95
|
-
--uid=<value> Branch UID to be created
|
|
94
|
+
--source=<value> Source branch from which a new branch is to be created.
|
|
95
|
+
--uid=<value> Branch UID (unique name) to be created.
|
|
96
96
|
|
|
97
97
|
DESCRIPTION
|
|
98
98
|
Create a new branch
|
|
@@ -145,12 +145,13 @@ USAGE
|
|
|
145
145
|
$ csdx cm:branches:diff [--base-branch <value>] [--compare-branch <value>] [-k <value>][--module <value>]
|
|
146
146
|
|
|
147
147
|
FLAGS
|
|
148
|
-
-k, --stack-api-key=<value> Provide
|
|
149
|
-
--base-branch=<value> Base branch
|
|
150
|
-
--compare-branch=<value> Compare branch
|
|
151
|
-
--format=<option> [default: compact-text] [
|
|
148
|
+
-k, --stack-api-key=<value> [optional] Provide the stack API key to show the difference between branches.
|
|
149
|
+
--base-branch=<value> [optional] Base branch (Target branch).
|
|
150
|
+
--compare-branch=<value> [optional] Compare branch (Source branch).
|
|
151
|
+
--format=<option> [default: compact-text] [default: compact-text] [optional] Type of flags to show the
|
|
152
|
+
difference between two branches. <options: compact-text, detailed-text>
|
|
152
153
|
<options: compact-text|detailed-text>
|
|
153
|
-
--module=<option> Module
|
|
154
|
+
--module=<option> [optional] Module. <options: content-types, global-fields, all>
|
|
154
155
|
<options: content-types|global-fields|all>
|
|
155
156
|
|
|
156
157
|
DESCRIPTION
|
|
@@ -194,13 +195,13 @@ USAGE
|
|
|
194
195
|
[--use-merge-summary <value>] [--comment <value>] [--base-branch <value>]
|
|
195
196
|
|
|
196
197
|
FLAGS
|
|
197
|
-
-k, --stack-api-key=<value> Provide
|
|
198
|
-
--base-branch=<value> Base branch
|
|
199
|
-
--comment=<value>
|
|
200
|
-
--compare-branch=<value> Compare branch
|
|
201
|
-
--export-summary-path=<value> Export summary file path
|
|
202
|
-
--no-revert If passed, will not create the new revert branch
|
|
203
|
-
--use-merge-summary=<value> Path of merge summary file
|
|
198
|
+
-k, --stack-api-key=<value> [optional] Provide stack API key to show the difference between the branches.
|
|
199
|
+
--base-branch=<value> [optional] Base branch (Target branch).
|
|
200
|
+
--comment=<value> [optional] Pass a comment.
|
|
201
|
+
--compare-branch=<value> [optional] Compare branch (Source branch).
|
|
202
|
+
--export-summary-path=<value> [optional] Export summary file path.
|
|
203
|
+
--no-revert [optional] If passed, will not create the new revert branch.
|
|
204
|
+
--use-merge-summary=<value> [optional] Path of merge summary file.
|
|
204
205
|
|
|
205
206
|
DESCRIPTION
|
|
206
207
|
Merge changes from a branch
|
|
@@ -41,8 +41,8 @@ BranchCreateCommand.usage = [
|
|
|
41
41
|
'cm:branches:create [--source <value>] [--uid <value>] [--stack-api-key <value>]',
|
|
42
42
|
]; // Note: Add and modify the usage
|
|
43
43
|
BranchCreateCommand.flags = {
|
|
44
|
-
uid: cli_utilities_1.flags.string({ description: 'Branch UID to be created' }),
|
|
45
|
-
source: cli_utilities_1.flags.string({ description: 'Source branch from which new branch to be created' }),
|
|
44
|
+
uid: cli_utilities_1.flags.string({ description: 'Branch UID (unique name) to be created.' }),
|
|
45
|
+
source: cli_utilities_1.flags.string({ description: 'Source branch from which a new branch is to be created.' }),
|
|
46
46
|
'stack-api-key': cli_utilities_1.flags.string({ char: 'k', description: 'Stack API key' }),
|
|
47
47
|
};
|
|
48
48
|
BranchCreateCommand.aliases = []; // Note: alternative usage if any
|
|
@@ -47,24 +47,24 @@ BranchDiffCommand.examples = [
|
|
|
47
47
|
BranchDiffCommand.usage = 'cm:branches:diff [--base-branch <value>] [--compare-branch <value>] [-k <value>][--module <value>]';
|
|
48
48
|
BranchDiffCommand.flags = {
|
|
49
49
|
'base-branch': cli_utilities_1.flags.string({
|
|
50
|
-
description: 'Base branch',
|
|
50
|
+
description: '[optional] Base branch (Target branch).',
|
|
51
51
|
}),
|
|
52
52
|
'compare-branch': cli_utilities_1.flags.string({
|
|
53
|
-
description: 'Compare branch',
|
|
53
|
+
description: '[optional] Compare branch (Source branch).',
|
|
54
54
|
}),
|
|
55
55
|
module: cli_utilities_1.flags.string({
|
|
56
|
-
description: 'Module',
|
|
56
|
+
description: '[optional] Module. <options: content-types, global-fields, all>',
|
|
57
57
|
options: ['content-types', 'global-fields', 'all'],
|
|
58
58
|
}),
|
|
59
59
|
'stack-api-key': cli_utilities_1.flags.string({
|
|
60
60
|
char: 'k',
|
|
61
|
-
description: 'Provide
|
|
61
|
+
description: '[optional] Provide the stack API key to show the difference between branches.',
|
|
62
62
|
}),
|
|
63
63
|
format: cli_utilities_1.flags.string({
|
|
64
64
|
default: 'compact-text',
|
|
65
65
|
multiple: false,
|
|
66
66
|
options: ['compact-text', 'detailed-text'],
|
|
67
|
-
description: '[
|
|
67
|
+
description: '[default: compact-text] [optional] Type of flags to show the difference between two branches. <options: compact-text, detailed-text>',
|
|
68
68
|
}),
|
|
69
69
|
};
|
|
70
70
|
BranchDiffCommand.aliases = []; // Note: alternative usage if any
|
|
@@ -79,7 +79,7 @@ BranchListCommand.description = cli_utilities_1.messageHandler.parse('List the b
|
|
|
79
79
|
BranchListCommand.examples = ['csdx cm:branches', 'csdx cm:branches --verbose', 'csdx cm:branches -k <stack api key>']; // Note: Add and modify the examples
|
|
80
80
|
BranchListCommand.usage = 'cm:branches'; // Note: Add and modify the usage
|
|
81
81
|
BranchListCommand.flags = {
|
|
82
|
-
'stack-api-key': cli_utilities_1.flags.string({ char: 'k', description: 'Stack API
|
|
83
|
-
verbose: cli_utilities_1.flags.boolean({ description: 'Verbose' }),
|
|
82
|
+
'stack-api-key': cli_utilities_1.flags.string({ char: 'k', description: 'Stack API key' }),
|
|
83
|
+
verbose: cli_utilities_1.flags.boolean({ description: 'Verbose, display information in detailed format.' }),
|
|
84
84
|
};
|
|
85
85
|
BranchListCommand.aliases = []; // Note: alternative usage if any
|
|
@@ -64,39 +64,39 @@ BranchMergeCommand.usage = 'cm:branches:merge [-k <value>][--compare-branch <val
|
|
|
64
64
|
// TBD improve flag descriptions
|
|
65
65
|
BranchMergeCommand.flags = {
|
|
66
66
|
'compare-branch': cli_utilities_1.flags.string({
|
|
67
|
-
description: 'Compare branch
|
|
67
|
+
description: '[optional] Compare branch (Source branch).',
|
|
68
68
|
}),
|
|
69
69
|
'base-branch': cli_utilities_1.flags.string({
|
|
70
|
-
description: 'Base branch',
|
|
70
|
+
description: '[optional] Base branch (Target branch).',
|
|
71
71
|
}),
|
|
72
72
|
comment: cli_utilities_1.flags.string({
|
|
73
|
-
description: '
|
|
73
|
+
description: '[optional] Pass a comment.',
|
|
74
74
|
}),
|
|
75
75
|
'stack-api-key': cli_utilities_1.flags.string({
|
|
76
76
|
char: 'k',
|
|
77
|
-
description: 'Provide
|
|
77
|
+
description: '[optional] Provide stack API key to show the difference between the branches.',
|
|
78
78
|
}),
|
|
79
79
|
'export-summary-path': cli_utilities_1.flags.string({
|
|
80
|
-
description: 'Export summary file path',
|
|
80
|
+
description: '[optional] Export summary file path.',
|
|
81
81
|
}),
|
|
82
82
|
'use-merge-summary': cli_utilities_1.flags.string({
|
|
83
|
-
description: 'Path of merge summary file',
|
|
83
|
+
description: '[optional] Path of merge summary file.',
|
|
84
84
|
}),
|
|
85
85
|
'no-revert': cli_utilities_1.flags.boolean({
|
|
86
|
-
description: 'If passed, will not create the new revert branch',
|
|
86
|
+
description: '[optional] If passed, will not create the new revert branch.',
|
|
87
87
|
}),
|
|
88
88
|
strategy: cli_utilities_1.flags.string({
|
|
89
|
-
description: 'Merge strategy',
|
|
89
|
+
description: '[hidden] Merge strategy.',
|
|
90
90
|
options: ['merge_prefer_base', 'merge_prefer_compare', 'overwrite_with_compare', 'custom_preferences'],
|
|
91
91
|
hidden: true,
|
|
92
92
|
}),
|
|
93
93
|
'strategy-sub-options': cli_utilities_1.flags.string({
|
|
94
|
-
description: 'Merge strategy sub options',
|
|
94
|
+
description: '[hidden] Merge strategy sub options.',
|
|
95
95
|
options: ['new', 'modified', 'both'],
|
|
96
96
|
hidden: true,
|
|
97
97
|
}),
|
|
98
98
|
'merge-action': cli_utilities_1.flags.string({
|
|
99
|
-
description: 'Merge
|
|
99
|
+
description: '[hidden] Merge action.',
|
|
100
100
|
options: ['export', 'execute', 'both'],
|
|
101
101
|
hidden: true,
|
|
102
102
|
}),
|
|
@@ -111,6 +111,13 @@ function entryCreateScript(contentType) {
|
|
|
111
111
|
findAssetIdsFromJsonRte(entry, schema);
|
|
112
112
|
parent.pop();
|
|
113
113
|
}
|
|
114
|
+
if (
|
|
115
|
+
schema[i].data_type === 'json' &&
|
|
116
|
+
schema[i].field_metadata.extension &&
|
|
117
|
+
schema[i].field_metadata.is_asset
|
|
118
|
+
) {
|
|
119
|
+
fetchAssetFromFileFields(parent,schema[i],entry);
|
|
120
|
+
}
|
|
114
121
|
if (
|
|
115
122
|
schema[i].data_type === 'text' &&
|
|
116
123
|
schema[i].field_metadata &&
|
|
@@ -124,43 +131,47 @@ function entryCreateScript(contentType) {
|
|
|
124
131
|
parent.pop();
|
|
125
132
|
}
|
|
126
133
|
if (schema[i].data_type === 'file') {
|
|
127
|
-
parent
|
|
128
|
-
let updatedEntry = entry;
|
|
129
|
-
for (let i = 0; i < parent.length; i++) {
|
|
130
|
-
updatedEntry = updatedEntry[parent[i]];
|
|
131
|
-
}
|
|
132
|
-
const imgDetails = updatedEntry;
|
|
133
|
-
if (schema[i].multiple) {
|
|
134
|
-
if (imgDetails && imgDetails.length) {
|
|
135
|
-
imgDetails.forEach((img) => {
|
|
136
|
-
const obj = {
|
|
137
|
-
uid: img.uid,
|
|
138
|
-
parent_uid: img.parent_uid,
|
|
139
|
-
description: img.description,
|
|
140
|
-
title: img.title,
|
|
141
|
-
filename: img.filename,
|
|
142
|
-
url: img.url,
|
|
143
|
-
};
|
|
144
|
-
cAssetDetails.push(obj);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
} else {
|
|
148
|
-
if (imgDetails) {
|
|
149
|
-
const obj = {
|
|
150
|
-
uid: imgDetails.uid,
|
|
151
|
-
parent_uid: imgDetails.parent_uid,
|
|
152
|
-
description: imgDetails.description,
|
|
153
|
-
title: imgDetails.title,
|
|
154
|
-
filename: imgDetails.filename,
|
|
155
|
-
url: imgDetails.url,
|
|
156
|
-
};
|
|
157
|
-
cAssetDetails.push(obj);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
parent.pop();
|
|
134
|
+
fetchAssetFromFileFields(parent,schema[i],entry);
|
|
161
135
|
}
|
|
162
136
|
}
|
|
163
137
|
};
|
|
138
|
+
|
|
139
|
+
function fetchAssetFromFileFields (parent, schema, entry) {
|
|
140
|
+
parent.push(schema.uid);
|
|
141
|
+
let updatedEntry = entry;
|
|
142
|
+
for (let i = 0; i < parent.length; i++) {
|
|
143
|
+
updatedEntry = updatedEntry[parent[i]];
|
|
144
|
+
}
|
|
145
|
+
const imgDetails = updatedEntry;
|
|
146
|
+
if (schema.multiple) {
|
|
147
|
+
if (imgDetails && imgDetails.length) {
|
|
148
|
+
imgDetails.forEach((img) => {
|
|
149
|
+
const obj = {
|
|
150
|
+
uid: img.uid,
|
|
151
|
+
parent_uid: img.parent_uid,
|
|
152
|
+
description: img.description,
|
|
153
|
+
title: img.title,
|
|
154
|
+
filename: img.filename,
|
|
155
|
+
url: img.url,
|
|
156
|
+
};
|
|
157
|
+
assetDetails.push(obj);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
if (imgDetails) {
|
|
162
|
+
const obj = {
|
|
163
|
+
uid: imgDetails.uid,
|
|
164
|
+
parent_uid: imgDetails.parent_uid,
|
|
165
|
+
description: imgDetails.description,
|
|
166
|
+
title: imgDetails.title,
|
|
167
|
+
filename: imgDetails.filename,
|
|
168
|
+
url: imgDetails.url,
|
|
169
|
+
};
|
|
170
|
+
assetDetails.push(obj);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
parent.pop();
|
|
174
|
+
}
|
|
164
175
|
|
|
165
176
|
function findAssetIdsFromHtmlRte(entryObj, ctSchema) {
|
|
166
177
|
const regex = /<img asset_uid=\\"([^"]+)\\"/g;
|
|
@@ -133,6 +133,15 @@ function entryCreateUpdateScript(contentType) {
|
|
|
133
133
|
findAssetIdsFromJsonRte(entry, schema);
|
|
134
134
|
parent.pop();
|
|
135
135
|
}
|
|
136
|
+
|
|
137
|
+
if (
|
|
138
|
+
schema[i].data_type === 'json' &&
|
|
139
|
+
schema[i].field_metadata.extension &&
|
|
140
|
+
schema[i].field_metadata.is_asset
|
|
141
|
+
) {
|
|
142
|
+
fetchAssetFromFileFields(parent,schema[i],entry);
|
|
143
|
+
}
|
|
144
|
+
|
|
136
145
|
if (
|
|
137
146
|
schema[i].data_type === 'text' &&
|
|
138
147
|
schema[i].field_metadata &&
|
|
@@ -146,44 +155,47 @@ function entryCreateUpdateScript(contentType) {
|
|
|
146
155
|
parent.pop();
|
|
147
156
|
}
|
|
148
157
|
if (schema[i].data_type === 'file') {
|
|
149
|
-
parent
|
|
150
|
-
let updatedEntry = entry;
|
|
151
|
-
for (let i = 0; i < parent.length; i++) {
|
|
152
|
-
updatedEntry = updatedEntry[parent[i]];
|
|
153
|
-
}
|
|
154
|
-
const imgDetails = updatedEntry;
|
|
155
|
-
if (schema[i].multiple) {
|
|
156
|
-
if (imgDetails && imgDetails.length) {
|
|
157
|
-
imgDetails.forEach((img) => {
|
|
158
|
-
const obj = {
|
|
159
|
-
uid: img.uid,
|
|
160
|
-
parent_uid: img.parent_uid,
|
|
161
|
-
description: img.description,
|
|
162
|
-
title: img.title,
|
|
163
|
-
filename: img.filename,
|
|
164
|
-
url: img.url,
|
|
165
|
-
};
|
|
166
|
-
assetDetails.push(obj);
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
} else {
|
|
170
|
-
if (imgDetails) {
|
|
171
|
-
const obj = {
|
|
172
|
-
uid: imgDetails.uid,
|
|
173
|
-
parent_uid: imgDetails.parent_uid,
|
|
174
|
-
description: imgDetails.description,
|
|
175
|
-
title: imgDetails.title,
|
|
176
|
-
filename: imgDetails.filename,
|
|
177
|
-
url: imgDetails.url,
|
|
178
|
-
};
|
|
179
|
-
assetDetails.push(obj);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
parent.pop();
|
|
158
|
+
fetchAssetFromFileFields(parent,schema[i],entry);
|
|
183
159
|
}
|
|
184
160
|
}
|
|
185
161
|
};
|
|
186
162
|
|
|
163
|
+
function fetchAssetFromFileFields (parent, schema, entry) {
|
|
164
|
+
parent.push(schema.uid);
|
|
165
|
+
let updatedEntry = entry;
|
|
166
|
+
for (let i = 0; i < parent.length; i++) {
|
|
167
|
+
updatedEntry = updatedEntry[parent[i]];
|
|
168
|
+
}
|
|
169
|
+
const imgDetails = updatedEntry;
|
|
170
|
+
if (schema.multiple) {
|
|
171
|
+
if (imgDetails && imgDetails.length) {
|
|
172
|
+
imgDetails.forEach((img) => {
|
|
173
|
+
const obj = {
|
|
174
|
+
uid: img.uid,
|
|
175
|
+
parent_uid: img.parent_uid,
|
|
176
|
+
description: img.description,
|
|
177
|
+
title: img.title,
|
|
178
|
+
filename: img.filename,
|
|
179
|
+
url: img.url,
|
|
180
|
+
};
|
|
181
|
+
assetDetails.push(obj);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
185
|
+
if (imgDetails) {
|
|
186
|
+
const obj = {
|
|
187
|
+
uid: imgDetails.uid,
|
|
188
|
+
parent_uid: imgDetails.parent_uid,
|
|
189
|
+
description: imgDetails.description,
|
|
190
|
+
title: imgDetails.title,
|
|
191
|
+
filename: imgDetails.filename,
|
|
192
|
+
url: imgDetails.url,
|
|
193
|
+
};
|
|
194
|
+
assetDetails.push(obj);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
parent.pop();
|
|
198
|
+
}
|
|
187
199
|
function findAssetIdsFromHtmlRte(entryObj, ctSchema) {
|
|
188
200
|
const regex = /<img asset_uid=\\"([^"]+)\\"/g;
|
|
189
201
|
let match;
|
|
@@ -133,6 +133,13 @@ function entryUpdateScript(contentType) {
|
|
|
133
133
|
findAssetIdsFromJsonRte(entry, schema);
|
|
134
134
|
parent.pop();
|
|
135
135
|
}
|
|
136
|
+
if (
|
|
137
|
+
schema[i].data_type === 'json' &&
|
|
138
|
+
schema[i].field_metadata.extension &&
|
|
139
|
+
schema[i].field_metadata.is_asset
|
|
140
|
+
) {
|
|
141
|
+
fetchAssetFromFileFields(parent,schema[i],entry);
|
|
142
|
+
}
|
|
136
143
|
if (
|
|
137
144
|
schema[i].data_type === 'text' &&
|
|
138
145
|
schema[i].field_metadata &&
|
|
@@ -146,44 +153,48 @@ function entryUpdateScript(contentType) {
|
|
|
146
153
|
parent.pop();
|
|
147
154
|
}
|
|
148
155
|
if (schema[i].data_type === 'file') {
|
|
149
|
-
parent
|
|
150
|
-
let updatedEntry = entry;
|
|
151
|
-
for (let i = 0; i < parent.length; i++) {
|
|
152
|
-
updatedEntry = updatedEntry[parent[i]];
|
|
153
|
-
}
|
|
154
|
-
const imgDetails = updatedEntry;
|
|
155
|
-
if (schema[i].multiple) {
|
|
156
|
-
if (imgDetails && imgDetails.length) {
|
|
157
|
-
imgDetails.forEach((img) => {
|
|
158
|
-
const obj = {
|
|
159
|
-
uid: img.uid,
|
|
160
|
-
parent_uid: img.parent_uid,
|
|
161
|
-
description: img.description,
|
|
162
|
-
title: img.title,
|
|
163
|
-
filename: img.filename,
|
|
164
|
-
url: img.url,
|
|
165
|
-
};
|
|
166
|
-
assetDetails.push(obj);
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
} else {
|
|
170
|
-
if (imgDetails) {
|
|
171
|
-
const obj = {
|
|
172
|
-
uid: imgDetails.uid,
|
|
173
|
-
parent_uid: imgDetails.parent_uid,
|
|
174
|
-
description: imgDetails.description,
|
|
175
|
-
title: imgDetails.title,
|
|
176
|
-
filename: imgDetails.filename,
|
|
177
|
-
url: imgDetails.url,
|
|
178
|
-
};
|
|
179
|
-
assetDetails.push(obj);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
parent.pop();
|
|
156
|
+
fetchAssetFromFileFields(parent,schema[i],entry);
|
|
183
157
|
}
|
|
184
158
|
}
|
|
185
159
|
};
|
|
186
|
-
|
|
160
|
+
|
|
161
|
+
function fetchAssetFromFileFields (parent, schema, entry) {
|
|
162
|
+
parent.push(schema.uid);
|
|
163
|
+
let updatedEntry = entry;
|
|
164
|
+
for (let i = 0; i < parent.length; i++) {
|
|
165
|
+
updatedEntry = updatedEntry[parent[i]];
|
|
166
|
+
}
|
|
167
|
+
const imgDetails = updatedEntry;
|
|
168
|
+
if (schema.multiple) {
|
|
169
|
+
if (imgDetails && imgDetails.length) {
|
|
170
|
+
imgDetails.forEach((img) => {
|
|
171
|
+
const obj = {
|
|
172
|
+
uid: img.uid,
|
|
173
|
+
parent_uid: img.parent_uid,
|
|
174
|
+
description: img.description,
|
|
175
|
+
title: img.title,
|
|
176
|
+
filename: img.filename,
|
|
177
|
+
url: img.url,
|
|
178
|
+
};
|
|
179
|
+
assetDetails.push(obj);
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
} else {
|
|
183
|
+
if (imgDetails) {
|
|
184
|
+
const obj = {
|
|
185
|
+
uid: imgDetails.uid,
|
|
186
|
+
parent_uid: imgDetails.parent_uid,
|
|
187
|
+
description: imgDetails.description,
|
|
188
|
+
title: imgDetails.title,
|
|
189
|
+
filename: imgDetails.filename,
|
|
190
|
+
url: imgDetails.url,
|
|
191
|
+
};
|
|
192
|
+
assetDetails.push(obj);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
parent.pop();
|
|
196
|
+
}
|
|
197
|
+
|
|
187
198
|
function findAssetIdsFromHtmlRte(entryObj, ctSchema) {
|
|
188
199
|
const regex = /<img asset_uid=\\"([^"]+)\\"/g;
|
|
189
200
|
let match;
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.1
|
|
2
|
+
"version": "1.2.1",
|
|
3
3
|
"commands": {
|
|
4
4
|
"cm:branches:create": {
|
|
5
5
|
"id": "cm:branches:create",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"uid": {
|
|
25
25
|
"name": "uid",
|
|
26
26
|
"type": "option",
|
|
27
|
-
"description": "Branch UID to be created",
|
|
27
|
+
"description": "Branch UID (unique name) to be created.",
|
|
28
28
|
"multiple": false
|
|
29
29
|
},
|
|
30
30
|
"source": {
|
|
31
31
|
"name": "source",
|
|
32
32
|
"type": "option",
|
|
33
|
-
"description": "Source branch from which new branch to be created",
|
|
33
|
+
"description": "Source branch from which a new branch is to be created.",
|
|
34
34
|
"multiple": false
|
|
35
35
|
},
|
|
36
36
|
"stack-api-key": {
|
|
@@ -114,19 +114,19 @@
|
|
|
114
114
|
"base-branch": {
|
|
115
115
|
"name": "base-branch",
|
|
116
116
|
"type": "option",
|
|
117
|
-
"description": "Base branch",
|
|
117
|
+
"description": "[optional] Base branch (Target branch).",
|
|
118
118
|
"multiple": false
|
|
119
119
|
},
|
|
120
120
|
"compare-branch": {
|
|
121
121
|
"name": "compare-branch",
|
|
122
122
|
"type": "option",
|
|
123
|
-
"description": "Compare branch",
|
|
123
|
+
"description": "[optional] Compare branch (Source branch).",
|
|
124
124
|
"multiple": false
|
|
125
125
|
},
|
|
126
126
|
"module": {
|
|
127
127
|
"name": "module",
|
|
128
128
|
"type": "option",
|
|
129
|
-
"description": "Module",
|
|
129
|
+
"description": "[optional] Module. <options: content-types, global-fields, all>",
|
|
130
130
|
"multiple": false,
|
|
131
131
|
"options": [
|
|
132
132
|
"content-types",
|
|
@@ -138,13 +138,13 @@
|
|
|
138
138
|
"name": "stack-api-key",
|
|
139
139
|
"type": "option",
|
|
140
140
|
"char": "k",
|
|
141
|
-
"description": "Provide
|
|
141
|
+
"description": "[optional] Provide the stack API key to show the difference between branches.",
|
|
142
142
|
"multiple": false
|
|
143
143
|
},
|
|
144
144
|
"format": {
|
|
145
145
|
"name": "format",
|
|
146
146
|
"type": "option",
|
|
147
|
-
"description": "[
|
|
147
|
+
"description": "[default: compact-text] [optional] Type of flags to show the difference between two branches. <options: compact-text, detailed-text>",
|
|
148
148
|
"multiple": false,
|
|
149
149
|
"options": [
|
|
150
150
|
"compact-text",
|
|
@@ -175,13 +175,13 @@
|
|
|
175
175
|
"name": "stack-api-key",
|
|
176
176
|
"type": "option",
|
|
177
177
|
"char": "k",
|
|
178
|
-
"description": "Stack API
|
|
178
|
+
"description": "Stack API key",
|
|
179
179
|
"multiple": false
|
|
180
180
|
},
|
|
181
181
|
"verbose": {
|
|
182
182
|
"name": "verbose",
|
|
183
183
|
"type": "boolean",
|
|
184
|
-
"description": "Verbose",
|
|
184
|
+
"description": "Verbose, display information in detailed format.",
|
|
185
185
|
"allowNo": false
|
|
186
186
|
}
|
|
187
187
|
},
|
|
@@ -210,50 +210,50 @@
|
|
|
210
210
|
"compare-branch": {
|
|
211
211
|
"name": "compare-branch",
|
|
212
212
|
"type": "option",
|
|
213
|
-
"description": "Compare branch
|
|
213
|
+
"description": "[optional] Compare branch (Source branch).",
|
|
214
214
|
"multiple": false
|
|
215
215
|
},
|
|
216
216
|
"base-branch": {
|
|
217
217
|
"name": "base-branch",
|
|
218
218
|
"type": "option",
|
|
219
|
-
"description": "Base branch",
|
|
219
|
+
"description": "[optional] Base branch (Target branch).",
|
|
220
220
|
"multiple": false
|
|
221
221
|
},
|
|
222
222
|
"comment": {
|
|
223
223
|
"name": "comment",
|
|
224
224
|
"type": "option",
|
|
225
|
-
"description": "
|
|
225
|
+
"description": "[optional] Pass a comment.",
|
|
226
226
|
"multiple": false
|
|
227
227
|
},
|
|
228
228
|
"stack-api-key": {
|
|
229
229
|
"name": "stack-api-key",
|
|
230
230
|
"type": "option",
|
|
231
231
|
"char": "k",
|
|
232
|
-
"description": "Provide
|
|
232
|
+
"description": "[optional] Provide stack API key to show the difference between the branches.",
|
|
233
233
|
"multiple": false
|
|
234
234
|
},
|
|
235
235
|
"export-summary-path": {
|
|
236
236
|
"name": "export-summary-path",
|
|
237
237
|
"type": "option",
|
|
238
|
-
"description": "Export summary file path",
|
|
238
|
+
"description": "[optional] Export summary file path.",
|
|
239
239
|
"multiple": false
|
|
240
240
|
},
|
|
241
241
|
"use-merge-summary": {
|
|
242
242
|
"name": "use-merge-summary",
|
|
243
243
|
"type": "option",
|
|
244
|
-
"description": "Path of merge summary file",
|
|
244
|
+
"description": "[optional] Path of merge summary file.",
|
|
245
245
|
"multiple": false
|
|
246
246
|
},
|
|
247
247
|
"no-revert": {
|
|
248
248
|
"name": "no-revert",
|
|
249
249
|
"type": "boolean",
|
|
250
|
-
"description": "If passed, will not create the new revert branch",
|
|
250
|
+
"description": "[optional] If passed, will not create the new revert branch.",
|
|
251
251
|
"allowNo": false
|
|
252
252
|
},
|
|
253
253
|
"strategy": {
|
|
254
254
|
"name": "strategy",
|
|
255
255
|
"type": "option",
|
|
256
|
-
"description": "Merge strategy",
|
|
256
|
+
"description": "[hidden] Merge strategy.",
|
|
257
257
|
"hidden": true,
|
|
258
258
|
"multiple": false,
|
|
259
259
|
"options": [
|
|
@@ -266,7 +266,7 @@
|
|
|
266
266
|
"strategy-sub-options": {
|
|
267
267
|
"name": "strategy-sub-options",
|
|
268
268
|
"type": "option",
|
|
269
|
-
"description": "Merge strategy sub options",
|
|
269
|
+
"description": "[hidden] Merge strategy sub options.",
|
|
270
270
|
"hidden": true,
|
|
271
271
|
"multiple": false,
|
|
272
272
|
"options": [
|
|
@@ -278,7 +278,7 @@
|
|
|
278
278
|
"merge-action": {
|
|
279
279
|
"name": "merge-action",
|
|
280
280
|
"type": "option",
|
|
281
|
-
"description": "Merge
|
|
281
|
+
"description": "[hidden] Merge action.",
|
|
282
282
|
"hidden": true,
|
|
283
283
|
"multiple": false,
|
|
284
284
|
"options": [
|
package/package.json
CHANGED
|
@@ -1,49 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-branches",
|
|
3
3
|
"description": "Contentstack CLI plugin to do branches operations",
|
|
4
|
-
"version": "1.1
|
|
4
|
+
"version": "1.2.1",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-command": "~1.3.
|
|
9
|
-
"@contentstack/cli-utilities": "~1.8.
|
|
10
|
-
"@oclif/core": "^3.
|
|
11
|
-
"async": "^3.2.4",
|
|
12
|
-
"big-json": "^3.2.0",
|
|
13
|
-
"bluebird": "^3.7.2",
|
|
8
|
+
"@contentstack/cli-command": "~1.3.3",
|
|
9
|
+
"@contentstack/cli-utilities": "~1.8.1",
|
|
10
|
+
"@oclif/core": "^3.27.0",
|
|
14
11
|
"chalk": "^4.1.2",
|
|
15
|
-
"is-valid-path": "^0.1.1",
|
|
16
12
|
"just-diff": "^6.0.2",
|
|
17
|
-
"lodash": "^4.17.
|
|
18
|
-
"merge": "^2.1.1",
|
|
19
|
-
"mkdirp": "^1.0.4",
|
|
20
|
-
"path": "^0.12.7",
|
|
21
|
-
"progress-stream": "^2.0.0",
|
|
22
|
-
"promise-limit": "^2.7.0",
|
|
23
|
-
"proxyquire": "^2.1.3",
|
|
24
|
-
"tslib": "^2.4.1",
|
|
25
|
-
"winston": "^3.7.2"
|
|
13
|
+
"lodash": "^4.17.21"
|
|
26
14
|
},
|
|
27
15
|
"devDependencies": {
|
|
28
|
-
"@contentstack/cli-auth": "~1.3.22",
|
|
29
|
-
"@contentstack/cli-config": "~1.7.3",
|
|
30
16
|
"@contentstack/cli-dev-dependencies": "~1.2.4",
|
|
31
|
-
"@oclif/plugin-help": "^5.
|
|
32
|
-
"@
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"chai": "^4.2.0",
|
|
36
|
-
"dotenv": "^16.0.1",
|
|
17
|
+
"@oclif/plugin-help": "^5.2.20",
|
|
18
|
+
"@types/flat": "^5.0.5",
|
|
19
|
+
"chai": "^4.5.0",
|
|
20
|
+
"dotenv": "^16.4.7",
|
|
37
21
|
"dotenv-expand": "^9.0.0",
|
|
38
|
-
"eslint": "^8.
|
|
22
|
+
"eslint": "^8.57.1",
|
|
39
23
|
"eslint-config-oclif": "^4.0.0",
|
|
40
|
-
"
|
|
41
|
-
"mocha": "10.1.0",
|
|
24
|
+
"mocha": "10.8.2",
|
|
42
25
|
"nyc": "^15.1.0",
|
|
43
|
-
"oclif": "^3.
|
|
44
|
-
"sinon": "^19.0.
|
|
45
|
-
"ts-node": "^10.9.
|
|
46
|
-
"typescript": "^4.9.
|
|
26
|
+
"oclif": "^3.17.2",
|
|
27
|
+
"sinon": "^19.0.2",
|
|
28
|
+
"ts-node": "^10.9.2",
|
|
29
|
+
"typescript": "^4.9.5"
|
|
47
30
|
},
|
|
48
31
|
"scripts": {
|
|
49
32
|
"build": "npm run clean && npm run compile",
|