contensis-cli 1.0.12-beta.3 → 1.0.12-beta.5
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 +9 -9
- package/dist/commands/get.js +1 -1
- package/dist/commands/get.js.map +1 -1
- package/dist/commands/globalOptions.js +8 -1
- package/dist/commands/globalOptions.js.map +2 -2
- package/dist/commands/import.js +9 -6
- package/dist/commands/import.js.map +2 -2
- package/dist/services/ContensisCliService.js +13 -15
- package/dist/services/ContensisCliService.js.map +2 -2
- package/dist/util/console.printer.js +9 -11
- 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 +4 -4
- package/src/commands/get.ts +1 -1
- package/src/commands/globalOptions.ts +8 -0
- package/src/commands/import.ts +16 -4
- package/src/services/ContensisCliService.ts +10 -16
- package/src/util/console.printer.ts +23 -19
- package/src/version.ts +1 -1
|
@@ -240,22 +240,20 @@ const printNodesMigrateResult = ({ log, messages, currentProject }, migrateResul
|
|
|
240
240
|
if (showAll || showChanged)
|
|
241
241
|
console.log(``);
|
|
242
242
|
for (const [projectId, counts] of Object.entries(migrateResult.nodes || {})) {
|
|
243
|
-
log.
|
|
244
|
-
|
|
245
|
-
log.warningText(currentProject)
|
|
246
|
-
)}`}`
|
|
247
|
-
);
|
|
243
|
+
const importTitle = action === "delete" ? `Delete from project ${log.warningText(currentProject)}` : `Import ${projectId && projectId !== "null" ? `from project ${log.highlightText(projectId)} ` : ""}to ${log.boldText(log.warningText(currentProject))}`;
|
|
244
|
+
log.help(importTitle);
|
|
248
245
|
const migrateStatusAndCount = migrateResult.nodesToMigrate[currentProject];
|
|
249
246
|
const existingCount = ((_b = (_a = migrateResult.existing) == null ? void 0 : _a[currentProject]) == null ? void 0 : _b.totalCount) || 0;
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
);
|
|
253
|
-
const
|
|
254
|
-
const changedPercentage = (noChangeOrTotalEntriesCount / counts.totalCount * 100).toFixed(0);
|
|
247
|
+
const totalCount = Object.keys(migrateResult.nodesToMigrate.nodeIds).length;
|
|
248
|
+
const existingPercent = counts.totalCount ? (existingCount / totalCount * 100).toFixed(0) : "0";
|
|
249
|
+
const noChangeCount = (migrateStatusAndCount == null ? void 0 : migrateStatusAndCount["no change"]) || 0;
|
|
250
|
+
const changedPercentage = counts.totalCount ? (noChangeCount / totalCount * 100).toFixed(0) : "0";
|
|
255
251
|
const existingColor = existingPercent === "0" || action === "delete" ? log.warningText : log.infoText;
|
|
256
252
|
const changedColor = changedPercentage === "100" ? log.successText : log.warningText;
|
|
257
253
|
console.log(
|
|
258
|
-
` - ${log.highlightText(
|
|
254
|
+
` - ${log.highlightText(
|
|
255
|
+
`totalCount: ${migrateStatusAndCount.totalCount}`
|
|
256
|
+
)}${changedPercentage === "100" ? "" : existingColor(` [existing: ${`${existingPercent}%`}]`)}${existingPercent === "0" ? "" : changedColor(
|
|
259
257
|
` ${changedPercentage === "100" ? "up to date" : `[needs update: ${100 - Number(changedPercentage)}%]`}`
|
|
260
258
|
)}`
|
|
261
259
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/util/console.printer.ts"],
|
|
4
|
-
"sourcesContent": ["import { Node } from 'contensis-delivery-api/lib/models';\nimport dayjs from 'dayjs';\nimport {\n BlockVersion,\n EntriesResult,\n MigrateModelsResult,\n MigrateStatus,\n NodesResult,\n ProjectNodesToMigrate,\n} from 'migratortron';\nimport ContensisCli from '~/services/ContensisCliService';\nimport { Logger } from './logger';\n\nconst formatDate = (date: Date | string, format = 'DD/MM/YYYY HH:mm') =>\n dayjs(date).format(format);\n\nexport const printBlockVersion = (\n { log, messages }: ContensisCli,\n block: BlockVersion,\n printOptions = {\n showSource: true,\n showStatus: true,\n showStaticPaths: true,\n showImage: true,\n }\n) => {\n console.log(\n ` ${log.standardText(`v${block.version.versionNo}`)} ${block.id}`\n );\n console.log(\n ` state: ${messages.blocks.runningStatus(\n block.status.broken ? 'broken' : block.status.running.global\n )}`\n );\n console.log(\n ` released: ${log.infoText(\n block.version.released\n ? `[${formatDate(block.version.released)}] ${block.version.releasedBy}`\n : 'no'\n )}`\n );\n if (block.version.madeLive)\n console.log(\n ` live: ${log.infoText(\n `[${formatDate(block.version.madeLive)}] ${block.version.madeLiveBy}`\n )}`\n );\n if (printOptions.showStatus) {\n console.log(` status:`);\n console.log(` deployment: ${log.infoText(block.status.deployment)}`);\n console.log(` workflow: ${log.infoText(block.status.workflow)}`);\n console.log(\n ` running status: ${messages.blocks.runningStatus(\n block.status.running.global\n )}`\n );\n console.log(` datacentres:`);\n console.log(\n ` hq: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.hq\n )}`\n );\n console.log(\n ` london: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.london\n )}`\n );\n console.log(\n ` manchester: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.manchester\n )}`\n );\n }\n if (printOptions.showSource) {\n console.log(` source:`);\n console.log(` commit: ${log.helpText(block.source.commit.id)}`);\n console.log(\n ` message: ${log.infoText(\n block.source.commit.message\n ?.replaceAll('\\n', '\\\\n')\n .replaceAll('\\\\n\\\\n', '\\\\n')\n .replaceAll('\\\\n', '; ')\n )}`\n );\n console.log(\n ` committed: ${log.infoText(\n `[${formatDate(block.source.commit.dateTime)}] ${\n block.source.commit.authorEmail\n }`\n )}`\n );\n console.log(\n ` pushed: ${log.infoText(\n `[${formatDate(block.version.pushed)}] ${block.version.pushedBy}`\n )}`\n );\n console.log(` ${log.infoText(block.source.commit.commitUrl)}`);\n }\n if (printOptions.showImage) {\n console.log(` image:`);\n console.log(` uri: ${log.infoText(block.image.uri)}`);\n console.log(` tag: ${log.helpText(block.image.tag)}`);\n }\n if (printOptions.showStaticPaths) {\n if (block.staticPaths?.length) {\n console.log(` static paths:`);\n for (const path of block.staticPaths) console.log(` - ${path}`);\n }\n }\n if (block.stagingUrl)\n console.log(` staging url: ${log.infoText(block.stagingUrl)}`);\n console.log('');\n};\n\nexport const printEntriesMigrateResult = (\n { log, messages, currentProject }: ContensisCli,\n migrateResult: EntriesResult,\n {\n action = 'import',\n showDiff = false,\n showAll = false,\n showChanged = false,\n }: {\n action?: 'import' | 'delete';\n showDiff?: boolean;\n showAll?: boolean;\n showChanged?: boolean;\n } = {}\n) => {\n console.log(``);\n\n for (const [contentTypeId, entryRes] of Object.entries(\n migrateResult.entriesToMigrate.entryIds\n ) as [string, any]) {\n for (const [originalId, entryStatus] of Object.entries(entryRes) as [\n string,\n any\n ][]) {\n if (\n showAll ||\n (showChanged &&\n (\n Object.entries(\n Object.entries(entryStatus[currentProject])[0]\n )[1][1] as any\n ).status !== 'no change')\n ) {\n console.log(\n log.infoText(\n `${originalId} ${Object.entries(entryStatus || {})\n .filter(x => x[0] !== 'entryTitle')\n .map(([projectId, projectStatus]) => {\n const [targetGuid, { status }] = (Object.entries(\n projectStatus || {}\n )?.[0] as [string, { status: MigrateStatus }]) || [\n '',\n { x: { status: undefined } },\n ];\n return `${messages.migrate.status(status)(`${status}`)}${\n targetGuid !== originalId ? `-> ${targetGuid}` : ''\n }`;\n })}`\n ) + ` ${log.helpText(contentTypeId)} ${entryStatus.entryTitle}`\n );\n\n for (const [projectId, projectStatus] of Object.entries(\n entryStatus\n ).filter(([key]) => key !== 'entryTitle') as [string, any][]) {\n const [targetGuid, { error, diff, status }] = Object.entries(\n projectStatus\n )[0] as [string, any];\n if (error) log.error(error);\n if (diff && showDiff) {\n console.log(\n ` ${log.highlightText(`diff:`)} ${log.infoText(\n highlightDiffText(diff)\n )}\\n`\n );\n }\n }\n }\n }\n }\n if (showAll || showChanged) console.log(``);\n\n for (const [projectId, contentTypeCounts] of Object.entries(\n migrateResult.entries || {}\n ) as [string, any][]) {\n log.help(\n `${action} from project ${\n action === 'delete'\n ? log.warningText(currentProject)\n : `${log.highlightText(projectId)} to ${log.boldText(\n log.warningText(currentProject)\n )}`\n }`\n );\n for (const [contentTypeId, count] of Object.entries(contentTypeCounts) as [\n string,\n number\n ][]) {\n const isTotalCountRow = contentTypeId === 'totalCount';\n const migrateStatusAndCount =\n migrateResult.entriesToMigrate[currentProject][contentTypeId];\n const existingCount =\n migrateResult.existing?.[currentProject]?.[contentTypeId] || 0;\n const existingPercent = ((existingCount / count) * 100).toFixed(0);\n const noChangeOrTotalEntriesCount =\n typeof migrateStatusAndCount !== 'number'\n ? migrateStatusAndCount?.['no change'] || 0\n : migrateStatusAndCount;\n\n const changedPercentage = (\n (noChangeOrTotalEntriesCount / count) *\n 100\n ).toFixed(0);\n\n const existingColor =\n existingPercent === '0' || action === 'delete'\n ? log.warningText\n : log.infoText;\n\n const changedColor = isTotalCountRow\n ? log.helpText\n : changedPercentage === '100'\n ? log.successText\n : log.warningText;\n\n console.log(\n ` - ${\n isTotalCountRow\n ? log.highlightText(\n `${contentTypeId}: ${noChangeOrTotalEntriesCount}`\n )\n : `${contentTypeId}: ${log.helpText(count)}`\n }${\n changedPercentage === '100' || isTotalCountRow\n ? ''\n : existingColor(` [existing: ${`${existingPercent}%`}]`)\n }${\n existingPercent === '0' || (action === 'import' && isTotalCountRow)\n ? ''\n : changedColor(\n ` ${\n isTotalCountRow\n ? `[to ${action}: ${noChangeOrTotalEntriesCount}]`\n : changedPercentage === '100'\n ? 'up to date'\n : `[needs update: ${100 - Number(changedPercentage)}%]`\n }`\n )\n }`\n );\n }\n }\n if (migrateResult.errors?.length) {\n console.log(\n ` - ${log.errorText(`errors: ${migrateResult.errors.length}`)}\\n`\n );\n for (const error of migrateResult.errors)\n log.error(error.message, null, '');\n }\n};\n\nexport const printNodesMigrateResult = (\n { log, messages, currentProject }: ContensisCli,\n migrateResult: NodesResult,\n {\n action = 'import',\n showDiff = false,\n showAll = false,\n showChanged = false,\n }: {\n action?: 'import' | 'delete';\n showDiff?: boolean;\n showAll?: boolean;\n showChanged?: boolean;\n } = {}\n) => {\n console.log(``);\n\n for (const [originalId, migrateNodeId] of Object.entries(\n migrateResult.nodesToMigrate.nodeIds\n )) {\n if (showAll || (showChanged && migrateNodeId.status !== 'no change')) {\n console.log(\n log.infoText(\n `${originalId} ${`${messages.migrate.status(migrateNodeId.status)(\n `${migrateNodeId.status}`\n )}${\n migrateNodeId.id !== originalId ? `-> ${migrateNodeId.id}` : ''\n }`}`\n ) + ` ${log.helpText(migrateNodeId.path)} ${migrateNodeId.displayName}`\n );\n\n if (migrateNodeId.diff && showDiff)\n console.log(\n ` ${log.highlightText(`diff:`)} ${log.infoText(\n highlightDiffText(migrateNodeId.diff)\n )}\\n`\n );\n }\n }\n if (showAll || showChanged) console.log(``);\n\n for (const [projectId, counts] of Object.entries(migrateResult.nodes || {})) {\n log.help(\n `${action} from project ${\n action === 'delete'\n ? log.warningText(currentProject)\n : `${log.highlightText(projectId)} to ${log.boldText(\n log.warningText(currentProject)\n )}`\n }`\n );\n\n const migrateStatusAndCount = migrateResult.nodesToMigrate[\n currentProject\n ] as ProjectNodesToMigrate;\n\n const existingCount =\n migrateResult.existing?.[currentProject]?.totalCount || 0;\n const existingPercent = ((existingCount / counts.totalCount) * 100).toFixed(\n 0\n );\n const noChangeOrTotalEntriesCount =\n migrateStatusAndCount?.['no change'] || 0;\n const changedPercentage = (\n (noChangeOrTotalEntriesCount / counts.totalCount) *\n 100\n ).toFixed(0);\n\n const existingColor =\n existingPercent === '0' || action === 'delete'\n ? log.warningText\n : log.infoText;\n\n const changedColor =\n changedPercentage === '100' ? log.successText : log.warningText;\n\n console.log(\n ` - ${log.highlightText(`totalCount: ${counts.totalCount}`)}${\n changedPercentage === '100'\n ? ''\n : existingColor(` [existing: ${`${existingPercent}%`}]`)\n }${\n existingPercent === '0'\n ? ''\n : changedColor(\n ` ${\n changedPercentage === '100'\n ? 'up to date'\n : `[needs update: ${100 - Number(changedPercentage)}%]`\n }`\n )\n }`\n );\n }\n if (migrateResult.errors?.length) {\n console.log(\n ` - ${log.errorText(`errors: ${migrateResult.errors.length}`)}\\n`\n );\n for (const error of migrateResult.errors) {\n let inner = '';\n if (error.data?.[0]) {\n inner = `${error.data?.[0].Field}: ${error.data?.[0].Message}`;\n }\n log.error(`${error.message} ${inner}`, null, '');\n }\n }\n};\nconst highlightDiffText = (str: string) => {\n const addedRegex = new RegExp(/<<\\+>>(.*?)<<\\/\\+>>/, 'g');\n const removedRegex = new RegExp(/<<->>(.*?)<<\\/->>/, 'g');\n return str\n .replace(addedRegex, match => {\n return Logger.successText(\n match.replace(/<<\\+>>/g, '<+>').replace(/<<\\/\\+>>/g, '</+>')\n );\n })\n .replace(removedRegex, match => {\n return Logger.errorText(\n match.replace(/<<->>/g, '<->').replace(/<<\\/->>/g, '</->')\n );\n });\n};\n\nexport const printModelMigrationAnalysis = (\n { log, messages }: ContensisCli,\n result: any = {}\n) => {\n for (const [contentTypeId, model] of Object.entries(result) as [\n string,\n any\n ][]) {\n let mainOutput = log.standardText(` - ${contentTypeId}`);\n let extraOutput = '';\n let errorOutput = '';\n let diffOutput = '';\n for (const [key, details] of Object.entries(model) as [string, any][]) {\n if (key === 'dependencies') {\n extraOutput += log.infoText(\n ` references: [${details?.join(', ')}]\\n`\n );\n }\n if (key === 'dependencyOf') {\n extraOutput += log.infoText(\n ` required by: [${details?.join(', ')}]\\n`\n );\n }\n if (key === 'projects') {\n for (const [projectId, projectDetails] of Object.entries(details) as [\n string,\n any\n ][]) {\n mainOutput += log.infoText(\n ` [${messages.migrate.status(projectDetails.status)(\n `${projectId}: ${projectDetails.status}`\n )}] v${projectDetails.versionNo}`\n );\n if (projectDetails.diff)\n diffOutput += ` ${log.highlightText(`diff:`)} ${log.infoText(\n highlightDiffText(projectDetails.diff)\n )}\\n`;\n if (projectDetails.error)\n errorOutput += ` ${log.highlightText(\n `error::`\n )} ${log.errorText(projectDetails.error)}`;\n }\n }\n }\n console.log(mainOutput);\n if (extraOutput) {\n const search = '\\n';\n const replace = '';\n console.log(\n extraOutput.replace(\n new RegExp(search + '([^' + search + ']*)$'),\n replace + '$1'\n )\n );\n }\n if (diffOutput) console.log(diffOutput);\n if (errorOutput) console.log(errorOutput);\n }\n};\n\ntype MigrateResultSummary = MigrateModelsResult['']['contentTypes'];\ntype MigrateResultStatus = keyof MigrateResultSummary;\n\nexport const printModelMigrationResult = (\n { log, messages }: ContensisCli,\n result: MigrateResultSummary\n) => {\n for (const [status, ids] of Object.entries(result) as [\n MigrateResultStatus,\n string[]\n ][]) {\n if (ids?.length) {\n if (status === 'errors') {\n const errors: [string, MappedError][] = ids as any;\n log.raw(\n ` - ${status}: [ ${messages.migrate.models.result(status)(\n ids.map(id => id[0]).join(', ')\n )} ]\\n`\n );\n for (const [contentTypeId, error] of errors)\n log.error(\n `${log.highlightText(contentTypeId)}: ${error.message}`,\n error\n );\n } else\n log.raw(\n ` - ${status}: [ ${messages.migrate.models.result(status)(\n ids.join(', ')\n )} ]`\n );\n }\n }\n};\n\nexport const printNodeTreeOutput = (\n { log }: ContensisCli,\n root: Node | undefined\n) => {\n log.object({ ...root, children: undefined });\n log.raw('');\n log.info(\n `${log.highlightText('e')} = has entry; ${log.highlightText(\n 'c'\n )} = canonical; ${log.highlightText('m')} = include in menu`\n );\n log.line();\n\n const outputNode = (node: Node | any, spaces: string) =>\n `${node.entry ? log.highlightText('e') : log.infoText('-')}${\n node.isCanonical ? log.highlightText('c') : log.infoText('-')\n }${\n node.includeInMenu ? log.highlightText('m') : log.infoText('-')\n }${spaces}${\n node.isCanonical ? log.boldText(`/${node.slug}`) : `/${node.slug}`\n }${node.entry ? ` ${log.helpText(node.entry.sys.contentTypeId)}` : ''}${\n node.childCount ? ` +${node.childCount}` : ``\n } ${log.infoText(node.displayName)}`;\n\n const outputChildren = (root: Node | undefined, depth = 2) => {\n let str = '';\n for (const node of (root as any)?.children as Node[]) {\n str += `${outputNode(node, Array(depth + 1).join(' '))}\\n`;\n if ('children' in node) str += outputChildren(node, depth + 1);\n }\n return str;\n };\n\n const children = outputChildren(root);\n log.limits(\n `${outputNode(root, ' ')}${children ? `\\n${children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J;AAAA,EACF;AACA,MAAI,WAAW;AAAa,YAAQ,IAAI,EAAE;AAE1C,aAAW,CAAC,WAAW,MAAM,KAAK,OAAO,QAAQ,cAAc,SAAS,CAAC,CAAC,GAAG;AAC3E,
|
|
4
|
+
"sourcesContent": ["import { Node } from 'contensis-delivery-api/lib/models';\nimport dayjs from 'dayjs';\nimport {\n BlockVersion,\n EntriesResult,\n MigrateModelsResult,\n MigrateStatus,\n NodesResult,\n ProjectNodesToMigrate,\n} from 'migratortron';\nimport ContensisCli from '~/services/ContensisCliService';\nimport { Logger } from './logger';\n\nconst formatDate = (date: Date | string, format = 'DD/MM/YYYY HH:mm') =>\n dayjs(date).format(format);\n\nexport const printBlockVersion = (\n { log, messages }: ContensisCli,\n block: BlockVersion,\n printOptions = {\n showSource: true,\n showStatus: true,\n showStaticPaths: true,\n showImage: true,\n }\n) => {\n console.log(\n ` ${log.standardText(`v${block.version.versionNo}`)} ${block.id}`\n );\n console.log(\n ` state: ${messages.blocks.runningStatus(\n block.status.broken ? 'broken' : block.status.running.global\n )}`\n );\n console.log(\n ` released: ${log.infoText(\n block.version.released\n ? `[${formatDate(block.version.released)}] ${block.version.releasedBy}`\n : 'no'\n )}`\n );\n if (block.version.madeLive)\n console.log(\n ` live: ${log.infoText(\n `[${formatDate(block.version.madeLive)}] ${block.version.madeLiveBy}`\n )}`\n );\n if (printOptions.showStatus) {\n console.log(` status:`);\n console.log(` deployment: ${log.infoText(block.status.deployment)}`);\n console.log(` workflow: ${log.infoText(block.status.workflow)}`);\n console.log(\n ` running status: ${messages.blocks.runningStatus(\n block.status.running.global\n )}`\n );\n console.log(` datacentres:`);\n console.log(\n ` hq: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.hq\n )}`\n );\n console.log(\n ` london: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.london\n )}`\n );\n console.log(\n ` manchester: ${messages.blocks.runningStatus(\n block.status.running.dataCenters.manchester\n )}`\n );\n }\n if (printOptions.showSource) {\n console.log(` source:`);\n console.log(` commit: ${log.helpText(block.source.commit.id)}`);\n console.log(\n ` message: ${log.infoText(\n block.source.commit.message\n ?.replaceAll('\\n', '\\\\n')\n .replaceAll('\\\\n\\\\n', '\\\\n')\n .replaceAll('\\\\n', '; ')\n )}`\n );\n console.log(\n ` committed: ${log.infoText(\n `[${formatDate(block.source.commit.dateTime)}] ${\n block.source.commit.authorEmail\n }`\n )}`\n );\n console.log(\n ` pushed: ${log.infoText(\n `[${formatDate(block.version.pushed)}] ${block.version.pushedBy}`\n )}`\n );\n console.log(` ${log.infoText(block.source.commit.commitUrl)}`);\n }\n if (printOptions.showImage) {\n console.log(` image:`);\n console.log(` uri: ${log.infoText(block.image.uri)}`);\n console.log(` tag: ${log.helpText(block.image.tag)}`);\n }\n if (printOptions.showStaticPaths) {\n if (block.staticPaths?.length) {\n console.log(` static paths:`);\n for (const path of block.staticPaths) console.log(` - ${path}`);\n }\n }\n if (block.stagingUrl)\n console.log(` staging url: ${log.infoText(block.stagingUrl)}`);\n console.log('');\n};\n\nexport const printEntriesMigrateResult = (\n { log, messages, currentProject }: ContensisCli,\n migrateResult: EntriesResult,\n {\n action = 'import',\n showDiff = false,\n showAll = false,\n showChanged = false,\n }: {\n action?: 'import' | 'delete';\n showDiff?: boolean;\n showAll?: boolean;\n showChanged?: boolean;\n } = {}\n) => {\n console.log(``);\n\n for (const [contentTypeId, entryRes] of Object.entries(\n migrateResult.entriesToMigrate.entryIds\n ) as [string, any]) {\n for (const [originalId, entryStatus] of Object.entries(entryRes) as [\n string,\n any\n ][]) {\n if (\n showAll ||\n (showChanged &&\n (\n Object.entries(\n Object.entries(entryStatus[currentProject])[0]\n )[1][1] as any\n ).status !== 'no change')\n ) {\n console.log(\n log.infoText(\n `${originalId} ${Object.entries(entryStatus || {})\n .filter(x => x[0] !== 'entryTitle')\n .map(([projectId, projectStatus]) => {\n const [targetGuid, { status }] = (Object.entries(\n projectStatus || {}\n )?.[0] as [string, { status: MigrateStatus }]) || [\n '',\n { x: { status: undefined } },\n ];\n return `${messages.migrate.status(status)(`${status}`)}${\n targetGuid !== originalId ? `-> ${targetGuid}` : ''\n }`;\n })}`\n ) + ` ${log.helpText(contentTypeId)} ${entryStatus.entryTitle}`\n );\n\n for (const [projectId, projectStatus] of Object.entries(\n entryStatus\n ).filter(([key]) => key !== 'entryTitle') as [string, any][]) {\n const [targetGuid, { error, diff, status }] = Object.entries(\n projectStatus\n )[0] as [string, any];\n if (error) log.error(error);\n if (diff && showDiff) {\n console.log(\n ` ${log.highlightText(`diff:`)} ${log.infoText(\n highlightDiffText(diff)\n )}\\n`\n );\n }\n }\n }\n }\n }\n if (showAll || showChanged) console.log(``);\n\n for (const [projectId, contentTypeCounts] of Object.entries(\n migrateResult.entries || {}\n ) as [string, any][]) {\n log.help(\n `${action} from project ${\n action === 'delete'\n ? log.warningText(currentProject)\n : `${log.highlightText(projectId)} to ${log.boldText(\n log.warningText(currentProject)\n )}`\n }`\n );\n for (const [contentTypeId, count] of Object.entries(contentTypeCounts) as [\n string,\n number\n ][]) {\n const isTotalCountRow = contentTypeId === 'totalCount';\n const migrateStatusAndCount =\n migrateResult.entriesToMigrate[currentProject][contentTypeId];\n const existingCount =\n migrateResult.existing?.[currentProject]?.[contentTypeId] || 0;\n const existingPercent = ((existingCount / count) * 100).toFixed(0);\n const noChangeOrTotalEntriesCount =\n typeof migrateStatusAndCount !== 'number'\n ? migrateStatusAndCount?.['no change'] || 0\n : migrateStatusAndCount;\n\n const changedPercentage = (\n (noChangeOrTotalEntriesCount / count) *\n 100\n ).toFixed(0);\n\n const existingColor =\n existingPercent === '0' || action === 'delete'\n ? log.warningText\n : log.infoText;\n\n const changedColor = isTotalCountRow\n ? log.helpText\n : changedPercentage === '100'\n ? log.successText\n : log.warningText;\n\n console.log(\n ` - ${\n isTotalCountRow\n ? log.highlightText(\n `${contentTypeId}: ${noChangeOrTotalEntriesCount}`\n )\n : `${contentTypeId}: ${log.helpText(count)}`\n }${\n changedPercentage === '100' || isTotalCountRow\n ? ''\n : existingColor(` [existing: ${`${existingPercent}%`}]`)\n }${\n existingPercent === '0' || (action === 'import' && isTotalCountRow)\n ? ''\n : changedColor(\n ` ${\n isTotalCountRow\n ? `[to ${action}: ${noChangeOrTotalEntriesCount}]`\n : changedPercentage === '100'\n ? 'up to date'\n : `[needs update: ${100 - Number(changedPercentage)}%]`\n }`\n )\n }`\n );\n }\n }\n if (migrateResult.errors?.length) {\n console.log(\n ` - ${log.errorText(`errors: ${migrateResult.errors.length}`)}\\n`\n );\n for (const error of migrateResult.errors)\n log.error(error.message, null, '');\n }\n};\n\nexport const printNodesMigrateResult = (\n { log, messages, currentProject }: ContensisCli,\n migrateResult: NodesResult,\n {\n action = 'import',\n showDiff = false,\n showAll = false,\n showChanged = false,\n }: {\n action?: 'import' | 'delete';\n showDiff?: boolean;\n showAll?: boolean;\n showChanged?: boolean;\n } = {}\n) => {\n console.log(``);\n\n for (const [originalId, migrateNodeId] of Object.entries(\n migrateResult.nodesToMigrate.nodeIds\n )) {\n if (showAll || (showChanged && migrateNodeId.status !== 'no change')) {\n console.log(\n log.infoText(\n `${originalId} ${`${messages.migrate.status(migrateNodeId.status)(\n `${migrateNodeId.status}`\n )}${\n migrateNodeId.id !== originalId ? `-> ${migrateNodeId.id}` : ''\n }`}`\n ) + ` ${log.helpText(migrateNodeId.path)} ${migrateNodeId.displayName}`\n );\n\n if (migrateNodeId.diff && showDiff)\n console.log(\n ` ${log.highlightText(`diff:`)} ${log.infoText(\n highlightDiffText(migrateNodeId.diff)\n )}\\n`\n );\n }\n }\n if (showAll || showChanged) console.log(``);\n\n for (const [projectId, counts] of Object.entries(migrateResult.nodes || {})) {\n const importTitle =\n action === 'delete'\n ? `Delete from project ${log.warningText(currentProject)}`\n : `Import ${\n projectId && projectId !== 'null'\n ? `from project ${log.highlightText(projectId)} `\n : ''\n }to ${log.boldText(log.warningText(currentProject))}`;\n log.help(importTitle);\n\n const migrateStatusAndCount = migrateResult.nodesToMigrate[\n currentProject\n ] as ProjectNodesToMigrate;\n\n const existingCount =\n migrateResult.existing?.[currentProject]?.totalCount || 0;\n\n const totalCount = Object.keys(migrateResult.nodesToMigrate.nodeIds).length;\n const existingPercent = counts.totalCount\n ? ((existingCount / totalCount) * 100).toFixed(0)\n : '0';\n\n const noChangeCount = migrateStatusAndCount?.['no change'] || 0;\n\n const changedPercentage = counts.totalCount\n ? ((noChangeCount / totalCount) * 100).toFixed(0)\n : '0';\n\n const existingColor =\n existingPercent === '0' || action === 'delete'\n ? log.warningText\n : log.infoText;\n\n const changedColor =\n changedPercentage === '100' ? log.successText : log.warningText;\n\n console.log(\n ` - ${log.highlightText(\n `totalCount: ${migrateStatusAndCount.totalCount}`\n )}${\n changedPercentage === '100'\n ? ''\n : existingColor(` [existing: ${`${existingPercent}%`}]`)\n }${\n existingPercent === '0'\n ? ''\n : changedColor(\n ` ${\n changedPercentage === '100'\n ? 'up to date'\n : `[needs update: ${100 - Number(changedPercentage)}%]`\n }`\n )\n }`\n );\n }\n if (migrateResult.errors?.length) {\n console.log(\n ` - ${log.errorText(`errors: ${migrateResult.errors.length}`)}\\n`\n );\n for (const error of migrateResult.errors) {\n let inner = '';\n if (error.data?.[0]) {\n inner = `${error.data?.[0].Field}: ${error.data?.[0].Message}`;\n }\n log.error(`${error.message} ${inner}`, null, '');\n }\n }\n};\nconst highlightDiffText = (str: string) => {\n const addedRegex = new RegExp(/<<\\+>>(.*?)<<\\/\\+>>/, 'g');\n const removedRegex = new RegExp(/<<->>(.*?)<<\\/->>/, 'g');\n return str\n .replace(addedRegex, match => {\n return Logger.successText(\n match.replace(/<<\\+>>/g, '<+>').replace(/<<\\/\\+>>/g, '</+>')\n );\n })\n .replace(removedRegex, match => {\n return Logger.errorText(\n match.replace(/<<->>/g, '<->').replace(/<<\\/->>/g, '</->')\n );\n });\n};\n\nexport const printModelMigrationAnalysis = (\n { log, messages }: ContensisCli,\n result: any = {}\n) => {\n for (const [contentTypeId, model] of Object.entries(result) as [\n string,\n any\n ][]) {\n let mainOutput = log.standardText(` - ${contentTypeId}`);\n let extraOutput = '';\n let errorOutput = '';\n let diffOutput = '';\n for (const [key, details] of Object.entries(model) as [string, any][]) {\n if (key === 'dependencies') {\n extraOutput += log.infoText(\n ` references: [${details?.join(', ')}]\\n`\n );\n }\n if (key === 'dependencyOf') {\n extraOutput += log.infoText(\n ` required by: [${details?.join(', ')}]\\n`\n );\n }\n if (key === 'projects') {\n for (const [projectId, projectDetails] of Object.entries(details) as [\n string,\n any\n ][]) {\n mainOutput += log.infoText(\n ` [${messages.migrate.status(projectDetails.status)(\n `${projectId}: ${projectDetails.status}`\n )}] v${projectDetails.versionNo}`\n );\n if (projectDetails.diff)\n diffOutput += ` ${log.highlightText(`diff:`)} ${log.infoText(\n highlightDiffText(projectDetails.diff)\n )}\\n`;\n if (projectDetails.error)\n errorOutput += ` ${log.highlightText(\n `error::`\n )} ${log.errorText(projectDetails.error)}`;\n }\n }\n }\n console.log(mainOutput);\n if (extraOutput) {\n const search = '\\n';\n const replace = '';\n console.log(\n extraOutput.replace(\n new RegExp(search + '([^' + search + ']*)$'),\n replace + '$1'\n )\n );\n }\n if (diffOutput) console.log(diffOutput);\n if (errorOutput) console.log(errorOutput);\n }\n};\n\ntype MigrateResultSummary = MigrateModelsResult['']['contentTypes'];\ntype MigrateResultStatus = keyof MigrateResultSummary;\n\nexport const printModelMigrationResult = (\n { log, messages }: ContensisCli,\n result: MigrateResultSummary\n) => {\n for (const [status, ids] of Object.entries(result) as [\n MigrateResultStatus,\n string[]\n ][]) {\n if (ids?.length) {\n if (status === 'errors') {\n const errors: [string, MappedError][] = ids as any;\n log.raw(\n ` - ${status}: [ ${messages.migrate.models.result(status)(\n ids.map(id => id[0]).join(', ')\n )} ]\\n`\n );\n for (const [contentTypeId, error] of errors)\n log.error(\n `${log.highlightText(contentTypeId)}: ${error.message}`,\n error\n );\n } else\n log.raw(\n ` - ${status}: [ ${messages.migrate.models.result(status)(\n ids.join(', ')\n )} ]`\n );\n }\n }\n};\n\nexport const printNodeTreeOutput = (\n { log }: ContensisCli,\n root: Node | undefined\n) => {\n log.object({ ...root, children: undefined });\n log.raw('');\n log.info(\n `${log.highlightText('e')} = has entry; ${log.highlightText(\n 'c'\n )} = canonical; ${log.highlightText('m')} = include in menu`\n );\n log.line();\n\n const outputNode = (node: Node | any, spaces: string) =>\n `${node.entry ? log.highlightText('e') : log.infoText('-')}${\n node.isCanonical ? log.highlightText('c') : log.infoText('-')\n }${\n node.includeInMenu ? log.highlightText('m') : log.infoText('-')\n }${spaces}${\n node.isCanonical ? log.boldText(`/${node.slug}`) : `/${node.slug}`\n }${node.entry ? ` ${log.helpText(node.entry.sys.contentTypeId)}` : ''}${\n node.childCount ? ` +${node.childCount}` : ``\n } ${log.infoText(node.displayName)}`;\n\n const outputChildren = (root: Node | undefined, depth = 2) => {\n let str = '';\n for (const node of (root as any)?.children as Node[]) {\n str += `${outputNode(node, Array(depth + 1).join(' '))}\\n`;\n if ('children' in node) str += outputChildren(node, depth + 1);\n }\n return str;\n };\n\n const children = outputChildren(root);\n log.limits(\n `${outputNode(root, ' ')}${children ? `\\n${children}` : ''}`,\n 100\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAUlB,oBAAuB;AAEvB,MAAM,aAAa,CAAC,MAAqB,SAAS,2BAChD,aAAAA,SAAM,IAAI,EAAE,OAAO,MAAM;AAEpB,MAAM,oBAAoB,CAC/B,EAAE,KAAK,SAAS,GAChB,OACA,eAAe;AAAA,EACb,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,WAAW;AACb,MACG;AAzBL;AA0BE,UAAQ;AAAA,IACN,KAAK,IAAI,aAAa,IAAI,MAAM,QAAQ,WAAW,KAAK,MAAM;AAAA,EAChE;AACA,UAAQ;AAAA,IACN,cAAc,SAAS,OAAO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AI,SAAS,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,SAC3D,KAAK,QAAQ,IAAI,IAAI,SAAS,KAAK,MAAM,IAAI,aAAa,MAAM,KACjE,KAAK,aAAa,KAAK,KAAK,eAAe,MACzC,IAAI,SAAS,KAAK,WAAW;AAEnC,QAAM,iBAAiB,CAACC,OAAwB,QAAQ,MAAM;AAC5D,QAAI,MAAM;AACV,eAAW,QAASA,SAAA,gBAAAA,MAAc,UAAoB;AACpD,aAAO,GAAG,WAAW,MAAM,MAAM,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC;AAAA;AACtD,UAAI,cAAc;AAAM,eAAO,eAAe,MAAM,QAAQ,CAAC;AAAA,IAC/D;AACA,WAAO;AAAA,EACT;AAEA,QAAM,WAAW,eAAe,IAAI;AACpC,MAAI;AAAA,IACF,GAAG,WAAW,MAAM,IAAI,IAAI,WAAW;AAAA,EAAK,aAAa;AAAA,IACzD;AAAA,EACF;AACF;",
|
|
6
6
|
"names": ["dayjs", "_a", "root"]
|
|
7
7
|
}
|
package/dist/version.js
CHANGED
|
@@ -21,7 +21,7 @@ __export(version_exports, {
|
|
|
21
21
|
LIB_VERSION: () => LIB_VERSION
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(version_exports);
|
|
24
|
-
const LIB_VERSION = "1.0.12-beta.
|
|
24
|
+
const LIB_VERSION = "1.0.12-beta.5";
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
26
|
0 && (module.exports = {
|
|
27
27
|
LIB_VERSION
|
package/dist/version.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/version.ts"],
|
|
4
|
-
"sourcesContent": ["export const LIB_VERSION = \"1.0.12-beta.
|
|
4
|
+
"sourcesContent": ["export const LIB_VERSION = \"1.0.12-beta.5\";\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contensis-cli",
|
|
3
|
-
"version": "1.0.12-beta.
|
|
3
|
+
"version": "1.0.12-beta.5",
|
|
4
4
|
"description": "A fully featured Contensis command line interface with a shell UI provides simple and intuitive ways to manage or profile your content in any NodeJS terminal.",
|
|
5
|
-
"repository": "https://github.com/contensis/
|
|
6
|
-
"homepage": "https://github.com/contensis/
|
|
5
|
+
"repository": "https://github.com/contensis/cli",
|
|
6
|
+
"homepage": "https://github.com/contensis/cli/tree/main/packages/contensis-cli#readme",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"bin": {
|
|
9
9
|
"contensis": "./cli.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"jsonpath-mapper": "^1.1.0",
|
|
41
41
|
"keytar": "^7.9.0",
|
|
42
42
|
"lodash": "^4.17.21",
|
|
43
|
-
"migratortron": "^1.0.0-beta.
|
|
43
|
+
"migratortron": "^1.0.0-beta.36",
|
|
44
44
|
"nanospinner": "^1.1.0",
|
|
45
45
|
"node-fetch": "^2.6.7",
|
|
46
46
|
"parse-git-config": "^3.0.0",
|
package/src/commands/get.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
2
|
import { url } from '~/util';
|
|
3
3
|
|
|
4
|
+
// Map various input options into a request to be processed
|
|
5
|
+
// by Migratortron / Contensis import library
|
|
4
6
|
export const mapContensisOpts = (opts: any = {}) => ({
|
|
5
7
|
source:
|
|
6
8
|
opts.sourceAlias || opts.sourceProjectId
|
|
@@ -35,6 +37,7 @@ export const mapContensisOpts = (opts: any = {}) => ({
|
|
|
35
37
|
: undefined,
|
|
36
38
|
zenQL: opts.zenql,
|
|
37
39
|
transformGuids: !opts.preserveGuids,
|
|
40
|
+
ignoreErrors: opts.ignoreErrors,
|
|
38
41
|
});
|
|
39
42
|
|
|
40
43
|
/* Output options */
|
|
@@ -113,6 +116,11 @@ export const commit = new Option(
|
|
|
113
116
|
'add this flag only after you have run a preview of the import and agree with the analysis'
|
|
114
117
|
).default(false);
|
|
115
118
|
|
|
119
|
+
export const ignoreErrors = new Option(
|
|
120
|
+
'-ignore --ignore-errors',
|
|
121
|
+
'commit the import ignoring any reported errors'
|
|
122
|
+
).default(false);
|
|
123
|
+
|
|
116
124
|
export const addConnectOptions = (program: Command) =>
|
|
117
125
|
program.addOption(alias.hideHelp()).addOption(project.hideHelp());
|
|
118
126
|
|
package/src/commands/import.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
2
|
import { cliCommand } from '~/services/ContensisCliService';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
commit,
|
|
5
|
+
getEntryOptions,
|
|
6
|
+
ignoreErrors,
|
|
7
|
+
mapContensisOpts,
|
|
8
|
+
} from './globalOptions';
|
|
4
9
|
|
|
5
10
|
export const makeImportCommand = () => {
|
|
6
11
|
const program = new Command()
|
|
@@ -116,6 +121,7 @@ Example call:
|
|
|
116
121
|
.choices(['errors', 'changes', 'all'])
|
|
117
122
|
.default('errors')
|
|
118
123
|
)
|
|
124
|
+
.addOption(ignoreErrors)
|
|
119
125
|
.addHelpText(
|
|
120
126
|
'after',
|
|
121
127
|
`
|
|
@@ -139,6 +145,11 @@ Example call:
|
|
|
139
145
|
program
|
|
140
146
|
.command('nodes')
|
|
141
147
|
.description('import nodes')
|
|
148
|
+
.argument('[root]', 'import nodes from the specified path e.g. /blog', '/')
|
|
149
|
+
.option(
|
|
150
|
+
'-preserve --preserve-guids',
|
|
151
|
+
'include this flag when you are importing nodes that you have previously exported and wish to update'
|
|
152
|
+
)
|
|
142
153
|
.addOption(commit)
|
|
143
154
|
.addOption(
|
|
144
155
|
new Option(
|
|
@@ -148,19 +159,20 @@ Example call:
|
|
|
148
159
|
.choices(['errors', 'changes', 'all'])
|
|
149
160
|
.default('errors')
|
|
150
161
|
)
|
|
162
|
+
.addOption(ignoreErrors)
|
|
151
163
|
.addHelpText(
|
|
152
164
|
'after',
|
|
153
165
|
`
|
|
154
166
|
Example call:
|
|
155
|
-
> import nodes --from-file
|
|
167
|
+
> import nodes --from-file site-backup.json
|
|
156
168
|
> import nodes --source-alias example-alias --source-project-id example-project
|
|
157
169
|
`
|
|
158
170
|
)
|
|
159
|
-
.action(async opts => {
|
|
171
|
+
.action(async (root: string, opts) => {
|
|
160
172
|
await cliCommand(
|
|
161
173
|
['import', 'nodes'],
|
|
162
174
|
opts,
|
|
163
|
-
mapContensisOpts({ ...opts })
|
|
175
|
+
mapContensisOpts({ paths: root.split(' '), ...opts })
|
|
164
176
|
).ImportNodes({
|
|
165
177
|
commit: opts.commit,
|
|
166
178
|
fromFile: opts.fromFile,
|
|
@@ -132,11 +132,6 @@ class ContensisCli {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
constructor(
|
|
136
|
-
args: string[],
|
|
137
|
-
outputOpts?: OutputOptionsConstructorArg,
|
|
138
|
-
contensisOpts?: Partial<MigrateRequest>
|
|
139
|
-
);
|
|
140
135
|
constructor(
|
|
141
136
|
args: string[],
|
|
142
137
|
outputOpts?: OutputOptionsConstructorArg,
|
|
@@ -1598,7 +1593,7 @@ class ContensisCli {
|
|
|
1598
1593
|
}
|
|
1599
1594
|
} else {
|
|
1600
1595
|
log.error(messages.entries.failedRemove(currentEnv), err);
|
|
1601
|
-
if (!result
|
|
1596
|
+
if (!result?.entriesToMigrate?.[currentProject]?.totalCount)
|
|
1602
1597
|
log.help(messages.entries.notFound(currentEnv));
|
|
1603
1598
|
}
|
|
1604
1599
|
}
|
|
@@ -1689,7 +1684,7 @@ class ContensisCli {
|
|
|
1689
1684
|
}
|
|
1690
1685
|
} else {
|
|
1691
1686
|
log.error(messages.entries.failedImport(currentEnv), err);
|
|
1692
|
-
if (!result
|
|
1687
|
+
if (!result?.entriesToMigrate?.[currentProject]?.totalCount)
|
|
1693
1688
|
log.help(messages.entries.notFound(currentEnv));
|
|
1694
1689
|
}
|
|
1695
1690
|
} else {
|
|
@@ -1704,18 +1699,16 @@ class ContensisCli {
|
|
|
1704
1699
|
|
|
1705
1700
|
if (contensis) {
|
|
1706
1701
|
log.line();
|
|
1707
|
-
const [err] = await to(
|
|
1708
|
-
contensis.content.sourceRepo.nodes.GetNodes(rootPath, depth)
|
|
1709
|
-
);
|
|
1702
|
+
const [err, nodes] = await to(contensis.nodes.GetNodes(rootPath, depth));
|
|
1710
1703
|
if (err) {
|
|
1711
1704
|
log.error(messages.nodes.failedGet(currentProject), err);
|
|
1712
1705
|
return;
|
|
1713
1706
|
}
|
|
1714
|
-
const root = contensis.
|
|
1707
|
+
const root = contensis.nodes.sourceRepo.nodes.tree;
|
|
1715
1708
|
|
|
1716
1709
|
log.success(messages.nodes.get(currentProject, rootPath, depth));
|
|
1717
1710
|
|
|
1718
|
-
this.HandleFormattingAndOutput(
|
|
1711
|
+
this.HandleFormattingAndOutput(nodes, () => {
|
|
1719
1712
|
// print the nodes to console
|
|
1720
1713
|
printNodeTreeOutput(this, root);
|
|
1721
1714
|
});
|
|
@@ -1756,21 +1749,22 @@ class ContensisCli {
|
|
|
1756
1749
|
else
|
|
1757
1750
|
this.HandleFormattingAndOutput(result, () => {
|
|
1758
1751
|
// print the migrateResult to console
|
|
1759
|
-
// TODO: fix
|
|
1760
1752
|
printNodesMigrateResult(this, result, {
|
|
1761
1753
|
showAll: logOutput === 'all',
|
|
1762
1754
|
showChanged: logOutput === 'changes',
|
|
1763
1755
|
});
|
|
1764
1756
|
});
|
|
1765
1757
|
|
|
1766
|
-
const nodesTotalCount =
|
|
1758
|
+
const nodesTotalCount =
|
|
1759
|
+
result?.nodesToMigrate?.[currentProject].totalCount;
|
|
1767
1760
|
const nodesCreated = result?.nodesResult?.['created'] || 0;
|
|
1768
1761
|
const nodesUpdated = result?.nodesResult?.['updated'] || 0;
|
|
1769
|
-
const noChange =
|
|
1762
|
+
const noChange =
|
|
1763
|
+
result?.nodesToMigrate?.[currentProject]['no change'] !== 0;
|
|
1770
1764
|
|
|
1771
1765
|
if (
|
|
1772
1766
|
!err &&
|
|
1773
|
-
!result.errors?.length &&
|
|
1767
|
+
(!result.errors?.length || this.contensisOpts.ignoreErrors) &&
|
|
1774
1768
|
((!commit && nodesTotalCount) ||
|
|
1775
1769
|
(commit && (nodesCreated || nodesUpdated)))
|
|
1776
1770
|
) {
|
|
@@ -304,15 +304,15 @@ export const printNodesMigrateResult = (
|
|
|
304
304
|
if (showAll || showChanged) console.log(``);
|
|
305
305
|
|
|
306
306
|
for (const [projectId, counts] of Object.entries(migrateResult.nodes || {})) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
log.
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
);
|
|
307
|
+
const importTitle =
|
|
308
|
+
action === 'delete'
|
|
309
|
+
? `Delete from project ${log.warningText(currentProject)}`
|
|
310
|
+
: `Import ${
|
|
311
|
+
projectId && projectId !== 'null'
|
|
312
|
+
? `from project ${log.highlightText(projectId)} `
|
|
313
|
+
: ''
|
|
314
|
+
}to ${log.boldText(log.warningText(currentProject))}`;
|
|
315
|
+
log.help(importTitle);
|
|
316
316
|
|
|
317
317
|
const migrateStatusAndCount = migrateResult.nodesToMigrate[
|
|
318
318
|
currentProject
|
|
@@ -320,15 +320,17 @@ export const printNodesMigrateResult = (
|
|
|
320
320
|
|
|
321
321
|
const existingCount =
|
|
322
322
|
migrateResult.existing?.[currentProject]?.totalCount || 0;
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
323
|
+
|
|
324
|
+
const totalCount = Object.keys(migrateResult.nodesToMigrate.nodeIds).length;
|
|
325
|
+
const existingPercent = counts.totalCount
|
|
326
|
+
? ((existingCount / totalCount) * 100).toFixed(0)
|
|
327
|
+
: '0';
|
|
328
|
+
|
|
329
|
+
const noChangeCount = migrateStatusAndCount?.['no change'] || 0;
|
|
330
|
+
|
|
331
|
+
const changedPercentage = counts.totalCount
|
|
332
|
+
? ((noChangeCount / totalCount) * 100).toFixed(0)
|
|
333
|
+
: '0';
|
|
332
334
|
|
|
333
335
|
const existingColor =
|
|
334
336
|
existingPercent === '0' || action === 'delete'
|
|
@@ -339,7 +341,9 @@ export const printNodesMigrateResult = (
|
|
|
339
341
|
changedPercentage === '100' ? log.successText : log.warningText;
|
|
340
342
|
|
|
341
343
|
console.log(
|
|
342
|
-
` - ${log.highlightText(
|
|
344
|
+
` - ${log.highlightText(
|
|
345
|
+
`totalCount: ${migrateStatusAndCount.totalCount}`
|
|
346
|
+
)}${
|
|
343
347
|
changedPercentage === '100'
|
|
344
348
|
? ''
|
|
345
349
|
: existingColor(` [existing: ${`${existingPercent}%`}]`)
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "1.0.12-beta.
|
|
1
|
+
export const LIB_VERSION = "1.0.12-beta.5";
|