contensis-cli 1.3.1-beta.0 → 1.3.1-beta.2
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/dist/commands/copy.js.map +1 -1
- package/dist/commands/create.js +1 -2
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/globalOptions.js +3 -0
- package/dist/commands/globalOptions.js.map +1 -1
- package/dist/commands/index.js +0 -2
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/login.js +1 -2
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/push.js +13 -10
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/remove.js +2 -4
- package/dist/commands/remove.js.map +1 -1
- package/dist/commands/set.js +2 -4
- package/dist/commands/set.js.map +1 -1
- package/dist/factories/RequestHandlerFactory.js +12 -5
- package/dist/factories/RequestHandlerFactory.js.map +2 -2
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/localisation/en-GB.js +8 -1
- package/dist/localisation/en-GB.js.map +1 -1
- package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js.map +1 -1
- package/dist/mappers/DevInit-to-CIWorkflow.js +11 -6
- package/dist/mappers/DevInit-to-CIWorkflow.js.map +1 -1
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js +4 -2
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js.map +1 -1
- package/dist/providers/CredentialProvider.js +11 -4
- package/dist/providers/CredentialProvider.js.map +1 -1
- package/dist/providers/GitHubCliModuleProvider.js +8 -10
- package/dist/providers/GitHubCliModuleProvider.js.map +1 -1
- package/dist/providers/HttpProvider.js +5 -4
- package/dist/providers/HttpProvider.js.map +1 -1
- package/dist/providers/ManifestProvider.js +1 -4
- package/dist/providers/ManifestProvider.js.map +1 -1
- package/dist/providers/SessionCacheProvider.js +8 -8
- package/dist/providers/SessionCacheProvider.js.map +1 -1
- package/dist/providers/file-provider.js +13 -11
- package/dist/providers/file-provider.js.map +1 -1
- package/dist/services/ContensisAuthService.js +1 -2
- package/dist/services/ContensisAuthService.js.map +1 -1
- package/dist/services/ContensisCliService.js +83 -106
- package/dist/services/ContensisCliService.js.map +2 -2
- package/dist/services/ContensisDevService.js +15 -18
- package/dist/services/ContensisDevService.js.map +2 -2
- package/dist/services/ContensisRoleService.js +8 -10
- package/dist/services/ContensisRoleService.js.map +1 -1
- package/dist/shell.js +10 -6
- package/dist/shell.js.map +1 -1
- package/dist/util/api-ids.js.map +1 -1
- package/dist/util/console.printer.js +12 -16
- package/dist/util/console.printer.js.map +1 -1
- package/dist/util/csv.formatter.js +8 -15
- package/dist/util/csv.formatter.js.map +2 -2
- package/dist/util/diff.js +6 -4
- package/dist/util/diff.js.map +1 -1
- package/dist/util/dotenv.js +1 -2
- package/dist/util/dotenv.js.map +1 -1
- package/dist/util/error.js.map +1 -1
- package/dist/util/fetch.js +4 -0
- package/dist/util/fetch.js.map +1 -1
- package/dist/util/git.js +8 -8
- package/dist/util/git.js.map +1 -1
- package/dist/util/gitignore.js +4 -0
- package/dist/util/gitignore.js.map +1 -1
- package/dist/util/index.js +5 -1
- package/dist/util/index.js.map +2 -2
- package/dist/util/json.formatter.js +6 -4
- package/dist/util/json.formatter.js.map +1 -1
- package/dist/util/logger.js +45 -50
- package/dist/util/logger.js.map +2 -2
- package/dist/util/os.js +4 -0
- package/dist/util/os.js.map +1 -1
- package/dist/util/xml.formatter.js +4 -0
- package/dist/util/xml.formatter.js.map +1 -1
- package/dist/util/yaml.js +1 -2
- package/dist/util/yaml.js.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/esbuild.config.js +10 -14
- package/package.json +5 -5
- package/src/factories/RequestHandlerFactory.ts +1 -1
- package/src/services/ContensisCliService.ts +38 -28
- package/src/services/ContensisDevService.ts +2 -2
- package/src/util/csv.formatter.ts +1 -1
- package/src/util/index.ts +1 -1
- package/src/util/logger.ts +15 -14
- package/src/version.ts +1 -1
- package/tsconfig.json +1 -1
package/dist/util/logger.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/util/logger.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable no-console */\nimport chalk from 'chalk';\nimport dateFormat from 'dateformat';\nimport deepCleaner from 'deep-cleaner';\nimport {\n ansiEscapeCodes,\n first,\n partition,\n strlen,\n} from 'printable-characters';\n// import ProgressBar from 'progress';\nimport { isSysError, tryStringify } from '.';\n\ntype LogMethod = (content: string) => void;\ntype LogErrorMethod = (content: string, err?: any, newline?: string) => void;\ntype LogJsonMethod = (content: any, depth?: number, indent?: string) => void;\ntype LogJsonDepthMethod = (content: any, depth?: number) => void;\ntype LogArrayMethod = (contentArray: string[]) => void;\ntype LogErrorFunc = (\n err: any,\n msg?: string,\n level?: 'error' | 'critical'\n) => void;\n\nexport class Logger {\n static isUserTerminal = !!process.stdout.columns;\n static getPrefix = () => {\n return Logger.isUserTerminal\n ? Logger.infoText(`[cli]`)\n : `[${dateFormat(new Date(), 'dd/mm HH:MM:ss')}]`;\n };\n static errorText = chalk.bold.red;\n static warningText = chalk.keyword('orange');\n static successText = chalk.keyword('green');\n static helpText = chalk.blue;\n static highlightText = chalk.yellow;\n static infoText = chalk.keyword('grey');\n static standardText = chalk.keyword('white');\n static boldText = chalk.bold;\n static critical: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n '[CRITICAL]'\n )} ${content}`;\n console.log(message);\n };\n static error: LogErrorMethod = (content, err, newline = '\\n') => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n `${Logger.isUserTerminal ? '\u274C' : '[ERROR]'} ${content}${\n err\n ? `\\n\\n${Logger.infoText(\n isSysError(err) ? err.toString() : JSON.stringify(err, null, 2)\n )}`\n : ''\n }`\n )}${newline}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static warning: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.warningText(\n `${Logger.isUserTerminal ? '\u26A0\uFE0F ' : '[WARN]'} ${content}`\n )}\\n`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n // }\n };\n static success: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.successText(\n `${Logger.isUserTerminal ? '\u2705' : '[OK]'} ${content}`\n )}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static info: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? chalk.bgCyan(' \u2139 ') : '[INFO]'\n } ${Logger.infoText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static help: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${chalk.blue(\n `${Logger.isUserTerminal ? '\u23E9' : '[HELP]'} ${content}`\n )}\\n`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static standard: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? '\u25FB\uFE0F' : '[STD]'\n } \\n${Logger.standardText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n progress.current.interrupt(message);\n };\n static debug: LogMethod = content => {\n if (['true', '1'].includes(process.env.debug || '')) {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? chalk.bgGrey(' \u2699 ') : '[DEBUG]'\n } ${Logger.infoText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n }\n };\n static json: LogJsonDepthMethod = (content, depth = 9) =>\n console.dir(deepCleaner(content), { colors: true, depth });\n static mixed: LogArrayMethod = contentArray =>\n console.log(`${Logger.getPrefix()} ${contentArray.join(' ')}`);\n static line = () =>\n Logger.raw(` ${Logger.infoText(`-------------------------------------`)}`);\n\n static object: LogJsonMethod = content => {\n for (const [key, value] of Object.entries(content || {})) {\n if (value && typeof value === 'object') {\n Logger.raw(` ${chalk.bold.grey(key)}:`);\n if (key === 'fields' && Array.isArray(value)) {\n for (const field of value || []) {\n Logger.raw(\n ` ${chalk.bold(field.id)}${\n field.id === content.entryTitleField\n ? '**'\n : field.validations.minCount?.value ||\n typeof field.validations.required?.message !== 'undefined'\n ? '*'\n : ''\n }: ${chalk.grey(\n `${field.dataType}${\n field.dataFormat\n ? `<${\n Array.isArray(\n field.validations.allowedFieldTypes?.fields\n )\n ? `composer[${field.validations.allowedFieldTypes.fields\n .map((f: any) => f.id)\n .join(' | ')}]`\n : field.dataFormat\n }${\n field.dataFormat === 'entry'\n ? `, ${field.validations.allowedContentTypes.contentTypes.join(\n ' | '\n )}`\n : ''\n }${\n field.dataFormat === 'contenttype'\n ? `[${field.validations?.allowedDataFormats.dataFormats.join(\n ' | '\n )}], ${(\n field.validations?.allowedIds?.ids || ['*']\n ).join(' | ')}`\n : ''\n }>`\n : ''\n }${\n field.validations.maxLength?.value\n ? `(${field.validations.maxLength.value})`\n : ''\n }`\n )}`\n );\n }\n } else if (key === 'groups' && Array.isArray(value)) {\n for (const group of value || []) {\n const description =\n Object.keys(group.description).length &&\n Object.values(group.description)?.[0];\n Logger.raw(\n ` ${chalk.bold(group.id)}${\n description\n ? `: ${chalk.grey(Object.values(group.description)?.[0])}`\n : ''\n }`\n );\n }\n } else {\n Logger.objectRecurse(value, 3, ' ');\n // for (const [innerkey, innervalue] of Object.entries(value)) {\n // if (innervalue && typeof innervalue === 'object') {\n // Logger.raw(` ${chalk.bold.grey(innerkey)}:`);\n // console.table(innervalue);\n // } else if (\n // typeof innervalue !== 'undefined' &&\n // innervalue !== null\n // ) {\n // Logger.raw(` ${chalk.bold.grey(innerkey)}: ${innervalue}`);\n // }\n // }\n }\n } else if (typeof value !== 'undefined' && value !== null) {\n const valueText =\n key === 'id' && typeof value === 'string'\n ? Logger.highlightText(value)\n : value;\n Logger.raw(` ${chalk.bold.grey(key)}: ${valueText}`);\n }\n }\n };\n\n static objectRecurse: LogJsonMethod = (content, depth = 3, indent = '') => {\n if (Array.isArray(content)) {\n for (const item of content) {\n if (item && typeof item === 'object') {\n if (Array.isArray(item) && depth > 3)\n if (item.length)\n Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));\n else Logger.objectRecurse(item, depth + 1, `${indent} `);\n else\n Array.isArray(item)\n ? Logger.raw(\n `${indent}${chalk.grey(`[`)}${item.join(', ')}${chalk.grey(\n `]`\n )}`\n )\n : typeof item === 'object' && item\n ? Logger.objectRecurse(item, depth + 1, `${indent} `)\n : Logger.raw(`${indent}${item}`);\n } else Logger.raw(`${indent}${item}`);\n }\n } else {\n let pos = 0;\n for (const [key, value] of Object.entries(content)) {\n if (key === 'stack') continue; // skip stack output for errors\n const thisIndent =\n pos === 0 ? `${indent.substring(0, indent.length - 2)}- ` : indent;\n if (Array.isArray(value)) {\n if (value.length) Logger.raw(`${thisIndent}${chalk.bold.grey(key)}:`);\n for (const item of value) {\n if (item && typeof item === 'object') {\n if (Array.isArray(item) && depth > 3)\n Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));\n else Logger.objectRecurse(item, depth + 1, `${indent} `);\n } else {\n Logger.raw(`${indent} ${item}`);\n }\n }\n } else if (value && typeof value === 'object') {\n Logger.raw(`${indent}${chalk.bold.grey(key)}:`);\n\n Logger.objectRecurse(value, depth + 1, `${indent} `);\n // console.table(value);\n } else if (typeof value !== 'undefined' && value !== null) {\n Logger.raw(`${thisIndent}${chalk.bold.grey(key)}: ${value}`);\n }\n pos++;\n }\n }\n };\n static raw: LogMethod = (content: string) => {\n if (progress.active) progress.current.interrupt(content);\n else console.log(content);\n };\n\n static limits = (\n content: string,\n displayLength = 30,\n consoleWidth = process.stdout.columns,\n logMethod: Function = console.info\n ) => {\n if (consoleWidth) {\n const contentArray = content.endsWith('\\n')\n ? content.split('\\n').slice(0, -1)\n : content.split('\\n');\n const contentLines = contentArray.slice(\n 0,\n consoleWidth ? displayLength : undefined\n );\n for (const line of contentLines)\n logMethod(\n line\n .split('~n')\n .map(l =>\n consoleWidth && strlen(l) > consoleWidth\n ? first(l, consoleWidth)\n : l\n )\n .join('\\n')\n );\n } else {\n logMethod(content.replace(ansiEscapeCodes, '').replaceAll('~n', '\\n'));\n }\n\n const tableArray = content.split('\\n');\n if (consoleWidth && tableArray.length > displayLength)\n console.info(\n `\\n`,\n `- and ${tableArray.length - displayLength} more...\\n`\n );\n };\n}\n\nexport const logError: LogErrorFunc = (\n err = new Error('Undefined error'),\n msg,\n level = 'error'\n) => {\n Logger[level](msg || err.message || err?.data?.message || err.Message);\n (Array.isArray(err) ? err : [err]).map((error: AppError) => {\n if (typeof error === 'string') {\n Logger.raw(`${Logger.infoText(error)}\\n`);\n return;\n }\n if ('stack' in error) Logger.raw(` ${Logger.infoText(error.stack)}\\n`);\n if ('data' in error)\n Logger.raw(` ${Logger.infoText(tryStringify(error.data))}\\n`);\n });\n //Logger.line();\n return null;\n};\n\nexport const addNewLines = (\n message = '',\n newLineSeparater = '\\n',\n atPosition = process.stdout.columns\n) => {\n if (message === '' || atPosition === 0) {\n return '';\n }\n\n let result = '';\n let lengthCounter = 0;\n\n // Partition the message string into an array of\n // [nonPrintable, printable][]\n const partitioned = partition(message);\n const addSeparater = () => {\n // If line length counter has exceeded the console width\n // add a new line separater and reset the line length counter\n if (lengthCounter >= atPosition) {\n result += newLineSeparater;\n lengthCounter = 0;\n }\n };\n\n // Loop through the partitioned message parts\n for (const [nonPrintable, printable] of partitioned) {\n // Convert string to array as this will provide accurate\n // lengths and splicing methods with all unicode chars\n const textParts = Array.from(printable);\n // Splice the remaining allowable line length from the text parts array\n const text = textParts.splice(0, atPosition - lengthCounter);\n // In the first iteration append the non printable unicode chars\n // to the beginning of the spliced text\n result += nonPrintable + text.join('');\n // Keep a count of the current line length\n // as one line of output could span multiple \"partitions\"\n lengthCounter += text.length;\n addSeparater();\n\n // Handle any remaining text in this \"partition\"\n while (textParts.length) {\n // Splice the remaining allowable line length from the text parts array\n const text = textParts.splice(0, atPosition - lengthCounter);\n // Append the spliced text to the result\n result += text.join('');\n // Increase line length counter\n lengthCounter += text.length;\n addSeparater();\n }\n }\n return result;\n};\n\nexport const progress = {\n current: { interrupt: (x: string) => {} },\n active: false,\n // done: () => new ProgressBar('', 0),\n // colours: { green: '\\u001b[42m \\u001b[0m', red: '\\u001b[41m \\u001b[0m' },\n // current: new ProgressBar(`:bar`, {\n // complete: '=',\n // incomplete: ' ',\n // width: 20,\n // total: 100,\n // }),\n};\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import chalk from 'chalk';\nimport dateFormat from 'dateformat';\nimport deepCleaner from 'deep-cleaner';\nimport {\n ansiEscapeCodes,\n first,\n partition,\n strlen,\n} from 'printable-characters';\n// import ProgressBar from 'progress';\nimport { isSysError, tryStringify } from '.';\n\ntype LogMethod = (content: string) => void;\ntype LogErrorMethod = (content: string, err?: any, newline?: string) => void;\ntype LogJsonMethod = (content: any, depth?: number, indent?: string) => void;\ntype LogJsonDepthMethod = (content: any, depth?: number) => void;\ntype LogArrayMethod = (contentArray: string[]) => void;\ntype LogErrorFunc = (\n err: any,\n msg?: string,\n level?: 'error' | 'critical'\n) => void;\n\nexport class Logger {\n static isUserTerminal = !!process.stdout.columns;\n static getPrefix = () => {\n return Logger.isUserTerminal\n ? Logger.infoText(`[cli]`)\n : `[${dateFormat(new Date(), 'dd/mm HH:MM:ss')}]`;\n };\n static errorText = chalk.bold.red;\n static warningText = chalk.keyword('orange');\n static successText = chalk.keyword('green');\n static helpText = chalk.blue;\n static highlightText = chalk.yellow;\n static infoText = chalk.keyword('grey');\n static standardText = chalk.keyword('white');\n static boldText = chalk.bold;\n static critical: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n '[CRITICAL]'\n )} ${content}`;\n console.log(message);\n };\n static error: LogErrorMethod = (content, err, newline = '\\n') => {\n const message = `${Logger.getPrefix()} ${Logger.errorText(\n `${Logger.isUserTerminal ? '\u274C' : '[ERROR]'} ${content}${\n err\n ? `\\n\\n${Logger.infoText(\n isSysError(err) ? err.toString() : JSON.stringify(err, null, 2)\n )}`\n : ''\n }`\n )}${newline}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static warning: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.warningText(\n `${Logger.isUserTerminal ? '\u26A0\uFE0F ' : '[WARN]'} ${content}`\n )}\\n`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n // }\n };\n static success: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${Logger.successText(\n `${Logger.isUserTerminal ? '\u2705' : '[OK]'} ${content}`\n )}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static info: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? chalk.bgCyan(' \u2139 ') : '[INFO]'\n } ${Logger.infoText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static help: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${chalk.blue(\n `${Logger.isUserTerminal ? '\u23E9' : '[HELP]'} ${content}`\n )}\\n`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n };\n static standard: LogMethod = content => {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? '\u25FB\uFE0F' : '[STD]'\n } \\n${Logger.standardText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n progress.current.interrupt(message);\n };\n static debug: LogMethod = content => {\n if (['true', '1'].includes(process.env.debug || '')) {\n const message = `${Logger.getPrefix()} ${\n Logger.isUserTerminal ? chalk.bgGrey(' \u2699 ') : '[DEBUG]'\n } ${Logger.infoText(content)}`;\n if (progress.active) progress.current.interrupt(message);\n else console.log(message);\n }\n };\n static json: LogJsonDepthMethod = (content, depth = 9) =>\n console.dir(deepCleaner(content), { colors: true, depth });\n static mixed: LogArrayMethod = contentArray =>\n console.log(`${Logger.getPrefix()} ${contentArray.join(' ')}`);\n static line = () =>\n Logger.raw(` ${Logger.infoText(`-------------------------------------`)}`);\n\n static object: LogJsonMethod = content => {\n for (const [key, value] of Object.entries(content || {})) {\n if (value && typeof value === 'object') {\n Logger.raw(` ${chalk.bold.grey(key)}:`);\n if (key === 'fields' && Array.isArray(value)) {\n for (const field of value || []) {\n Logger.raw(\n ` ${chalk.bold(field.id)}${\n field.id === content.entryTitleField\n ? '**'\n : field.validations.minCount?.value ||\n typeof field.validations.required?.message !== 'undefined'\n ? '*'\n : ''\n }: ${chalk.grey(\n `${field.dataType}${\n field.dataFormat\n ? `<${\n Array.isArray(\n field.validations.allowedFieldTypes?.fields\n )\n ? `composer[${field.validations.allowedFieldTypes.fields\n .map((f: any) => f.id)\n .join(' | ')}]`\n : field.dataFormat\n }${\n field.dataFormat === 'entry'\n ? `, ${field.validations.allowedContentTypes.contentTypes.join(\n ' | '\n )}`\n : ''\n }${\n field.dataFormat === 'contenttype'\n ? `[${field.validations?.allowedDataFormats.dataFormats.join(\n ' | '\n )}], ${(\n field.validations?.allowedIds?.ids || ['*']\n ).join(' | ')}`\n : ''\n }>`\n : ''\n }${\n field.validations.maxLength?.value\n ? `(${field.validations.maxLength.value})`\n : ''\n }`\n )}`\n );\n }\n } else if (key === 'groups' && Array.isArray(value)) {\n for (const group of value || []) {\n const description =\n Object.keys(group.description).length &&\n Object.values(group.description)?.[0];\n Logger.raw(\n ` ${chalk.bold(group.id)}${\n description\n ? `: ${chalk.grey(Object.values(group.description)?.[0])}`\n : ''\n }`\n );\n }\n } else {\n Logger.objectRecurse(value, 3, ' ');\n // for (const [innerkey, innervalue] of Object.entries(value)) {\n // if (innervalue && typeof innervalue === 'object') {\n // Logger.raw(` ${chalk.bold.grey(innerkey)}:`);\n // console.table(innervalue);\n // } else if (\n // typeof innervalue !== 'undefined' &&\n // innervalue !== null\n // ) {\n // Logger.raw(` ${chalk.bold.grey(innerkey)}: ${innervalue}`);\n // }\n // }\n }\n } else if (typeof value !== 'undefined' && value !== null) {\n const valueText =\n key === 'id' && typeof value === 'string'\n ? Logger.highlightText(value)\n : value;\n Logger.raw(` ${chalk.bold.grey(key)}: ${valueText}`);\n }\n }\n };\n\n static objectRecurse: LogJsonMethod = (content, depth = 3, indent = '') => {\n if (Array.isArray(content)) {\n for (const item of content) {\n if (item && typeof item === 'object') {\n if (Array.isArray(item) && depth > 3)\n if (item.length)\n Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));\n else Logger.objectRecurse(item, depth + 1, `${indent} `);\n else {\n if (Array.isArray(item))\n Logger.raw(\n `${indent}${chalk.grey(`[`)}${item.join(', ')}${chalk.grey(\n `]`\n )}`\n );\n else if (typeof item === 'object' && item)\n Logger.objectRecurse(item, depth + 1, `${indent} `);\n else Logger.raw(`${indent}${item}`);\n }\n } else Logger.raw(`${indent}${item}`);\n }\n } else {\n let pos = 0;\n for (const [key, value] of Object.entries(content)) {\n if (key === 'stack') continue; // skip stack output for errors\n const thisIndent =\n pos === 0 ? `${indent.substring(0, indent.length - 2)}- ` : indent;\n if (Array.isArray(value)) {\n if (value.length) Logger.raw(`${thisIndent}${chalk.bold.grey(key)}:`);\n for (const item of value) {\n if (item && typeof item === 'object') {\n if (Array.isArray(item) && depth > 3)\n Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));\n else Logger.objectRecurse(item, depth + 1, `${indent} `);\n } else {\n Logger.raw(`${indent} ${item}`);\n }\n }\n } else if (value && typeof value === 'object') {\n Logger.raw(`${indent}${chalk.bold.grey(key)}:`);\n\n Logger.objectRecurse(value, depth + 1, `${indent} `);\n // console.table(value);\n } else if (typeof value !== 'undefined' && value !== null) {\n Logger.raw(`${thisIndent}${chalk.bold.grey(key)}: ${value}`);\n }\n pos++;\n }\n }\n };\n static raw: LogMethod = (content: string) => {\n if (progress.active) progress.current.interrupt(content);\n else console.log(content);\n };\n\n static limits = (\n content: string,\n displayLength = 30,\n consoleWidth = process.stdout.columns,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n logMethod: Function = console.info\n ) => {\n if (consoleWidth) {\n const contentArray = content.endsWith('\\n')\n ? content.split('\\n').slice(0, -1)\n : content.split('\\n');\n const contentLines = contentArray.slice(\n 0,\n consoleWidth ? displayLength : undefined\n );\n for (const line of contentLines)\n logMethod(\n line\n .split('~n')\n .map(l =>\n consoleWidth && strlen(l) > consoleWidth\n ? first(l, consoleWidth)\n : l\n )\n .join('\\n')\n );\n } else {\n logMethod(content.replace(ansiEscapeCodes, '').replaceAll('~n', '\\n'));\n }\n\n const tableArray = content.split('\\n');\n if (consoleWidth && tableArray.length > displayLength)\n console.info(\n `\\n`,\n `- and ${tableArray.length - displayLength} more...\\n`\n );\n };\n}\n\nexport const logError: LogErrorFunc = (\n err = new Error('Undefined error'),\n msg,\n level = 'error'\n) => {\n Logger[level](msg || err.message || err?.data?.message || err.Message);\n (Array.isArray(err) ? err : [err]).map((error: AppError) => {\n if (typeof error === 'string') {\n Logger.raw(`${Logger.infoText(error)}\\n`);\n return;\n }\n if ('stack' in error) Logger.raw(` ${Logger.infoText(error.stack)}\\n`);\n if ('data' in error)\n Logger.raw(` ${Logger.infoText(tryStringify(error.data))}\\n`);\n });\n //Logger.line();\n return null;\n};\n\nexport const addNewLines = (\n message = '',\n newLineSeparater = '\\n',\n atPosition = process.stdout.columns\n) => {\n if (message === '' || atPosition === 0) {\n return '';\n }\n\n let result = '';\n let lengthCounter = 0;\n\n // Partition the message string into an array of\n // [nonPrintable, printable][]\n const partitioned = partition(message);\n const addSeparater = () => {\n // If line length counter has exceeded the console width\n // add a new line separater and reset the line length counter\n if (lengthCounter >= atPosition) {\n result += newLineSeparater;\n lengthCounter = 0;\n }\n };\n\n // Loop through the partitioned message parts\n for (const [nonPrintable, printable] of partitioned) {\n // Convert string to array as this will provide accurate\n // lengths and splicing methods with all unicode chars\n const textParts = Array.from(printable);\n // Splice the remaining allowable line length from the text parts array\n const text = textParts.splice(0, atPosition - lengthCounter);\n // In the first iteration append the non printable unicode chars\n // to the beginning of the spliced text\n result += nonPrintable + text.join('');\n // Keep a count of the current line length\n // as one line of output could span multiple \"partitions\"\n lengthCounter += text.length;\n addSeparater();\n\n // Handle any remaining text in this \"partition\"\n while (textParts.length) {\n // Splice the remaining allowable line length from the text parts array\n const text = textParts.splice(0, atPosition - lengthCounter);\n // Append the spliced text to the result\n result += text.join('');\n // Increase line length counter\n lengthCounter += text.length;\n addSeparater();\n }\n }\n return result;\n};\n\nexport const progress = {\n current: { interrupt: (x: string) => {} },\n active: false,\n // done: () => new ProgressBar('', 0),\n // colours: { green: '\\u001b[42m \\u001b[0m', red: '\\u001b[41m \\u001b[0m' },\n // current: new ProgressBar(`:bar`, {\n // complete: '=',\n // incomplete: ' ',\n // width: 20,\n // total: 100,\n // }),\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,wBAAuB;AACvB,0BAAwB;AACxB,kCAKO;AAEP,eAAyC;AAalC,MAAM,OAAO;AAAA,EAClB,OAAO,iBAAiB,CAAC,CAAC,QAAQ,OAAO;AAAA,EACzC,OAAO,YAAY,MAAM;AACvB,WAAO,OAAO,iBACV,OAAO,SAAS,OAAO,IACvB,QAAI,kBAAAA,SAAW,oBAAI,KAAK,GAAG,gBAAgB,CAAC;AAAA,EAClD;AAAA,EACA,OAAO,YAAY,aAAAC,QAAM,KAAK;AAAA,EAC9B,OAAO,cAAc,aAAAA,QAAM,QAAQ,QAAQ;AAAA,EAC3C,OAAO,cAAc,aAAAA,QAAM,QAAQ,OAAO;AAAA,EAC1C,OAAO,WAAW,aAAAA,QAAM;AAAA,EACxB,OAAO,gBAAgB,aAAAA,QAAM;AAAA,EAC7B,OAAO,WAAW,aAAAA,QAAM,QAAQ,MAAM;AAAA,EACtC,OAAO,eAAe,aAAAA,QAAM,QAAQ,OAAO;AAAA,EAC3C,OAAO,WAAW,aAAAA,QAAM;AAAA,EACxB,OAAO,WAAsB,aAAW;AACtC,UAAM,UAAU,GAAG,OAAO,UAAU,CAAC,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desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
package/dist/util/os.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/util/os.ts"],
|
|
4
4
|
"sourcesContent": ["import os from 'os';\n\nexport const winSlash = (str: string) =>\n os.platform() === 'win32' ? str.replaceAll('/', '\\\\') : str;\n\nexport const linuxSlash = (str: string) =>\n os.platform() === 'win32' ? str.replaceAll('\\\\', '/') : str;\n\nexport const normaliseLineEndings = (\n str: string,\n lineEnd = os.platform() === 'win32' ? '\\r\\n' : 'n'\n) => str.replace(/\\r?\\n/g, lineEnd);\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAe;AAER,MAAM,WAAW,CAAC,QACvB,UAAAA,QAAG,SAAS,MAAM,UAAU,IAAI,WAAW,KAAK,IAAI,IAAI;AAEnD,MAAM,aAAa,CAAC,QACzB,UAAAA,QAAG,SAAS,MAAM,UAAU,IAAI,WAAW,MAAM,GAAG,IAAI;AAEnD,MAAM,uBAAuB,CAClC,KACA,UAAU,UAAAA,QAAG,SAAS,MAAM,UAAU,SAAS,QAC5C,IAAI,QAAQ,UAAU,OAAO;",
|
|
6
6
|
"names": ["os"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/util/xml.formatter.ts"],
|
|
4
4
|
"sourcesContent": ["import xml2js from 'xml2js';\nimport cleaner from 'deep-cleaner';\nimport { Logger } from './logger';\n\nexport const xmlFormatter = <T>(entries: T | T[]) => {\n try {\n const cleanedEntries = cleaner(cleaner(entries, ['workflow']));\n\n const builder = new xml2js.Builder({\n cdata: true,\n rootName: 'Items',\n });\n const xml = builder.buildObject({ Entry: cleanedEntries });\n\n return xml;\n } catch (ex) {\n Logger.error(`Problem building XML from json data`, ex);\n return '';\n }\n};\n\nexport const xmlToJson = async <T>(data: string) => {\n const json = await xml2js.parseStringPromise(data, { explicitArray: false });\n\n return json.Items?.Entry || json;\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AACnB,0BAAoB;AACpB,oBAAuB;AAEhB,MAAM,eAAe,CAAI,YAAqB;AACnD,MAAI;AACF,UAAM,qBAAiB,oBAAAA,aAAQ,oBAAAA,SAAQ,SAAS,CAAC,UAAU,CAAC,CAAC;AAE7D,UAAM,UAAU,IAAI,cAAAC,QAAO,QAAQ;AAAA,MACjC,OAAO;AAAA,MACP,UAAU;AAAA,IACZ,CAAC;AACD,UAAM,MAAM,QAAQ,YAAY,EAAE,OAAO,eAAe,CAAC;AAEzD,WAAO;AAAA,EACT,SAAS,IAAI;AACX,yBAAO,MAAM,uCAAuC,EAAE;AACtD,WAAO;AAAA,EACT;AACF;AAEO,MAAM,YAAY,OAAU,SAAiB;AArBpD;AAsBE,QAAM,OAAO,MAAM,cAAAA,QAAO,mBAAmB,MAAM,EAAE,eAAe,MAAM,CAAC;AAE3E,WAAO,UAAK,UAAL,mBAAY,UAAS;AAC9B;",
|
|
6
6
|
"names": ["cleaner", "xml2js"]
|
|
7
7
|
}
|
package/dist/util/yaml.js
CHANGED
|
@@ -31,8 +31,7 @@ const parseYamlDocument = import_yaml.parseDocument;
|
|
|
31
31
|
const stringifyYaml = import_yaml.stringify;
|
|
32
32
|
const validateWorkflowYaml = (yaml) => {
|
|
33
33
|
const { actionType, errors } = (0, import_core.validateWorkflow)(yaml);
|
|
34
|
-
if (actionType && errors.length === 0)
|
|
35
|
-
return true;
|
|
34
|
+
if (actionType && errors.length === 0) return true;
|
|
36
35
|
return errors;
|
|
37
36
|
};
|
|
38
37
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/util/yaml.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/util/yaml.ts"],
|
|
4
4
|
"sourcesContent": ["import { validateWorkflow } from '@action-validator/core';\n\nimport { parse, parseDocument, stringify } from 'yaml';\n\nexport const parseYaml = parse;\nexport const parseYamlDocument = parseDocument;\nexport const stringifyYaml = stringify;\n\nexport const validateWorkflowYaml = (yaml: string) => {\n const { actionType, errors } = validateWorkflow(yaml);\n if (actionType && errors.length === 0) return true;\n return errors;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiC;AAEjC,kBAAgD;AAEzC,MAAM,YAAY;AAClB,MAAM,oBAAoB;AAC1B,MAAM,gBAAgB;AAEtB,MAAM,uBAAuB,CAAC,SAAiB;AACpD,QAAM,EAAE,YAAY,OAAO,QAAI,8BAAiB,IAAI;AACpD,MAAI,cAAc,OAAO,WAAW
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiC;AAEjC,kBAAgD;AAEzC,MAAM,YAAY;AAClB,MAAM,oBAAoB;AAC1B,MAAM,gBAAgB;AAEtB,MAAM,uBAAuB,CAAC,SAAiB;AACpD,QAAM,EAAE,YAAY,OAAO,QAAI,8BAAiB,IAAI;AACpD,MAAI,cAAc,OAAO,WAAW,EAAG,QAAO;AAC9C,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
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.3.1-beta.
|
|
24
|
+
const LIB_VERSION = "1.3.1-beta.2";
|
|
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.3.1-beta.
|
|
4
|
+
"sourcesContent": ["export const LIB_VERSION = \"1.3.1-beta.2\";\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/esbuild.config.js
CHANGED
|
@@ -5,7 +5,7 @@ const { globPlugin } = require('esbuild-plugin-glob');
|
|
|
5
5
|
const { nodeExternalsPlugin } = require('esbuild-node-externals');
|
|
6
6
|
const { replaceTscAliasPaths } = require('tsc-alias');
|
|
7
7
|
|
|
8
|
-
const watch = !!process.argv.includes('--watch');
|
|
8
|
+
// const watch = !!process.argv.includes('--watch');
|
|
9
9
|
const completed = `${chalk.green('[contensis-cli]')} Build successful 👍\n`;
|
|
10
10
|
|
|
11
11
|
console.time(completed);
|
|
@@ -27,15 +27,15 @@ rimraf('./dist', () => {
|
|
|
27
27
|
// so the bundles are compatible with the pkg exe builds
|
|
28
28
|
target: 'node12',
|
|
29
29
|
plugins: [globPlugin(), nodeExternalsPlugin()],
|
|
30
|
-
watch: watch && {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
30
|
+
// watch: watch && {
|
|
31
|
+
// onRebuild(error) {
|
|
32
|
+
// if (error) console.error('esbuild watch build failed:', error);
|
|
33
|
+
// else
|
|
34
|
+
// console.log(
|
|
35
|
+
// 'esbuild watch build succeeded, waiting for changes...'
|
|
36
|
+
// );
|
|
37
|
+
// },
|
|
38
|
+
// },
|
|
39
39
|
})
|
|
40
40
|
.then(() => {
|
|
41
41
|
console.timeEnd(' - esbuild complete');
|
|
@@ -44,8 +44,4 @@ rimraf('./dist', () => {
|
|
|
44
44
|
console.timeEnd(' - replace alias paths');
|
|
45
45
|
console.timeEnd(completed);
|
|
46
46
|
})
|
|
47
|
-
.catch(error => {
|
|
48
|
-
console.error(error);
|
|
49
|
-
process.exit(1);
|
|
50
|
-
});
|
|
51
47
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contensis-cli",
|
|
3
|
-
"version": "1.3.1-beta.
|
|
3
|
+
"version": "1.3.1-beta.2",
|
|
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
5
|
"repository": "https://github.com/contensis/cli",
|
|
6
6
|
"homepage": "https://github.com/contensis/cli/tree/main/packages/contensis-cli#readme",
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
"@types/node-fetch": "^2.6.1",
|
|
63
63
|
"@types/parse-git-config": "^3.0.1",
|
|
64
64
|
"@types/xml2js": "^0.4.11",
|
|
65
|
-
"esbuild": "^0.
|
|
66
|
-
"esbuild-node-externals": "^1.
|
|
67
|
-
"esbuild-plugin-glob": "^
|
|
65
|
+
"esbuild": "^0.24.0",
|
|
66
|
+
"esbuild-node-externals": "^1.15.0",
|
|
67
|
+
"esbuild-plugin-glob": "^2.2.3",
|
|
68
68
|
"nodemon": "^2.0.18",
|
|
69
69
|
"rimraf": "^3.0.2",
|
|
70
70
|
"tsc-alias": "^1.6.9",
|
|
71
|
-
"typescript": "^
|
|
71
|
+
"typescript": "^5.6.3"
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -218,7 +218,7 @@ export class RequestHandlerFactory {
|
|
|
218
218
|
const { manifest, messages, moduleInfo } = this;
|
|
219
219
|
|
|
220
220
|
if (moduleInfo.install && moduleInfo.version !== moduleInfo.install) {
|
|
221
|
-
|
|
221
|
+
const { apply } =
|
|
222
222
|
moduleInfo.version === '*'
|
|
223
223
|
? { apply: true }
|
|
224
224
|
: await inquirer.prompt({
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
SourceCms,
|
|
16
16
|
ContentTypesResult,
|
|
17
17
|
Model,
|
|
18
|
-
MigrateModelsResult,
|
|
19
18
|
BlockActionType,
|
|
20
19
|
logEntitiesTable,
|
|
21
20
|
} from 'migratortron';
|
|
@@ -108,7 +107,7 @@ class ContensisCli {
|
|
|
108
107
|
const environments = this.cache.environments || {};
|
|
109
108
|
|
|
110
109
|
if (!currentEnvironment) return {} as EnvironmentCache;
|
|
111
|
-
else if (
|
|
110
|
+
else if (environments[currentEnvironment])
|
|
112
111
|
return environments[currentEnvironment];
|
|
113
112
|
else {
|
|
114
113
|
return {
|
|
@@ -219,6 +218,7 @@ class ContensisCli {
|
|
|
219
218
|
this.currentEnv = environment;
|
|
220
219
|
this.urls = url(environment, 'website');
|
|
221
220
|
|
|
221
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
222
222
|
const [fetchErr, response] = await to(fetch(this.urls.cms));
|
|
223
223
|
if (response && response?.status < 400) {
|
|
224
224
|
log.success(messages.connect.connected(environment));
|
|
@@ -463,7 +463,7 @@ class ContensisCli {
|
|
|
463
463
|
isPassword(this.env.passwordFallback) ||
|
|
464
464
|
'';
|
|
465
465
|
|
|
466
|
-
const {
|
|
466
|
+
const { messages } = this;
|
|
467
467
|
|
|
468
468
|
if (userId) {
|
|
469
469
|
const { currentEnv, env } = this;
|
|
@@ -621,8 +621,8 @@ class ContensisCli {
|
|
|
621
621
|
currentProject && currentProject !== 'null'
|
|
622
622
|
? currentProject
|
|
623
623
|
: projects.some(p => p.id === 'website')
|
|
624
|
-
|
|
625
|
-
|
|
624
|
+
? 'website'
|
|
625
|
+
: undefined;
|
|
626
626
|
|
|
627
627
|
session.UpdateEnv({
|
|
628
628
|
projects: projects.map(p => p.id),
|
|
@@ -641,6 +641,7 @@ class ContensisCli {
|
|
|
641
641
|
try {
|
|
642
642
|
color = chalk.keyword((project as any).color);
|
|
643
643
|
} catch (ex) {
|
|
644
|
+
Logger.debug(`${ex}`);
|
|
644
645
|
color = chalk.white;
|
|
645
646
|
}
|
|
646
647
|
console.log(
|
|
@@ -671,7 +672,7 @@ class ContensisCli {
|
|
|
671
672
|
};
|
|
672
673
|
|
|
673
674
|
PrintProject = async (projectId = this.currentProject) => {
|
|
674
|
-
const { log, messages
|
|
675
|
+
const { log, messages } = this;
|
|
675
676
|
const contensis = await this.ConnectContensis();
|
|
676
677
|
|
|
677
678
|
if (contensis) {
|
|
@@ -816,7 +817,7 @@ class ContensisCli {
|
|
|
816
817
|
const contensis = await this.ConnectContensis({ commit: true });
|
|
817
818
|
|
|
818
819
|
if (contensis) {
|
|
819
|
-
const [err
|
|
820
|
+
const [err] = await contensis.apiKeys.RemoveKey(id);
|
|
820
821
|
|
|
821
822
|
if (!err) {
|
|
822
823
|
log.success(messages.keys.removed(currentEnv, id));
|
|
@@ -1525,10 +1526,9 @@ class ContensisCli {
|
|
|
1525
1526
|
contentType.projectId = currentProject;
|
|
1526
1527
|
delete contentType.uuid;
|
|
1527
1528
|
|
|
1528
|
-
const [err,
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
].repo.UpsertContentType(false, contentType);
|
|
1529
|
+
const [err, , createStatus] = await contensis.models.targetRepos[
|
|
1530
|
+
currentProject
|
|
1531
|
+
].repo.UpsertContentType(false, contentType);
|
|
1532
1532
|
|
|
1533
1533
|
if (err) log.error(err.message, err);
|
|
1534
1534
|
if (createStatus) {
|
|
@@ -1717,10 +1717,9 @@ class ContensisCli {
|
|
|
1717
1717
|
component.projectId = currentProject;
|
|
1718
1718
|
delete component.uuid;
|
|
1719
1719
|
|
|
1720
|
-
const [err,
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
].repo.UpsertComponent(false, component);
|
|
1720
|
+
const [err, , createStatus] = await contensis.models.targetRepos[
|
|
1721
|
+
currentProject
|
|
1722
|
+
].repo.UpsertComponent(false, component);
|
|
1724
1723
|
|
|
1725
1724
|
if (err) log.error(err.message, err);
|
|
1726
1725
|
if (createStatus) {
|
|
@@ -1801,15 +1800,23 @@ class ContensisCli {
|
|
|
1801
1800
|
// Add a full sys.uri to asset entries
|
|
1802
1801
|
// Add sys.metadata.exportCms
|
|
1803
1802
|
// Add sys.metadata.exportProjectId
|
|
1803
|
+
const nodes = contensis.content.source.nodes.raw;
|
|
1804
|
+
const combinedOutput = [...entries, ...nodes];
|
|
1804
1805
|
|
|
1805
|
-
await this.HandleFormattingAndOutput(
|
|
1806
|
+
await this.HandleFormattingAndOutput(combinedOutput, () => {
|
|
1806
1807
|
// print the entries to console
|
|
1807
1808
|
logEntitiesTable({
|
|
1808
1809
|
entries,
|
|
1809
1810
|
projectId: currentProject,
|
|
1810
1811
|
fields: contensis.payload.query?.fields,
|
|
1811
|
-
})
|
|
1812
|
-
|
|
1812
|
+
});
|
|
1813
|
+
if (nodes.length)
|
|
1814
|
+
logEntitiesTable({
|
|
1815
|
+
nodes,
|
|
1816
|
+
projectId: currentProject,
|
|
1817
|
+
fields: contensis.payload.query?.fields,
|
|
1818
|
+
});
|
|
1819
|
+
});
|
|
1813
1820
|
} else {
|
|
1814
1821
|
log.warning(messages.models.noList(currentProject));
|
|
1815
1822
|
log.help(messages.connect.tip());
|
|
@@ -1850,7 +1857,11 @@ class ContensisCli {
|
|
|
1850
1857
|
const { entries, nodes } = contensis.content.targets[currentProject];
|
|
1851
1858
|
|
|
1852
1859
|
const output = saveEntries
|
|
1853
|
-
? entries
|
|
1860
|
+
? // include entries and dependent nodes when saving entries
|
|
1861
|
+
[
|
|
1862
|
+
entries.migrate?.map(me => me.toJSON()) || [],
|
|
1863
|
+
nodes.migrateNodes.map(mn => mn.node),
|
|
1864
|
+
].flat()
|
|
1854
1865
|
: result;
|
|
1855
1866
|
await this.HandleFormattingAndOutput(output, () => {
|
|
1856
1867
|
// print the migrateResult to console
|
|
@@ -2075,8 +2086,8 @@ class ContensisCli {
|
|
|
2075
2086
|
) {
|
|
2076
2087
|
let totalCount: number;
|
|
2077
2088
|
if (commit) {
|
|
2078
|
-
|
|
2079
|
-
|
|
2089
|
+
const created = typeof nodesCreated === 'number' ? nodesCreated : 0;
|
|
2090
|
+
const updated = typeof nodesUpdated === 'number' ? nodesUpdated : 0;
|
|
2080
2091
|
|
|
2081
2092
|
totalCount = created + updated;
|
|
2082
2093
|
} else {
|
|
@@ -2368,9 +2379,8 @@ class ContensisCli {
|
|
|
2368
2379
|
const contensis = await this.ConnectContensis();
|
|
2369
2380
|
if (contensis) {
|
|
2370
2381
|
// Push new block version
|
|
2371
|
-
const [err, blockVersion] =
|
|
2372
|
-
block
|
|
2373
|
-
);
|
|
2382
|
+
const [err, blockVersion] =
|
|
2383
|
+
await contensis.blocks.PushBlockVersion(block);
|
|
2374
2384
|
if (!err) {
|
|
2375
2385
|
log.success(
|
|
2376
2386
|
messages.blocks.pushed(
|
|
@@ -2447,9 +2457,8 @@ class ContensisCli {
|
|
|
2447
2457
|
|
|
2448
2458
|
// If action is release and version is latest, find the latest version number
|
|
2449
2459
|
if (action === 'release' && version === 'latest') {
|
|
2450
|
-
const [getErr, blockVersion] =
|
|
2451
|
-
blockId
|
|
2452
|
-
);
|
|
2460
|
+
const [getErr, blockVersion] =
|
|
2461
|
+
await this.GetLatestBlockVersion(blockId);
|
|
2453
2462
|
|
|
2454
2463
|
if (getErr) {
|
|
2455
2464
|
// Log error getting latest block version no
|
|
@@ -2562,7 +2571,7 @@ class ContensisCli {
|
|
|
2562
2571
|
stopFollowing();
|
|
2563
2572
|
});
|
|
2564
2573
|
|
|
2565
|
-
|
|
2574
|
+
const delay = promiseDelay(5 * 1000, null);
|
|
2566
2575
|
const stopFollowing = () => {
|
|
2567
2576
|
following = false;
|
|
2568
2577
|
delay.cancel();
|
|
@@ -2666,6 +2675,7 @@ class ContensisCli {
|
|
|
2666
2675
|
}
|
|
2667
2676
|
};
|
|
2668
2677
|
|
|
2678
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2669
2679
|
PrintRenderers = async (rendererId?: string) => {
|
|
2670
2680
|
const { currentEnv, env, log, messages } = this;
|
|
2671
2681
|
const contensis = await this.ConnectContensis();
|
|
@@ -58,7 +58,7 @@ class ContensisDev extends ContensisRole {
|
|
|
58
58
|
return pattern.test(blockId);
|
|
59
59
|
} else return false;
|
|
60
60
|
};
|
|
61
|
-
|
|
61
|
+
const { blockId } = await inquirer.prompt({
|
|
62
62
|
name: 'blockId',
|
|
63
63
|
type: 'input',
|
|
64
64
|
prefix: '🧱',
|
|
@@ -275,7 +275,7 @@ class ContensisDev extends ContensisRole {
|
|
|
275
275
|
|
|
276
276
|
const envFilePath = `${projectHome}/.env`;
|
|
277
277
|
const existingEnvFile = readFile(envFilePath);
|
|
278
|
-
|
|
278
|
+
const existingEnvFileArray = (existingEnvFile || '')
|
|
279
279
|
.split('\n')
|
|
280
280
|
.filter(l => !!l);
|
|
281
281
|
|
|
@@ -89,7 +89,7 @@ const determineMost = (chunk: string, items: string[]) => {
|
|
|
89
89
|
items.forEach(item => {
|
|
90
90
|
itemCount[item] = 0;
|
|
91
91
|
});
|
|
92
|
-
for (
|
|
92
|
+
for (let i = 0; i < chunk.length; i++) {
|
|
93
93
|
if (chunk[i] === '"') ignoreString = !ignoreString;
|
|
94
94
|
else if (!ignoreString && chunk[i] in itemCount) {
|
|
95
95
|
currValue = ++itemCount[chunk[i]];
|
package/src/util/index.ts
CHANGED
|
@@ -58,7 +58,7 @@ export const Logging = async (language = 'en-GB') => {
|
|
|
58
58
|
// const { LogMessages: defaultMessages } = await import(
|
|
59
59
|
// `../localisation/en-GB.js`
|
|
60
60
|
// );
|
|
61
|
-
|
|
61
|
+
const localisedMessages = defaultMessages;
|
|
62
62
|
|
|
63
63
|
if (language === 'en-GB') {
|
|
64
64
|
// Using a variable import e.g. `import(`../localisation/${language}.js`);`
|
package/src/util/logger.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
1
|
import chalk from 'chalk';
|
|
3
2
|
import dateFormat from 'dateformat';
|
|
4
3
|
import deepCleaner from 'deep-cleaner';
|
|
@@ -120,9 +119,9 @@ export class Logger {
|
|
|
120
119
|
field.id === content.entryTitleField
|
|
121
120
|
? '**'
|
|
122
121
|
: field.validations.minCount?.value ||
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
typeof field.validations.required?.message !== 'undefined'
|
|
123
|
+
? '*'
|
|
124
|
+
: ''
|
|
126
125
|
}: ${chalk.grey(
|
|
127
126
|
`${field.dataType}${
|
|
128
127
|
field.dataFormat
|
|
@@ -203,16 +202,17 @@ export class Logger {
|
|
|
203
202
|
if (item.length)
|
|
204
203
|
Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));
|
|
205
204
|
else Logger.objectRecurse(item, depth + 1, `${indent} `);
|
|
206
|
-
else
|
|
207
|
-
Array.isArray(item)
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
205
|
+
else {
|
|
206
|
+
if (Array.isArray(item))
|
|
207
|
+
Logger.raw(
|
|
208
|
+
`${indent}${chalk.grey(`[`)}${item.join(', ')}${chalk.grey(
|
|
209
|
+
`]`
|
|
210
|
+
)}`
|
|
211
|
+
);
|
|
212
|
+
else if (typeof item === 'object' && item)
|
|
213
|
+
Logger.objectRecurse(item, depth + 1, `${indent} `);
|
|
214
|
+
else Logger.raw(`${indent}${item}`);
|
|
215
|
+
}
|
|
216
216
|
} else Logger.raw(`${indent}${item}`);
|
|
217
217
|
}
|
|
218
218
|
} else {
|
|
@@ -253,6 +253,7 @@ export class Logger {
|
|
|
253
253
|
content: string,
|
|
254
254
|
displayLength = 30,
|
|
255
255
|
consoleWidth = process.stdout.columns,
|
|
256
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
256
257
|
logMethod: Function = console.info
|
|
257
258
|
) => {
|
|
258
259
|
if (consoleWidth) {
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "1.3.1-beta.
|
|
1
|
+
export const LIB_VERSION = "1.3.1-beta.2";
|