contensis-cli 1.0.0-beta.47 → 1.0.0-beta.49
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 +651 -74
- package/dist/commands/diff.js +2 -2
- package/dist/commands/diff.js.map +2 -2
- package/dist/commands/get.js +18 -7
- package/dist/commands/get.js.map +2 -2
- package/dist/commands/list.js +8 -8
- package/dist/commands/list.js.map +2 -2
- package/dist/commands/push.js +2 -2
- package/dist/commands/push.js.map +2 -2
- package/dist/commands/release.js +2 -2
- package/dist/commands/release.js.map +2 -2
- package/dist/commands/remove.js +5 -5
- package/dist/commands/remove.js.map +2 -2
- package/dist/commands/set.js +11 -6
- package/dist/commands/set.js.map +2 -2
- package/dist/services/ContensisCliService.js +20 -0
- package/dist/services/ContensisCliService.js.map +2 -2
- package/dist/shell.js +1 -0
- package/dist/shell.js.map +2 -2
- package/dist/util/console.printer.js +78 -32
- package/dist/util/console.printer.js.map +2 -2
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -2
- package/src/commands/diff.ts +2 -0
- package/src/commands/get.ts +24 -7
- package/src/commands/list.ts +8 -7
- package/src/commands/push.ts +2 -0
- package/src/commands/release.ts +2 -0
- package/src/commands/remove.ts +7 -1
- package/src/commands/set.ts +11 -1
- package/src/services/ContensisCliService.ts +26 -0
- package/src/shell.ts +1 -0
- package/src/util/console.printer.ts +126 -70
- package/src/version.ts +1 -1
|
@@ -107,7 +107,17 @@ export const printBlockVersion = (
|
|
|
107
107
|
export const printMigrateResult = (
|
|
108
108
|
{ log, messages, contensis, currentProject }: ContensisCli,
|
|
109
109
|
migrateResult: any,
|
|
110
|
-
{
|
|
110
|
+
{
|
|
111
|
+
action = 'import',
|
|
112
|
+
showDiff = false,
|
|
113
|
+
showAllEntries = false,
|
|
114
|
+
showChangedEntries = false,
|
|
115
|
+
}: {
|
|
116
|
+
action?: 'import' | 'delete';
|
|
117
|
+
showDiff?: boolean;
|
|
118
|
+
showAllEntries?: boolean;
|
|
119
|
+
showChangedEntries?: boolean;
|
|
120
|
+
} = {}
|
|
111
121
|
) => {
|
|
112
122
|
if (Object.keys(migrateResult.entriesToMigrate.entryIds).length)
|
|
113
123
|
console.log(``);
|
|
@@ -119,43 +129,53 @@ export const printMigrateResult = (
|
|
|
119
129
|
string,
|
|
120
130
|
any
|
|
121
131
|
][]) {
|
|
122
|
-
console.log(`${log.helpText(contentTypeId)} ${entryStatus.entryTitle}`);
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
132
|
+
// console.log(`${log.helpText(contentTypeId)} ${entryStatus.entryTitle}`);
|
|
133
|
+
if (
|
|
134
|
+
showAllEntries ||
|
|
135
|
+
(showChangedEntries &&
|
|
136
|
+
(
|
|
137
|
+
Object.entries(
|
|
138
|
+
Object.entries(entryStatus[currentProject])[0]
|
|
139
|
+
)[1][1] as any
|
|
140
|
+
).status !== 'no change')
|
|
141
|
+
) {
|
|
142
|
+
console.log(
|
|
143
|
+
log.infoText(
|
|
144
|
+
`${originalId} ${Object.entries(entryStatus || {})
|
|
145
|
+
.filter(x => x[0] !== 'entryTitle')
|
|
146
|
+
.map(([projectId, projectStatus]) => {
|
|
147
|
+
const [targetGuid, { status }] = (Object.entries(
|
|
148
|
+
projectStatus || {}
|
|
149
|
+
)?.[0] as [string, { status: MigrateStatus }]) || [
|
|
150
|
+
'',
|
|
151
|
+
{ x: { status: undefined } },
|
|
152
|
+
];
|
|
153
|
+
return `${messages.migrate.status(status)(`${status}`)}${
|
|
154
|
+
targetGuid !== originalId ? `-> ${targetGuid}` : ''
|
|
155
|
+
}`;
|
|
156
|
+
})}`
|
|
157
|
+
) + ` ${log.helpText(contentTypeId)} ${entryStatus.entryTitle}`
|
|
158
|
+
);
|
|
140
159
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
160
|
+
for (const [projectId, projectStatus] of Object.entries(
|
|
161
|
+
entryStatus
|
|
162
|
+
).filter(([key]) => key !== 'entryTitle') as [string, any][]) {
|
|
163
|
+
const [targetGuid, { error, diff, status }] = Object.entries(
|
|
164
|
+
projectStatus
|
|
165
|
+
)[0] as [string, any];
|
|
166
|
+
if (error) log.error(error);
|
|
167
|
+
if (diff && showDiff) {
|
|
168
|
+
console.log(
|
|
169
|
+
` ${log.highlightText(`diff:`)} ${log.infoText(
|
|
170
|
+
highlightDiffText(diff)
|
|
171
|
+
)}\n`
|
|
172
|
+
);
|
|
173
|
+
}
|
|
154
174
|
}
|
|
155
175
|
}
|
|
156
176
|
}
|
|
157
|
-
console.log(``);
|
|
158
177
|
}
|
|
178
|
+
console.log(``);
|
|
159
179
|
if (
|
|
160
180
|
contensis?.isPreview &&
|
|
161
181
|
migrateResult.entriesToMigrate?.[currentProject]?.totalCount > 0 &&
|
|
@@ -164,44 +184,80 @@ export const printMigrateResult = (
|
|
|
164
184
|
log.help(messages.entries.commitTip());
|
|
165
185
|
}
|
|
166
186
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
187
|
+
if (action === 'import') {
|
|
188
|
+
for (const [projectId, contentTypeCounts] of Object.entries(
|
|
189
|
+
migrateResult.entries || {}
|
|
190
|
+
) as [string, any][]) {
|
|
191
|
+
log.help(
|
|
192
|
+
`import from project ${log.highlightText(projectId)} to ${log.boldText(
|
|
193
|
+
log.warningText(currentProject)
|
|
194
|
+
)}`
|
|
195
|
+
);
|
|
196
|
+
for (const [contentTypeId, count] of Object.entries(
|
|
197
|
+
contentTypeCounts
|
|
198
|
+
) as [string, number][]) {
|
|
199
|
+
const entriesToMigrate =
|
|
200
|
+
migrateResult.entriesToMigrate?.[projectId]?.[contentTypeId];
|
|
201
|
+
const existingCount =
|
|
202
|
+
migrateResult.existing?.[projectId]?.[contentTypeId] || 0;
|
|
203
|
+
const existingPercent = ((existingCount / count) * 100).toFixed(0);
|
|
204
|
+
const noChangeOrTotalEntriesCount =
|
|
205
|
+
typeof entriesToMigrate !== 'number'
|
|
206
|
+
? entriesToMigrate?.['no change'] || 0
|
|
207
|
+
: entriesToMigrate;
|
|
208
|
+
|
|
209
|
+
const isTotalCountRow = contentTypeId === 'totalCount';
|
|
210
|
+
|
|
211
|
+
const changedPercentage = (
|
|
212
|
+
(noChangeOrTotalEntriesCount / count) *
|
|
213
|
+
100
|
|
214
|
+
).toFixed(0);
|
|
182
215
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
216
|
+
const existingColor =
|
|
217
|
+
existingPercent === '0' ? log.warningText : log.infoText;
|
|
218
|
+
const changedColor = isTotalCountRow
|
|
219
|
+
? log.helpText
|
|
220
|
+
: changedPercentage === '100'
|
|
221
|
+
? log.successText
|
|
222
|
+
: log.warningText;
|
|
223
|
+
|
|
224
|
+
console.log(
|
|
225
|
+
` - ${
|
|
226
|
+
isTotalCountRow
|
|
227
|
+
? log.highlightText(`${contentTypeId}: ${count}`)
|
|
228
|
+
: `${contentTypeId}: ${log.helpText(count)}`
|
|
229
|
+
}${
|
|
230
|
+
changedPercentage === '100'
|
|
231
|
+
? ''
|
|
232
|
+
: existingColor(
|
|
233
|
+
` [existing: ${
|
|
234
|
+
isTotalCountRow ? existingCount : `${existingPercent}%`
|
|
235
|
+
}]`
|
|
236
|
+
)
|
|
237
|
+
}${
|
|
238
|
+
existingPercent === '0'
|
|
239
|
+
? ''
|
|
240
|
+
: changedColor(
|
|
241
|
+
` ${
|
|
242
|
+
isTotalCountRow
|
|
243
|
+
? `[to change: ${noChangeOrTotalEntriesCount}]`
|
|
244
|
+
: changedPercentage === '100'
|
|
245
|
+
? 'up to date'
|
|
246
|
+
: `[needs update: ${100 - Number(changedPercentage)}%]`
|
|
247
|
+
}`
|
|
248
|
+
)
|
|
249
|
+
}`
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (migrateResult.errors?.length) {
|
|
254
|
+
console.log(
|
|
255
|
+
` - ${log.errorText(`errors: ${migrateResult.errors.length}`)}\n`
|
|
256
|
+
);
|
|
257
|
+
for (const error of migrateResult.errors)
|
|
258
|
+
log.error(error.message || error);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
205
261
|
};
|
|
206
262
|
|
|
207
263
|
const highlightDiffText = (str: string) => {
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "1.0.0-beta.
|
|
1
|
+
export const LIB_VERSION = "1.0.0-beta.49";
|