contensis-cli 1.6.1-beta.7 → 1.6.1-beta.8
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/dist/commands/dev.js +4 -1
- package/dist/commands/dev.js.map +2 -2
- package/dist/localisation/en-GB.js +2 -0
- package/dist/localisation/en-GB.js.map +2 -2
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js +24 -17
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js.map +3 -3
- package/dist/services/ContensisDevService.js +77 -29
- package/dist/services/ContensisDevService.js.map +3 -3
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -1
- package/src/commands/dev.ts +6 -2
- package/src/localisation/en-GB.ts +3 -0
- package/src/mappers/DevRequests-to-RequestHanderCliArgs.ts +22 -17
- package/src/services/ContensisDevService.ts +99 -35
- package/src/version.ts +1 -1
package/dist/commands/dev.js
CHANGED
|
@@ -56,6 +56,9 @@ Example call:
|
|
|
56
56
|
).option("--args <args...>", "override or add additional args").option(
|
|
57
57
|
"--release <release>",
|
|
58
58
|
"launch a specific release version of the request handler"
|
|
59
|
+
).option(
|
|
60
|
+
"--override [override...]",
|
|
61
|
+
"override configurations for other blocks"
|
|
59
62
|
).usage("[block-id] [local-uri]").addHelpText(
|
|
60
63
|
"after",
|
|
61
64
|
`
|
|
@@ -67,7 +70,7 @@ Example call:
|
|
|
67
70
|
await (0, import_ContensisDevService.devCommand)(
|
|
68
71
|
["dev", "requests", blockId.join(" ")],
|
|
69
72
|
opts
|
|
70
|
-
).ExecRequestHandler(blockId, opts == null ? void 0 : opts.args, opts.release);
|
|
73
|
+
).ExecRequestHandler(blockId, opts == null ? void 0 : opts.override, opts == null ? void 0 : opts.args, opts.release);
|
|
71
74
|
});
|
|
72
75
|
return dev;
|
|
73
76
|
};
|
package/dist/commands/dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/dev.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport { devCommand } from '~/services/ContensisDevService';\n\nexport const makeDevCommand = () => {\n const dev = new Command()\n .command('dev')\n .description('dev command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n dev\n .command('init')\n .description(\n 'initialise a git clone directory to connect and deploy to Contensis'\n )\n .argument(\n '[projectHome]',\n 'the path of the folder to initialise',\n process.cwd()\n )\n .option(\n '--url <url>',\n 'override the git url or add one to initialise a non-git folder'\n )\n .option(\n '-d --dry-run',\n 'perform a dry run of the project initialisation where no changes are made'\n )\n // .option(\n // '--commit',\n // 'commit change (will eventually be deprecated in favour of --dry-run)',\n // true\n // )\n .addHelpText(\n 'after',\n `\nExample call:\n > dev init\\n`\n )\n .action(async (projectHome: string, opts) => {\n // TODO: add opts for overriding project name and git url\n await devCommand(['dev', 'init', projectHome], opts).DevelopmentInit(\n projectHome,\n { ...opts, dryRun: opts.dryRun }\n );\n });\n\n dev\n .command('requests')\n .description('launch request handler for local development')\n .argument(\n '[block-id...]',\n 'id of block to develop locally and the local uri to pass requests for this block onto'\n )\n .option('--args <args...>', 'override or add additional args')\n .option(\n '--release <release>',\n 'launch a specific release version of the request handler'\n )\n .usage('[block-id] [local-uri]')\n .addHelpText(\n 'after',\n `\nExample call:\n > dev requests test-block-one\n > dev requests my-website http://localhost:8080\\n`\n )\n .action(async (blockId: string[] = [], opts) => {\n await devCommand(\n ['dev', 'requests', blockId.join(' ')],\n opts\n ).ExecRequestHandler(blockId, opts?.args, opts.release);\n });\n\n return dev;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import { Command, Option } from 'commander';\nimport { devCommand } from '~/services/ContensisDevService';\n\nexport const makeDevCommand = () => {\n const dev = new Command()\n .command('dev')\n .description('dev command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n dev\n .command('init')\n .description(\n 'initialise a git clone directory to connect and deploy to Contensis'\n )\n .argument(\n '[projectHome]',\n 'the path of the folder to initialise',\n process.cwd()\n )\n .option(\n '--url <url>',\n 'override the git url or add one to initialise a non-git folder'\n )\n .option(\n '-d --dry-run',\n 'perform a dry run of the project initialisation where no changes are made'\n )\n // .option(\n // '--commit',\n // 'commit change (will eventually be deprecated in favour of --dry-run)',\n // true\n // )\n .addHelpText(\n 'after',\n `\nExample call:\n > dev init\\n`\n )\n .action(async (projectHome: string, opts) => {\n // TODO: add opts for overriding project name and git url\n await devCommand(['dev', 'init', projectHome], opts).DevelopmentInit(\n projectHome,\n { ...opts, dryRun: opts.dryRun }\n );\n });\n\n dev\n .command('requests')\n .description('launch request handler for local development')\n .argument(\n '[block-id...]',\n 'id of block to develop locally and the local uri to pass requests for this block onto'\n )\n .option('--args <args...>', 'override or add additional args')\n .option(\n '--release <release>',\n 'launch a specific release version of the request handler'\n )\n .option(\n '--override [override...]',\n 'override configurations for other blocks'\n )\n .usage('[block-id] [local-uri]')\n .addHelpText(\n 'after',\n `\nExample call:\n > dev requests test-block-one\n > dev requests my-website http://localhost:8080\\n`\n )\n .action(async (blockId: string[] = [], opts) => {\n await devCommand(\n ['dev', 'requests', blockId.join(' ')],\n opts\n ).ExecRequestHandler(blockId, opts?.override, opts?.args, opts.release);\n });\n\n return dev;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAChC,iCAA2B;AAEpB,MAAM,iBAAiB,MAAM;AAClC,QAAM,MAAM,IAAI,yBAAQ,EACrB,QAAQ,KAAK,EACb,YAAY,aAAa,EACzB,YAAY,SAAS;AAAA,CAAI,EACzB,mBAAmB,IAAI,EACvB,aAAa;AAEhB,MACG,QAAQ,MAAM,EACd;AAAA,IACC;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,IACA,QAAQ,IAAI;AAAA,EACd,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EAMC;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,EAGF,EACC,OAAO,OAAO,aAAqB,SAAS;AAE3C,cAAM,uCAAW,CAAC,OAAO,QAAQ,WAAW,GAAG,IAAI,EAAE;AAAA,MACnD;AAAA,MACA,EAAE,GAAG,MAAM,QAAQ,KAAK,OAAO;AAAA,IACjC;AAAA,EACF,CAAC;AAEH,MACG,QAAQ,UAAU,EAClB,YAAY,8CAA8C,EAC1D;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,oBAAoB,iCAAiC,EAC5D;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,MAAM,wBAAwB,EAC9B;AAAA,IACC;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAIF,EACC,OAAO,OAAO,UAAoB,CAAC,GAAG,SAAS;AAC9C,cAAM;AAAA,MACJ,CAAC,OAAO,YAAY,QAAQ,KAAK,GAAG,CAAC;AAAA,MACrC;AAAA,IACF,EAAE,mBAAmB,SAAS,6BAAM,UAAU,6BAAM,MAAM,KAAK,OAAO;AAAA,EACxE,CAAC;AAEH,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -542,6 +542,8 @@ ${git.type === "github" ? `Add a "New repository secret"` : `Expand "Variables"
|
|
|
542
542
|
launch: () => `Launching request handler for local development`,
|
|
543
543
|
overrideBlock: () => `Which block will you be running?`,
|
|
544
544
|
overrideUri: () => `How to access your development site`,
|
|
545
|
+
overrideBlocks: () => `Which blocks will you be overriding?`,
|
|
546
|
+
overrideBranch: (blockId) => `Which branch would you like ${blockId} to target?`,
|
|
545
547
|
spawn: () => `If you see a firewall popup requesting network access, it is safe to approve`,
|
|
546
548
|
exited: (code) => `Request handler exited with code ${code}
|
|
547
549
|
`,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/localisation/en-GB.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n BlockActionType,\n BlockRunningStatus,\n MigrateModelsResult,\n MigrateStatus,\n} from 'migratortron';\nimport pl from 'pluralize';\nimport { GitHelper } from '~/util/git';\nimport { Logger } from '~/util/logger';\nimport { winSlash } from '~/util/os';\n\nexport const LogMessages = {\n app: {\n contensis: () => 'Contensis',\n quit: () => `Goodbye \uD83D\uDC4B\\n`,\n startup: (version: string) =>\n `v${version} \u00A9 2001-${new Date().getFullYear()} Zengenti \uD83C\uDDEC\uD83C\uDDE7. \\n - Creators of Contensis and purveyors of other fine software\\n\\n\uD83D\uDC4B Welcome to the contensis-cli\\n`,\n help: () =>\n 'Press [CTRL]+[C] or type \"quit\" to return to your system shell\\nPress [TAB] for suggestions\\n',\n suggestions: () =>\n `\\n${Logger.errorText('>>')} Press [TAB] for suggestions\\n`,\n autocomplete: () => `\\n${Logger.errorText('>>')} Available commands:`,\n unknownError: () => `Something went wrong...`,\n fileOutput: (format = 'json', path?: string) =>\n `Output ${format} file: ${Logger.infoText(path)}\\n`,\n noFileOutput: () => `No output written\\n`,\n },\n command: {\n notKnown: (command: string) => `${command} is not known`,\n },\n envs: {\n found: (num: number) =>\n `Environments store found containing ${pl('environment', num, true)}`,\n notFound: (alias: string) =>\n `Environment ${Logger.highlightText(alias)} was not found in session cache`,\n removed: (alias: string) =>\n `Removed environment ${Logger.highlightText(alias)} from session cache`,\n tip: () =>\n `Connect to a Contensis cloud instance using \"contensis connect {cms alias}\"`,\n },\n connect: {\n command: {\n name: () => 'connect',\n example: () => `Example call:\\n > connect example-dev`,\n },\n args: {\n alias: {\n name: () => '<alias>',\n description: () => 'the Contensis Cloud alias to connect with',\n },\n },\n noEnv: () => `Cannot connect - no environment alias specified`,\n unreachable: (url: string, status: number) =>\n `Cannot reach ${url}${status ? ` - status ${status}` : ''}`,\n connected: (env: string) => `Current environment set to \"${env}\"`,\n help: () =>\n `Connect to a Contensis cloud instance using \"contensis connect {cms alias}\"`,\n projects: () => `Available projects:`,\n noProjects: () => `Cannot retrieve projects list`,\n tip: () =>\n `Introduce yourself with \"login {username}\" or \"login {clientId} -s {secret}\" or by passing credentials as options with your command`,\n },\n login: {\n command: {\n name: () => 'login',\n usage: () => `<user/clientId> [password] [-s <sharedSecret>]`,\n example: () =>\n `Example call:\\n > login myuserid\\n -- or --\\n > login {clientId} -s {sharedSecret}`,\n },\n args: {\n user: {\n name: () => '<user/clientId>',\n description: () => 'the username to login with',\n },\n password: {\n name: () => '[password]',\n description: () =>\n 'the password to use to login with (optional/insecure)',\n },\n secret: {\n name: () => '-s --sharedSecret <sharedSecret>',\n description: () =>\n 'the shared secret to use when logging in with a client id',\n },\n },\n passwordPrompt: (env?: string, userId?: string) =>\n userId\n ? `Enter password for ${userId}@${env}:`\n : `Please enter a password`,\n failed: (env: string, userId: string) =>\n `Unable to login to ${env} as ${userId}`,\n success: (env: string, userId: string) =>\n `User ${userId} connected to ${env} successfully\\n`,\n insecurePassword: () =>\n `Could not connect to local keystore - your password could be stored unencrypted!`,\n noEnv: () => `No environment set, use \"contensis connect {alias}\" first`,\n noUserId: () => `No user id specified`,\n },\n projects: {\n list: () => `Available projects:`,\n noList: () => `Cannot retrieve projects list`,\n set: (projectId: string) =>\n `Current project is set to ${Logger.highlightText(projectId)}`,\n failedSet: (projectId: string) =>\n `Project ${Logger.highlightText(projectId)} not found`,\n tip: () =>\n `You need to set your current working project with \"set project {projectId}\"`,\n created: (env: string, id: string) =>\n `[${env}] Created project ${Logger.highlightText(id)}`,\n failedCreate: (env: string, id: string) =>\n `[${env}] Unable to create project ${Logger.highlightText(id)}`,\n updated: (env: string, id: string) =>\n `[${env}] Updated project ${Logger.highlightText(id)}`,\n failedUpdate: (env: string, id: string) =>\n `[${env}] Unable to update project ${Logger.highlightText(id)}`,\n },\n migrate: {\n commitTip: () => `Add --commit flag to commit the previewed changes`,\n preview: (verb = 'IMPORT') => `\uD83D\uDD0D ${verb} PREVIEW \uD83D\uDD2D`,\n commit: (verb = 'IMPORT') => `COMMITTING ${verb} \u2728\u2604\uFE0F `,\n imported: (\n env: string,\n commit: boolean,\n entities: { [noun: string]: number }\n ) =>\n `${commit ? `Imported` : `Will import`} ${Object.entries(entities)\n .map(\n ([noun, count], i, arr) =>\n `${i > 0 ? (i === arr.length - 1 ? ' and ' : ', ') : ''}${pl(noun, count, true)}`\n )\n .join('')} into ${env} environment`,\n\n models: {\n result: (\n status: keyof MigrateModelsResult['project']['contentTypes']\n ) => {\n switch (status) {\n case 'created':\n case 'updated':\n return Logger.successText;\n case 'errors':\n return Logger.errorText;\n default:\n return Logger.infoText;\n }\n },\n },\n status: (status: MigrateStatus) => {\n switch (status) {\n case 'no change':\n return Logger.successText;\n case 'create':\n case 'two-pass':\n case 'update':\n case 'delete':\n return Logger.warningText;\n case 'error':\n case 'not found':\n return Logger.errorText;\n default:\n return Logger.infoText;\n }\n },\n },\n models: {\n list: (projectId: string) =>\n `Content models in ${Logger.highlightText(projectId)}:`,\n noList: (projectId: string) =>\n `[${projectId}] Cannot retrieve content models`,\n get: (projectId: string, id: string) =>\n `[${projectId}] Content models ${Logger.infoText(`[ ${id} ]`)}`,\n failedGet: (projectId: string, id: string) =>\n `[${projectId}] Unable to get content models ${Logger.highlightText(id)}`,\n },\n nodes: {\n imported: (env: string, commit: boolean, count: number) =>\n LogMessages.migrate.imported(env, commit, { node: count }),\n failedImport: (env: string) => `[${env}] Unable to import nodes`,\n removed: (env: string, commit: boolean, root: string) =>\n `[${env}] ${commit ? `Deleted` : `Will delete`} nodes at ${root}`,\n failedRemove: (env: string) => `[${env}] Unable to delete nodes`,\n notFound: (env: string) => `[${env}] Nodes were not found `,\n commitTip: () => `Add --commit flag to commit the previewed changes`,\n failedGet: (projectId: string) =>\n `[${projectId}] Cannot retrieve nodes from Site view`,\n get: (projectId: string, root: string, depth: number) =>\n `[${projectId}] Site view nodes at: ${Logger.highlightText(root)}${\n depth ? ` to a depth of ${depth}` : ``\n }\\n`,\n noChange: (env: string) => `[${env}] No changes to be made`,\n },\n contenttypes: {\n list: (projectId: string) =>\n `Content types in ${Logger.highlightText(projectId)}:`,\n get: (projectId: string, id: string) =>\n `[${projectId}] Content type ${Logger.highlightText(id)}`,\n failedGet: (projectId: string, id: string) =>\n `[${projectId}] Unable to get content type ${Logger.highlightText(id)}`,\n created: (projectId: string, id: string, status?: string) =>\n `[${projectId}] Content type ${status}d ${Logger.highlightText(id)}`,\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${\n commit ? `Deleted` : `Will delete`\n } content type(s) ${Logger.highlightText(id)}`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete content type(s) ${Logger.highlightText(id)}`,\n },\n components: {\n list: (projectId: string) =>\n `Components in ${Logger.highlightText(projectId)}:`,\n get: (projectId: string, id: string) =>\n `[${projectId}] Component ${Logger.highlightText(id)}`,\n failedGet: (projectId: string, id: string) =>\n `[${projectId}] Unable to get component ${Logger.highlightText(id)}`,\n created: (projectId: string, id: string, status?: string) =>\n `[${projectId}] Component ${status}d ${Logger.highlightText(id)}`,\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${\n commit ? `Deleted` : `Will delete`\n } component(s) ${Logger.highlightText(id)}`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete component(s) ${Logger.highlightText(id)}`,\n },\n version: {\n set: (env: string, versionStatus: string) =>\n `[${env}] Content version status set to \"${versionStatus}\"`,\n invalid: (versionStatus: string) =>\n `Content version status \"${versionStatus}\" is not valid, allowed values are \"published\" or \"latest\".`,\n noEnv: () =>\n `No Contensis environment set, connect to your Contensis cloud instance using \"contensis connect {cms alias}\"`,\n },\n entries: {\n imported: (\n env: string,\n commit: boolean,\n entries: number,\n nodes = 0,\n tags = 0\n ) =>\n LogMessages.migrate.imported(env, commit, {\n entry: entries,\n node: nodes,\n tag: tags,\n }),\n failedImport: (env: string) => `[${env}] Unable to import entries`,\n update: {\n preview: () => LogMessages.migrate.preview('UPDATE FIELD'),\n commit: () => LogMessages.migrate.commit('FIELD UPDATES'),\n success: (env: string, commit: boolean, entries: number, nodes = 0) =>\n `${commit ? `Updated` : `Will update`} ${pl('entry', entries, true)}${\n nodes > 0 ? ` and ${pl('node', nodes, true)}` : ''\n } in ${env} environment`,\n failed: (env: string) => `[${env}] Unable to update any entries`,\n },\n removed: (env: string, commit: boolean) =>\n `[${env}] ${commit ? `Deleted` : `Will delete`} entries`,\n failedRemove: (env: string) => `[${env}] Unable to delete entries`,\n notFound: (env: string) => `[${env}] Entries were not found`,\n noChange: (env: string) => `[${env}] No changes to be made`,\n },\n keys: {\n list: (env: string) => `[${env}] API keys:`,\n noList: (env: string) => `[${env}] Cannot retrieve API keys`,\n created: (env: string, name: string) =>\n `[${env}] Created API key ${Logger.highlightText(name)}`,\n tip: () =>\n `Assign your new key to a role with \"set role assignments\", or create a new role with \"create role\"`,\n failedCreate: (env: string, name: string) =>\n `[${env}] Unable to create API key ${Logger.highlightText(name)}`,\n failedUpdate: (env: string, name: string) =>\n `[${env}] Unable to update API key ${Logger.highlightText(name)}`,\n removed: (env: string, id: string) =>\n `[${env}] Deleted API key ${Logger.highlightText(id)}`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete API key ${Logger.highlightText(id)}`,\n },\n proxies: {\n list: (env: string, projectId: string | undefined) =>\n `[${env}] Retrieved proxies in project ${projectId}:`,\n noList: (env: string, projectId: string | undefined) =>\n `[${env}] Cannot retrieve proxies in project ${projectId}`,\n // noneExist: () => `Create a role with \"create renderer\"`,\n failedGet: (env: string, name: string, projectId: string) =>\n `[${env}] Unable to find proxy ${Logger.highlightText(\n name\n )} in project ${projectId}`,\n created: (env: string, name: string, projectId: string) =>\n `[${env}] Created proxy ${Logger.highlightText(\n name\n )} in project ${projectId}\\n`,\n failedCreate: (env: string, name: string, projectId: string) =>\n `[${env}] Unable to create proxy ${Logger.highlightText(\n name\n )} in project ${projectId}`,\n setPayload: () => `Updating proxy with details\\n`,\n set: () => `Succesfully updated proxy\\n`,\n failedSet: (env: string, name: string, projectId: string) =>\n `[${env}] Unable to update proxy ${Logger.highlightText(\n name\n )} in project ${projectId}`,\n removed: (env: string, id: string, projectId: string) =>\n `[${env}] Deleted proxy ${Logger.highlightText(\n id\n )} in project ${projectId}\\n`,\n failedRemove: (env: string, id: string, projectId: string) =>\n `[${env}] Unable to delete proxy ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n },\n renderers: {\n list: (env: string, projectId: string | undefined) =>\n `[${env}] Retrieved renderers in project ${projectId}:`,\n noList: (env: string, projectId: string | undefined) =>\n `[${env}] Cannot retrieve renderers in project ${projectId}`,\n // noneExist: () => `Create a role with \"create renderer\"`,\n failedGet: (env: string, name: string, projectId: string) =>\n `[${env}] Unable to find renderer ${Logger.highlightText(\n name\n )} in project ${projectId}`,\n created: (env: string, name: string, projectId: string) =>\n `[${env}] Created renderer ${Logger.highlightText(\n name\n )} in project ${projectId}\\n`,\n failedCreate: (env: string, name: string, projectId: string) =>\n `[${env}] Unable to create renderer ${Logger.highlightText(\n name\n )} in project ${projectId}`,\n setPayload: () => `Updating renderer with details\\n`,\n set: () => `Succesfully updated renderer\\n`,\n failedSet: (env: string, name: string, projectId: string) =>\n `[${env}] Unable to update renderer ${Logger.highlightText(\n name\n )} in project ${projectId}`,\n removed: (env: string, id: string, projectId: string) =>\n `[${env}] Deleted renderer ${Logger.highlightText(\n id\n )} in project ${projectId}\\n`,\n failedRemove: (env: string, id: string, projectId: string) =>\n `[${env}] Unable to delete renderer ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n },\n roles: {\n list: (env: string) => `[${env}] Retrieved roles`,\n noList: (env: string) => `[${env}] Cannot retrieve roles`,\n noneExist: () => `Create a role with \"create role\"`,\n failedGet: (env: string, name: string) =>\n `[${env}] Unable to find role ${Logger.highlightText(name)}`,\n created: (env: string, name: string) =>\n `[${env}] Created role ${Logger.highlightText(name)}\\n`,\n tip: () =>\n `Give access to your role with \"set role assignments\", allow your role to do things with \"set role permissions\"`,\n failedCreate: (env: string, name?: string) =>\n `[${env}] Unable to create role ${Logger.highlightText(name)}`,\n setPayload: () => `Updating role with details\\n`,\n set: () => `Succesfully updated role\\n`,\n failedSet: (env: string, name?: string) =>\n `[${env}] Unable to update role ${Logger.highlightText(name)}`,\n removed: (env: string, id: string) =>\n `[${env}] Deleted role ${Logger.highlightText(id)}\\n`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete role ${Logger.highlightText(id)}`,\n },\n taggroups: {\n list: (env: string, length: number) =>\n `[${env}] Retrieved ${pl('tag group', length, true)}`,\n noList: (env: string) => `[${env}] Cannot retrieve tag groups`,\n noneExist: () => `Create a tag group with \"create taggroup <name>\"`,\n imported: (env: string, commit: boolean, groups: number, tags: number) =>\n LogMessages.migrate.imported(env, commit, {\n 'tag group': groups,\n tag: tags,\n }),\n failedGet: (env: string, name: string) =>\n `[${env}] Unable to find a tag group ${Logger.highlightText(name)}`,\n created: (env: string, name: string) =>\n `[${env}] Created tag group ${Logger.highlightText(name)}\\n`,\n tip: () =>\n `Give access to your role with \"set role assignments\", allow your role to do things with \"set role permissions\"`,\n failedCreate: (env: string, name?: string) =>\n `[${env}] Unable to create ${name ? `tag group ${Logger.highlightText(name)}` : 'tag groups'}`,\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${\n commit ? `Deleted` : `Will delete`\n } tag group ${Logger.highlightText(id)}\\n`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete tag group ${Logger.highlightText(id)}`,\n },\n tags: {\n list: (env: string, length: number) =>\n `[${env}] Retrieved ${pl('tag', length, true)}`,\n noList: (env: string) => `[${env}] Cannot retrieve tags`,\n noneExist: () =>\n `Create a tag with \"create tag in <groupId> <tag label(s)...>\"`,\n imported: (env: string, commit: boolean, tags: number) =>\n LogMessages.migrate.imported(env, commit, { tag: tags }),\n failedGet: (env: string) => `[${env}] Unable to find tags`,\n created: (env: string, name: string) =>\n `[${env}] Created tag ${Logger.highlightText(name)}\\n`,\n failedCreate: (env: string, name?: string) =>\n `[${env}] Unable to create ${name ? `tag ${Logger.highlightText(name)}` : 'tags'}`,\n removed: (env: string, length: number, commit: boolean) =>\n `[${env}] ${\n !length\n ? 'No tags to delete'\n : `${commit ? `Deleted` : `Will delete`} ${pl('tag', length, true)}\\n`\n }`,\n failedRemove: (env: string, length: number) =>\n `[${env}] Unable to delete tags with ${pl('error', length)}`,\n noChange: (env: string) => `[${env}] No changes to be made`,\n },\n blocks: {\n runningStatus: (status: BlockRunningStatus | 'broken') => {\n switch (status) {\n case 'available':\n return Logger.successText(status);\n case 'pending':\n case 'starting':\n case 'stopped':\n return Logger.warningText(status);\n case 'degraded':\n case 'faulted':\n case 'broken':\n return Logger.errorText(status);\n default:\n return Logger.infoText(status);\n }\n },\n get: (\n id: string,\n branch: string,\n version: string,\n env: string,\n projectId?: string\n ) =>\n `[${env}] ${\n version && version !== 'latest'\n ? `Found v${version}`\n : 'Latest block versions'\n } for ${Logger.infoText(`${branch}/`)}${Logger.highlightText(\n id\n )} in project ${projectId}\\n`,\n noGet: (\n id: string,\n branch: string,\n version: string,\n env: string,\n projectId?: string\n ) =>\n `[${env}] Did not find ${\n version ? `v${version}` : 'any block versions'\n } for ${Logger.highlightText(id)} in branch ${Logger.infoText(\n branch\n )} in ${Logger.infoText(projectId)} project`,\n noGetTip: () =>\n `Check the available blocks and branches in this project by running \"list blocks\"`,\n list: (env: string, projectId?: string) =>\n `[${env}] Blocks in project ${projectId}\\n`,\n noList: (env: string, projectId?: string) =>\n `[${env}] Cannot retrieve blocks in project ${projectId}`,\n getLogs: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Requesting logs from block ${Logger.highlightText(\n id\n )} in branch ${branch} in project ${projectId}`,\n failedGetLogs: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to fetch block logs for ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n tryPush: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Request to push block ${Logger.highlightText(\n id\n )} in branch ${branch} in project ${projectId}`,\n pushed: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Pushed block ${Logger.highlightText(\n id\n )} in branch ${branch} in project ${projectId}`,\n failedPush: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to push block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n failedParsingVersion: () =>\n `Did not find a \"version.versionNo\" in response`,\n actionComplete: (\n action: BlockActionType,\n id: string,\n env: string,\n projectId?: string\n ) =>\n `[${env}] Action ${Logger.highlightText(\n action\n )} on ${Logger.highlightText(\n id\n )} in project ${projectId} requested successfully`,\n actionFailed: (\n action: BlockActionType,\n id: string,\n env: string,\n projectId?: string\n ) =>\n `[${env}] Problem executing ${action} on block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n deleted: (id: string, env: string, projectId?: string) =>\n `[${env}] Deleted block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n failedDelete: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to delete block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n stopFollow: (id: string, env: string, projectId?: string) =>\n `[${env}]\\n\\n \uD83D\uDC4C stop fetching new ${Logger.highlightText(\n id\n )} logs in project ${projectId}`,\n timeoutFollow: (id: string, env: string, projectId?: string) =>\n `[${env}]\\n\\n \uD83E\uDD0F pausing fetching new ${Logger.highlightText(\n id\n )} logs in project ${projectId} due to too many requests`,\n },\n webhooks: {\n list: (env: string) => `[${env}] Webhook subscriptions:`,\n noList: (env: string) => `[${env}] Cannot retrieve webhook subscriptions`,\n noneExist: () => `No webhook subscriptions exist`,\n imported: (env: string, commit: boolean, webhooks: number) =>\n LogMessages.migrate.imported(env, commit, { webhook: webhooks }),\n noChange: (env: string) => `[${env}] No changes to be made`,\n created: (env: string, name: string) =>\n `[${env}] Created Webhook subscription ${Logger.highlightText(name)}`,\n failedCreate: (env: string, name?: string) =>\n `[${env}] Unable to create ${name ? `webhook ${Logger.highlightText(name)}` : 'webhooks'}`,\n // failedCreate: (env: string, name: string) =>\n // `[${env}] Unable to create Webhook subscription ${Logger.highlightText(\n // name\n // )}`,\n deleted: (env: string, id: string) =>\n `[${env}] Deleted Webhook subscription ${Logger.highlightText(id)}`,\n failedDelete: (env: string, id: string) =>\n `[${env}] Unable to delete Webhook subscription ${Logger.highlightText(\n id\n )}`,\n },\n workflows: {\n list: (env: string) => `[${env}] Retrieved workflows`,\n noList: (env: string) => `[${env}] Cannot retrieve workflows`,\n noneExist: () => `No workflows found`,\n failedGet: (env: string, name: string) =>\n `[${env}] Unable to find workflow ${Logger.highlightText(name)}`,\n },\n devinit: {\n intro: () => `Contensis developer environment initialisation`,\n //`This will initialise your local working directory to develop with the current connected Contensis project`,\n projectDetails: (\n name: string,\n env: string,\n projectId: string,\n blockId: string,\n git: GitHelper\n ) =>\n `\n Project: ${Logger.standardText(name)}\n - Home: ${Logger.standardText(git.gitcwd())}\n - Repository: ${Logger.standardText(git.home)} \n - Block id: ${Logger.highlightText(blockId)}\n \n Connect to Contensis instance: ${Logger.standardText(env)}\n - Project id: ${Logger.standardText(projectId)}\n `,\n developmentKey: (name: string, existing: boolean) =>\n ` - ${\n !existing ? 'Create development API key' : 'Development API key found'\n }: ${Logger[!existing ? 'highlightText' : 'standardText'](name)}`,\n deploymentKey: (name: string, existing: boolean) =>\n ` - ${\n !existing ? 'Create deployment API key' : 'Deployment API key found'\n }: ${Logger[!existing ? 'highlightText' : 'standardText'](name)}`,\n ciIntro: (git: GitHelper, location: 'git' | 'env') =>\n `We will create API keys with permissions to use this project with Contensis, and add a job to your CI that will deploy a container build.\n ${\n location === 'git'\n ? `We will ask you to add secrets/variables to your git repository to give your workflow permission to push a Block to Contensis.\n ${Logger.infoText(`You could visit ${git.secretsUri} to check that you can see repository settings, \n a page not found generally indicates you need to ask the repo owner for permission to add repository secrets, \n or ask the repo owner to add these secrets for you.`)}`\n : ''\n }`,\n ciDetails: (filename: string) =>\n `Add push-block job to CI file: ${Logger.highlightText(filename)}\\n`,\n ciMultipleChoices: () =>\n `Multiple GitHub workflow files found\\n${Logger.infoText(\n `Tell us which GitHub workflow builds a container image after each push:`\n )}`,\n ciMultipleBuildJobChoices: () =>\n `Multiple build jobs found in workflow\\n${Logger.infoText(\n `Choose the build job that produces a fresh container image to push to a block:`\n )}`,\n ciMultipleJobChoices: () =>\n `Other jobs found in workflow\\n${Logger.infoText(\n `Choose the job that produces a fresh container image we can push to a block:`\n )}`,\n ciMultipleAppImageVarChoices: () =>\n `Do one of these variables point to your tagged app image?\\n${Logger.infoText(\n `we have included a default choice - ensure your build image is tagged exactly the same as this`\n )}`,\n ciEnterOwnAppImagePrompt: (git: GitHelper) =>\n `Tell us the registry uri your app image is tagged and pushed with (\u23CE accept default) \\n${Logger.infoText(\n `Tip: ${\n git.type === 'github'\n ? `GitHub context variables available\\nhttps://docs.github.com/en/actions/learn-github-actions/variables#using-contexts-to-access-variable-values`\n : `GitLab CI/CD variables available\\nhttps://docs.gitlab.com/ee/ci/variables/`\n }`\n )}\\n`,\n confirm: () =>\n `Confirm these details are correct so we can make changes to your project`,\n createDevKey: (keyName: string, existing: boolean) =>\n `${\n !existing ? 'Created' : 'Checked permissions for'\n } development API key ${Logger.standardText(keyName)}`,\n createDeployKey: (keyName: string, existing: boolean) =>\n `${\n !existing ? 'Created' : 'Checked permissions for'\n } deployment API key ${Logger.standardText(keyName)}`,\n createKeyFail: (keyName: string, existing: boolean) =>\n `Failed to ${\n !existing ? 'create' : 'update'\n } API key ${Logger.highlightText(keyName)}`,\n writeEnvFile: () => `Written .env file to project home directory`,\n useEnvFileTip: () =>\n `You should alter existing project code that connects a Contensis client to use the variables from this file`,\n writeCiFile: (ciFilePath: string) =>\n `Updated CI file ${Logger.standardText(winSlash(ciFilePath))}`,\n ciFileNoChanges: (ciFilePath: string) =>\n `No updates needed for CI file ${Logger.standardText(\n winSlash(ciFilePath)\n )}`,\n ciBlockTip: (blockId: string, env: string, projectId: string) =>\n `A job is included to deploy your built container image to ${Logger.standardText(\n projectId\n )} at ${Logger.standardText(env)} in a block called ${Logger.standardText(\n blockId\n )}`,\n addGitSecretsIntro: () =>\n `We have created an API key that allows you to deploy your app image to a Contensis Block but we need you to add these details to your GitLab repository.`,\n addGitSecretsHelp: (git: GitHelper, id?: string, secret?: string) =>\n `Add secrets or variables in your repository's settings page\\n\\nGo to ${Logger.highlightText(\n git.secretsUri\n )}\\n\\n${\n git.type === 'github'\n ? `Add a \"New repository secret\"`\n : `Expand \"Variables\" and hit \"Add variable\"`\n }\\n\\n ${\n git.type === 'github' ? `Secret name:` : `Key:`\n } ${Logger.highlightText(`CONTENSIS_CLIENT_ID`)}\\n ${\n git.type === 'github' ? `Secret:` : `Value:`\n } ${Logger.standardText(\n id\n )}\\n\\n ${`Add one more secret/variable to the repository`}\\n\\n ${\n git.type === 'github' ? `Secret name:` : `Key:`\n } ${Logger.highlightText(`CONTENSIS_SHARED_SECRET`)}\\n ${\n git.type === 'github' ? `Secret:` : `Value:`\n } ${Logger.standardText(secret)}`,\n accessTokenFetch: () =>\n `Please wait, fetching Delivery API access token \u23F3`,\n accessTokenSuccess: (token: string) =>\n `Successfully fetched Delivery API token\\n ${Logger.infoText(token)}`,\n accessTokenFailed: () =>\n `Something went wrong! If the problem persists, please contact our support team \uD83D\uDEDF`,\n accessTokenPermission: () =>\n `We need permission to fetch your Delivery API token, please try again \u26A0\uFE0F`,\n clientDetailsLocation: () =>\n `Which option would you like to use for storing your client ID and secret`,\n clientDetailsInGit: (git: GitHelper) =>\n `${\n git.type === 'github' ? 'GitHub' : 'GitLab'\n } variables (recommended for public repositories)`,\n clientDetailsInEnv: () =>\n `Env variables (recommended for private repositories)`,\n success: () => `Contensis developer environment initialisation complete`,\n partialSuccess: () =>\n `Contensis developer environment initialisation completed with errors`,\n failed: () => `Contensis developer environment initialisation failed`,\n dryRun: () =>\n `Contensis developer environment initialisation dry run completed`,\n dryRunKeyMessage: (dryRun: boolean) =>\n dryRun ? '<< not created: dry-run >>' : undefined,\n noChanges: () =>\n `No changes were made to your project, run the command again without the ${Logger.highlightText(\n '--dry-run'\n )} flag to update your project with these changes`,\n startProjectTip: () =>\n `Start up your project in the normal way for development`,\n blockIdQuestion: () =>\n `Please enter your block id, this should be unquie and in kebab case e.g ${Logger.highlightText(\n 'my-awesome-website'\n )}`,\n },\n devrequests: {\n install: {\n notFound: (repo: string) =>\n `Could not find a release in ${repo} repo - please check github`,\n download: (repo: string, version: string) => `Found release ${version}`,\n downloading: (repo: string, version: string) =>\n `Downloading ${repo} ${version}`,\n downloadFail: (repo: string, version: string) =>\n `Problem downloading release ${version} from ${repo}`,\n downloaded: (repo: string, version: string) =>\n `Downloaded ${repo} ${version}`,\n applyUpdate: (version: string, existing: string) =>\n `Use updated version ${version} ${Logger.infoText(\n `(replaces ${existing})`\n )}?`,\n },\n launch: () => `Launching request handler for local development`,\n overrideBlock: () => `Which block will you be running?`,\n overrideUri: () => `How to access your development site`,\n spawn: () =>\n `If you see a firewall popup requesting network access, it is safe to approve`,\n exited: (code: number | null) =>\n `Request handler exited with code ${code}\\n`,\n errored: (error: Error) =>\n `Could not launch request handler due to error \\n${error}`,\n missingBinary: (version: string) =>\n `Could not locate request handler module ${version}, attempting to reinstall`,\n },\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,uBAAe;AAEf,oBAAuB;AACvB,gBAAyB;AAElB,MAAM,cAAc;AAAA,EACzB,KAAK;AAAA,IACH,WAAW,MAAM;AAAA,IACjB,MAAM,MAAM;AAAA;AAAA,IACZ,SAAS,CAAC,YACR,IAAI,OAAO,eAAW,oBAAI,KAAK,GAAE,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAChD,MAAM,MACJ;AAAA,IACF,aAAa,MACX;AAAA,EAAK,qBAAO,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O;AAAA,MAChF;AAAA,IACF,CAAC;AAAA,EACL;AAAA,EACA,aAAa;AAAA,IACX,SAAS;AAAA,MACP,UAAU,CAAC,SACT,+BAA+B,IAAI;AAAA,MACrC,UAAU,CAAC,MAAc,YAAoB,iBAAiB,OAAO;AAAA,MACrE,aAAa,CAAC,MAAc,YAC1B,eAAe,IAAI,IAAI,OAAO;AAAA,MAChC,cAAc,CAAC,MAAc,YAC3B,+BAA+B,OAAO,SAAS,IAAI;AAAA,MACrD,YAAY,CAAC,MAAc,YACzB,cAAc,IAAI,IAAI,OAAO;AAAA,MAC/B,aAAa,CAAC,SAAiB,aAC7B,uBAAuB,OAAO,IAAI,qBAAO;AAAA,QACvC,aAAa,QAAQ;AAAA,MACvB,CAAC;AAAA,IACL;AAAA,IACA,QAAQ,MAAM;AAAA,IACd,eAAe,MAAM;AAAA,IACrB,aAAa,MAAM;AAAA,IACnB,OAAO,MACL;AAAA,IACF,QAAQ,CAAC,SACP,oCAAoC,IAAI;AAAA;AAAA,IAC1C,SAAS,CAAC,UACR;AAAA,EAAmD,KAAK;AAAA,IAC1D,eAAe,CAAC,YACd,2CAA2C,OAAO;AAAA,EACtD;AACF;",
|
|
4
|
+
"sourcesContent": ["import {\n BlockActionType,\n BlockRunningStatus,\n MigrateModelsResult,\n MigrateStatus,\n} from 'migratortron';\nimport pl from 'pluralize';\nimport { GitHelper } from '~/util/git';\nimport { Logger } from '~/util/logger';\nimport { winSlash } from '~/util/os';\n\nexport const LogMessages = {\n app: {\n contensis: () => 'Contensis',\n quit: () => `Goodbye \uD83D\uDC4B\\n`,\n startup: (version: string) =>\n `v${version} \u00A9 2001-${new Date().getFullYear()} Zengenti \uD83C\uDDEC\uD83C\uDDE7. \\n - Creators of Contensis and purveyors of other fine software\\n\\n\uD83D\uDC4B Welcome to the contensis-cli\\n`,\n help: () =>\n 'Press [CTRL]+[C] or type \"quit\" to return to your system shell\\nPress [TAB] for suggestions\\n',\n suggestions: () =>\n `\\n${Logger.errorText('>>')} Press [TAB] for suggestions\\n`,\n autocomplete: () => `\\n${Logger.errorText('>>')} Available commands:`,\n unknownError: () => `Something went wrong...`,\n fileOutput: (format = 'json', path?: string) =>\n `Output ${format} file: ${Logger.infoText(path)}\\n`,\n noFileOutput: () => `No output written\\n`,\n },\n command: {\n notKnown: (command: string) => `${command} is not known`,\n },\n envs: {\n found: (num: number) =>\n `Environments store found containing ${pl('environment', num, true)}`,\n notFound: (alias: string) =>\n `Environment ${Logger.highlightText(alias)} was not found in session cache`,\n removed: (alias: string) =>\n `Removed environment ${Logger.highlightText(alias)} from session cache`,\n tip: () =>\n `Connect to a Contensis cloud instance using \"contensis connect {cms alias}\"`,\n },\n connect: {\n command: {\n name: () => 'connect',\n example: () => `Example call:\\n > connect example-dev`,\n },\n args: {\n alias: {\n name: () => '<alias>',\n description: () => 'the Contensis Cloud alias to connect with',\n },\n },\n noEnv: () => `Cannot connect - no environment alias specified`,\n unreachable: (url: string, status: number) =>\n `Cannot reach ${url}${status ? ` - status ${status}` : ''}`,\n connected: (env: string) => `Current environment set to \"${env}\"`,\n help: () =>\n `Connect to a Contensis cloud instance using \"contensis connect {cms alias}\"`,\n projects: () => `Available projects:`,\n noProjects: () => `Cannot retrieve projects list`,\n tip: () =>\n `Introduce yourself with \"login {username}\" or \"login {clientId} -s {secret}\" or by passing credentials as options with your command`,\n },\n login: {\n command: {\n name: () => 'login',\n usage: () => `<user/clientId> [password] [-s <sharedSecret>]`,\n example: () =>\n `Example call:\\n > login myuserid\\n -- or --\\n > login {clientId} -s {sharedSecret}`,\n },\n args: {\n user: {\n name: () => '<user/clientId>',\n description: () => 'the username to login with',\n },\n password: {\n name: () => '[password]',\n description: () =>\n 'the password to use to login with (optional/insecure)',\n },\n secret: {\n name: () => '-s --sharedSecret <sharedSecret>',\n description: () =>\n 'the shared secret to use when logging in with a client id',\n },\n },\n passwordPrompt: (env?: string, userId?: string) =>\n userId\n ? `Enter password for ${userId}@${env}:`\n : `Please enter a password`,\n failed: (env: string, userId: string) =>\n `Unable to login to ${env} as ${userId}`,\n success: (env: string, userId: string) =>\n `User ${userId} connected to ${env} successfully\\n`,\n insecurePassword: () =>\n `Could not connect to local keystore - your password could be stored unencrypted!`,\n noEnv: () => `No environment set, use \"contensis connect {alias}\" first`,\n noUserId: () => `No user id specified`,\n },\n projects: {\n list: () => `Available projects:`,\n noList: () => `Cannot retrieve projects list`,\n set: (projectId: string) =>\n `Current project is set to ${Logger.highlightText(projectId)}`,\n failedSet: (projectId: string) =>\n `Project ${Logger.highlightText(projectId)} not found`,\n tip: () =>\n `You need to set your current working project with \"set project {projectId}\"`,\n created: (env: string, id: string) =>\n `[${env}] Created project ${Logger.highlightText(id)}`,\n failedCreate: (env: string, id: string) =>\n `[${env}] Unable to create project ${Logger.highlightText(id)}`,\n updated: (env: string, id: string) =>\n `[${env}] Updated project ${Logger.highlightText(id)}`,\n failedUpdate: (env: string, id: string) =>\n `[${env}] Unable to update project ${Logger.highlightText(id)}`,\n },\n migrate: {\n commitTip: () => `Add --commit flag to commit the previewed changes`,\n preview: (verb = 'IMPORT') => `\uD83D\uDD0D ${verb} PREVIEW \uD83D\uDD2D`,\n commit: (verb = 'IMPORT') => `COMMITTING ${verb} \u2728\u2604\uFE0F `,\n imported: (\n env: string,\n commit: boolean,\n entities: { [noun: string]: number }\n ) =>\n `${commit ? `Imported` : `Will import`} ${Object.entries(entities)\n .map(\n ([noun, count], i, arr) =>\n `${i > 0 ? (i === arr.length - 1 ? ' and ' : ', ') : ''}${pl(noun, count, true)}`\n )\n .join('')} into ${env} environment`,\n\n models: {\n result: (\n status: keyof MigrateModelsResult['project']['contentTypes']\n ) => {\n switch (status) {\n case 'created':\n case 'updated':\n return Logger.successText;\n case 'errors':\n return Logger.errorText;\n default:\n return Logger.infoText;\n }\n },\n },\n status: (status: MigrateStatus) => {\n switch (status) {\n case 'no change':\n return Logger.successText;\n case 'create':\n case 'two-pass':\n case 'update':\n case 'delete':\n return Logger.warningText;\n case 'error':\n case 'not found':\n return Logger.errorText;\n default:\n return Logger.infoText;\n }\n },\n },\n models: {\n list: (projectId: string) =>\n `Content models in ${Logger.highlightText(projectId)}:`,\n noList: (projectId: string) =>\n `[${projectId}] Cannot retrieve content models`,\n get: (projectId: string, id: string) =>\n `[${projectId}] Content models ${Logger.infoText(`[ ${id} ]`)}`,\n failedGet: (projectId: string, id: string) =>\n `[${projectId}] Unable to get content models ${Logger.highlightText(id)}`,\n },\n nodes: {\n imported: (env: string, commit: boolean, count: number) =>\n LogMessages.migrate.imported(env, commit, { node: count }),\n failedImport: (env: string) => `[${env}] Unable to import nodes`,\n removed: (env: string, commit: boolean, root: string) =>\n `[${env}] ${commit ? `Deleted` : `Will delete`} nodes at ${root}`,\n failedRemove: (env: string) => `[${env}] Unable to delete nodes`,\n notFound: (env: string) => `[${env}] Nodes were not found `,\n commitTip: () => `Add --commit flag to commit the previewed changes`,\n failedGet: (projectId: string) =>\n `[${projectId}] Cannot retrieve nodes from Site view`,\n get: (projectId: string, root: string, depth: number) =>\n `[${projectId}] Site view nodes at: ${Logger.highlightText(root)}${\n depth ? ` to a depth of ${depth}` : ``\n }\\n`,\n noChange: (env: string) => `[${env}] No changes to be made`,\n },\n contenttypes: {\n list: (projectId: string) =>\n `Content types in ${Logger.highlightText(projectId)}:`,\n get: (projectId: string, id: string) =>\n `[${projectId}] Content type ${Logger.highlightText(id)}`,\n failedGet: (projectId: string, id: string) =>\n `[${projectId}] Unable to get content type ${Logger.highlightText(id)}`,\n created: (projectId: string, id: string, status?: string) =>\n `[${projectId}] Content type ${status}d ${Logger.highlightText(id)}`,\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${\n commit ? `Deleted` : `Will delete`\n } content type(s) ${Logger.highlightText(id)}`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete content type(s) ${Logger.highlightText(id)}`,\n },\n components: {\n list: (projectId: string) =>\n `Components in ${Logger.highlightText(projectId)}:`,\n get: (projectId: string, id: string) =>\n `[${projectId}] Component ${Logger.highlightText(id)}`,\n failedGet: (projectId: string, id: string) =>\n `[${projectId}] Unable to get component ${Logger.highlightText(id)}`,\n created: (projectId: string, id: string, status?: string) =>\n `[${projectId}] Component ${status}d ${Logger.highlightText(id)}`,\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${\n commit ? `Deleted` : `Will delete`\n } component(s) ${Logger.highlightText(id)}`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete component(s) ${Logger.highlightText(id)}`,\n },\n version: {\n set: (env: string, versionStatus: string) =>\n `[${env}] Content version status set to \"${versionStatus}\"`,\n invalid: (versionStatus: string) =>\n `Content version status \"${versionStatus}\" is not valid, allowed values are \"published\" or \"latest\".`,\n noEnv: () =>\n `No Contensis environment set, connect to your Contensis cloud instance using \"contensis connect {cms alias}\"`,\n },\n entries: {\n imported: (\n env: string,\n commit: boolean,\n entries: number,\n nodes = 0,\n tags = 0\n ) =>\n LogMessages.migrate.imported(env, commit, {\n entry: entries,\n node: nodes,\n tag: tags,\n }),\n failedImport: (env: string) => `[${env}] Unable to import entries`,\n update: {\n preview: () => LogMessages.migrate.preview('UPDATE FIELD'),\n commit: () => LogMessages.migrate.commit('FIELD UPDATES'),\n success: (env: string, commit: boolean, entries: number, nodes = 0) =>\n `${commit ? `Updated` : `Will update`} ${pl('entry', entries, true)}${\n nodes > 0 ? ` and ${pl('node', nodes, true)}` : ''\n } in ${env} environment`,\n failed: (env: string) => `[${env}] Unable to update any entries`,\n },\n removed: (env: string, commit: boolean) =>\n `[${env}] ${commit ? `Deleted` : `Will delete`} entries`,\n failedRemove: (env: string) => `[${env}] Unable to delete entries`,\n notFound: (env: string) => `[${env}] Entries were not found`,\n noChange: (env: string) => `[${env}] No changes to be made`,\n },\n keys: {\n list: (env: string) => `[${env}] API keys:`,\n noList: (env: string) => `[${env}] Cannot retrieve API keys`,\n created: (env: string, name: string) =>\n `[${env}] Created API key ${Logger.highlightText(name)}`,\n tip: () =>\n `Assign your new key to a role with \"set role assignments\", or create a new role with \"create role\"`,\n failedCreate: (env: string, name: string) =>\n `[${env}] Unable to create API key ${Logger.highlightText(name)}`,\n failedUpdate: (env: string, name: string) =>\n `[${env}] Unable to update API key ${Logger.highlightText(name)}`,\n removed: (env: string, id: string) =>\n `[${env}] Deleted API key ${Logger.highlightText(id)}`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete API key ${Logger.highlightText(id)}`,\n },\n proxies: {\n list: (env: string, projectId: string | undefined) =>\n `[${env}] Retrieved proxies in project ${projectId}:`,\n noList: (env: string, projectId: string | undefined) =>\n `[${env}] Cannot retrieve proxies in project ${projectId}`,\n // noneExist: () => `Create a role with \"create renderer\"`,\n failedGet: (env: string, name: string, projectId: string) =>\n `[${env}] Unable to find proxy ${Logger.highlightText(\n name\n )} in project ${projectId}`,\n created: (env: string, name: string, projectId: string) =>\n `[${env}] Created proxy ${Logger.highlightText(\n name\n )} in project ${projectId}\\n`,\n failedCreate: (env: string, name: string, projectId: string) =>\n `[${env}] Unable to create proxy ${Logger.highlightText(\n name\n )} in project ${projectId}`,\n setPayload: () => `Updating proxy with details\\n`,\n set: () => `Succesfully updated proxy\\n`,\n failedSet: (env: string, name: string, projectId: string) =>\n `[${env}] Unable to update proxy ${Logger.highlightText(\n name\n )} in project ${projectId}`,\n removed: (env: string, id: string, projectId: string) =>\n `[${env}] Deleted proxy ${Logger.highlightText(\n id\n )} in project ${projectId}\\n`,\n failedRemove: (env: string, id: string, projectId: string) =>\n `[${env}] Unable to delete proxy ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n },\n renderers: {\n list: (env: string, projectId: string | undefined) =>\n `[${env}] Retrieved renderers in project ${projectId}:`,\n noList: (env: string, projectId: string | undefined) =>\n `[${env}] Cannot retrieve renderers in project ${projectId}`,\n // noneExist: () => `Create a role with \"create renderer\"`,\n failedGet: (env: string, name: string, projectId: string) =>\n `[${env}] Unable to find renderer ${Logger.highlightText(\n name\n )} in project ${projectId}`,\n created: (env: string, name: string, projectId: string) =>\n `[${env}] Created renderer ${Logger.highlightText(\n name\n )} in project ${projectId}\\n`,\n failedCreate: (env: string, name: string, projectId: string) =>\n `[${env}] Unable to create renderer ${Logger.highlightText(\n name\n )} in project ${projectId}`,\n setPayload: () => `Updating renderer with details\\n`,\n set: () => `Succesfully updated renderer\\n`,\n failedSet: (env: string, name: string, projectId: string) =>\n `[${env}] Unable to update renderer ${Logger.highlightText(\n name\n )} in project ${projectId}`,\n removed: (env: string, id: string, projectId: string) =>\n `[${env}] Deleted renderer ${Logger.highlightText(\n id\n )} in project ${projectId}\\n`,\n failedRemove: (env: string, id: string, projectId: string) =>\n `[${env}] Unable to delete renderer ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n },\n roles: {\n list: (env: string) => `[${env}] Retrieved roles`,\n noList: (env: string) => `[${env}] Cannot retrieve roles`,\n noneExist: () => `Create a role with \"create role\"`,\n failedGet: (env: string, name: string) =>\n `[${env}] Unable to find role ${Logger.highlightText(name)}`,\n created: (env: string, name: string) =>\n `[${env}] Created role ${Logger.highlightText(name)}\\n`,\n tip: () =>\n `Give access to your role with \"set role assignments\", allow your role to do things with \"set role permissions\"`,\n failedCreate: (env: string, name?: string) =>\n `[${env}] Unable to create role ${Logger.highlightText(name)}`,\n setPayload: () => `Updating role with details\\n`,\n set: () => `Succesfully updated role\\n`,\n failedSet: (env: string, name?: string) =>\n `[${env}] Unable to update role ${Logger.highlightText(name)}`,\n removed: (env: string, id: string) =>\n `[${env}] Deleted role ${Logger.highlightText(id)}\\n`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete role ${Logger.highlightText(id)}`,\n },\n taggroups: {\n list: (env: string, length: number) =>\n `[${env}] Retrieved ${pl('tag group', length, true)}`,\n noList: (env: string) => `[${env}] Cannot retrieve tag groups`,\n noneExist: () => `Create a tag group with \"create taggroup <name>\"`,\n imported: (env: string, commit: boolean, groups: number, tags: number) =>\n LogMessages.migrate.imported(env, commit, {\n 'tag group': groups,\n tag: tags,\n }),\n failedGet: (env: string, name: string) =>\n `[${env}] Unable to find a tag group ${Logger.highlightText(name)}`,\n created: (env: string, name: string) =>\n `[${env}] Created tag group ${Logger.highlightText(name)}\\n`,\n tip: () =>\n `Give access to your role with \"set role assignments\", allow your role to do things with \"set role permissions\"`,\n failedCreate: (env: string, name?: string) =>\n `[${env}] Unable to create ${name ? `tag group ${Logger.highlightText(name)}` : 'tag groups'}`,\n removed: (env: string, id: string, commit: boolean) =>\n `[${env}] ${\n commit ? `Deleted` : `Will delete`\n } tag group ${Logger.highlightText(id)}\\n`,\n failedRemove: (env: string, id: string) =>\n `[${env}] Unable to delete tag group ${Logger.highlightText(id)}`,\n },\n tags: {\n list: (env: string, length: number) =>\n `[${env}] Retrieved ${pl('tag', length, true)}`,\n noList: (env: string) => `[${env}] Cannot retrieve tags`,\n noneExist: () =>\n `Create a tag with \"create tag in <groupId> <tag label(s)...>\"`,\n imported: (env: string, commit: boolean, tags: number) =>\n LogMessages.migrate.imported(env, commit, { tag: tags }),\n failedGet: (env: string) => `[${env}] Unable to find tags`,\n created: (env: string, name: string) =>\n `[${env}] Created tag ${Logger.highlightText(name)}\\n`,\n failedCreate: (env: string, name?: string) =>\n `[${env}] Unable to create ${name ? `tag ${Logger.highlightText(name)}` : 'tags'}`,\n removed: (env: string, length: number, commit: boolean) =>\n `[${env}] ${\n !length\n ? 'No tags to delete'\n : `${commit ? `Deleted` : `Will delete`} ${pl('tag', length, true)}\\n`\n }`,\n failedRemove: (env: string, length: number) =>\n `[${env}] Unable to delete tags with ${pl('error', length)}`,\n noChange: (env: string) => `[${env}] No changes to be made`,\n },\n blocks: {\n runningStatus: (status: BlockRunningStatus | 'broken') => {\n switch (status) {\n case 'available':\n return Logger.successText(status);\n case 'pending':\n case 'starting':\n case 'stopped':\n return Logger.warningText(status);\n case 'degraded':\n case 'faulted':\n case 'broken':\n return Logger.errorText(status);\n default:\n return Logger.infoText(status);\n }\n },\n get: (\n id: string,\n branch: string,\n version: string,\n env: string,\n projectId?: string\n ) =>\n `[${env}] ${\n version && version !== 'latest'\n ? `Found v${version}`\n : 'Latest block versions'\n } for ${Logger.infoText(`${branch}/`)}${Logger.highlightText(\n id\n )} in project ${projectId}\\n`,\n noGet: (\n id: string,\n branch: string,\n version: string,\n env: string,\n projectId?: string\n ) =>\n `[${env}] Did not find ${\n version ? `v${version}` : 'any block versions'\n } for ${Logger.highlightText(id)} in branch ${Logger.infoText(\n branch\n )} in ${Logger.infoText(projectId)} project`,\n noGetTip: () =>\n `Check the available blocks and branches in this project by running \"list blocks\"`,\n list: (env: string, projectId?: string) =>\n `[${env}] Blocks in project ${projectId}\\n`,\n noList: (env: string, projectId?: string) =>\n `[${env}] Cannot retrieve blocks in project ${projectId}`,\n getLogs: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Requesting logs from block ${Logger.highlightText(\n id\n )} in branch ${branch} in project ${projectId}`,\n failedGetLogs: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to fetch block logs for ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n tryPush: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Request to push block ${Logger.highlightText(\n id\n )} in branch ${branch} in project ${projectId}`,\n pushed: (id: string, branch: string, env: string, projectId?: string) =>\n `[${env}] Pushed block ${Logger.highlightText(\n id\n )} in branch ${branch} in project ${projectId}`,\n failedPush: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to push block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n failedParsingVersion: () =>\n `Did not find a \"version.versionNo\" in response`,\n actionComplete: (\n action: BlockActionType,\n id: string,\n env: string,\n projectId?: string\n ) =>\n `[${env}] Action ${Logger.highlightText(\n action\n )} on ${Logger.highlightText(\n id\n )} in project ${projectId} requested successfully`,\n actionFailed: (\n action: BlockActionType,\n id: string,\n env: string,\n projectId?: string\n ) =>\n `[${env}] Problem executing ${action} on block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n deleted: (id: string, env: string, projectId?: string) =>\n `[${env}] Deleted block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n failedDelete: (id: string, env: string, projectId?: string) =>\n `[${env}] Unable to delete block ${Logger.highlightText(\n id\n )} in project ${projectId}`,\n stopFollow: (id: string, env: string, projectId?: string) =>\n `[${env}]\\n\\n \uD83D\uDC4C stop fetching new ${Logger.highlightText(\n id\n )} logs in project ${projectId}`,\n timeoutFollow: (id: string, env: string, projectId?: string) =>\n `[${env}]\\n\\n \uD83E\uDD0F pausing fetching new ${Logger.highlightText(\n id\n )} logs in project ${projectId} due to too many requests`,\n },\n webhooks: {\n list: (env: string) => `[${env}] Webhook subscriptions:`,\n noList: (env: string) => `[${env}] Cannot retrieve webhook subscriptions`,\n noneExist: () => `No webhook subscriptions exist`,\n imported: (env: string, commit: boolean, webhooks: number) =>\n LogMessages.migrate.imported(env, commit, { webhook: webhooks }),\n noChange: (env: string) => `[${env}] No changes to be made`,\n created: (env: string, name: string) =>\n `[${env}] Created Webhook subscription ${Logger.highlightText(name)}`,\n failedCreate: (env: string, name?: string) =>\n `[${env}] Unable to create ${name ? `webhook ${Logger.highlightText(name)}` : 'webhooks'}`,\n // failedCreate: (env: string, name: string) =>\n // `[${env}] Unable to create Webhook subscription ${Logger.highlightText(\n // name\n // )}`,\n deleted: (env: string, id: string) =>\n `[${env}] Deleted Webhook subscription ${Logger.highlightText(id)}`,\n failedDelete: (env: string, id: string) =>\n `[${env}] Unable to delete Webhook subscription ${Logger.highlightText(\n id\n )}`,\n },\n workflows: {\n list: (env: string) => `[${env}] Retrieved workflows`,\n noList: (env: string) => `[${env}] Cannot retrieve workflows`,\n noneExist: () => `No workflows found`,\n failedGet: (env: string, name: string) =>\n `[${env}] Unable to find workflow ${Logger.highlightText(name)}`,\n },\n devinit: {\n intro: () => `Contensis developer environment initialisation`,\n //`This will initialise your local working directory to develop with the current connected Contensis project`,\n projectDetails: (\n name: string,\n env: string,\n projectId: string,\n blockId: string,\n git: GitHelper\n ) =>\n `\n Project: ${Logger.standardText(name)}\n - Home: ${Logger.standardText(git.gitcwd())}\n - Repository: ${Logger.standardText(git.home)} \n - Block id: ${Logger.highlightText(blockId)}\n \n Connect to Contensis instance: ${Logger.standardText(env)}\n - Project id: ${Logger.standardText(projectId)}\n `,\n developmentKey: (name: string, existing: boolean) =>\n ` - ${\n !existing ? 'Create development API key' : 'Development API key found'\n }: ${Logger[!existing ? 'highlightText' : 'standardText'](name)}`,\n deploymentKey: (name: string, existing: boolean) =>\n ` - ${\n !existing ? 'Create deployment API key' : 'Deployment API key found'\n }: ${Logger[!existing ? 'highlightText' : 'standardText'](name)}`,\n ciIntro: (git: GitHelper, location: 'git' | 'env') =>\n `We will create API keys with permissions to use this project with Contensis, and add a job to your CI that will deploy a container build.\n ${\n location === 'git'\n ? `We will ask you to add secrets/variables to your git repository to give your workflow permission to push a Block to Contensis.\n ${Logger.infoText(`You could visit ${git.secretsUri} to check that you can see repository settings, \n a page not found generally indicates you need to ask the repo owner for permission to add repository secrets, \n or ask the repo owner to add these secrets for you.`)}`\n : ''\n }`,\n ciDetails: (filename: string) =>\n `Add push-block job to CI file: ${Logger.highlightText(filename)}\\n`,\n ciMultipleChoices: () =>\n `Multiple GitHub workflow files found\\n${Logger.infoText(\n `Tell us which GitHub workflow builds a container image after each push:`\n )}`,\n ciMultipleBuildJobChoices: () =>\n `Multiple build jobs found in workflow\\n${Logger.infoText(\n `Choose the build job that produces a fresh container image to push to a block:`\n )}`,\n ciMultipleJobChoices: () =>\n `Other jobs found in workflow\\n${Logger.infoText(\n `Choose the job that produces a fresh container image we can push to a block:`\n )}`,\n ciMultipleAppImageVarChoices: () =>\n `Do one of these variables point to your tagged app image?\\n${Logger.infoText(\n `we have included a default choice - ensure your build image is tagged exactly the same as this`\n )}`,\n ciEnterOwnAppImagePrompt: (git: GitHelper) =>\n `Tell us the registry uri your app image is tagged and pushed with (\u23CE accept default) \\n${Logger.infoText(\n `Tip: ${\n git.type === 'github'\n ? `GitHub context variables available\\nhttps://docs.github.com/en/actions/learn-github-actions/variables#using-contexts-to-access-variable-values`\n : `GitLab CI/CD variables available\\nhttps://docs.gitlab.com/ee/ci/variables/`\n }`\n )}\\n`,\n confirm: () =>\n `Confirm these details are correct so we can make changes to your project`,\n createDevKey: (keyName: string, existing: boolean) =>\n `${\n !existing ? 'Created' : 'Checked permissions for'\n } development API key ${Logger.standardText(keyName)}`,\n createDeployKey: (keyName: string, existing: boolean) =>\n `${\n !existing ? 'Created' : 'Checked permissions for'\n } deployment API key ${Logger.standardText(keyName)}`,\n createKeyFail: (keyName: string, existing: boolean) =>\n `Failed to ${\n !existing ? 'create' : 'update'\n } API key ${Logger.highlightText(keyName)}`,\n writeEnvFile: () => `Written .env file to project home directory`,\n useEnvFileTip: () =>\n `You should alter existing project code that connects a Contensis client to use the variables from this file`,\n writeCiFile: (ciFilePath: string) =>\n `Updated CI file ${Logger.standardText(winSlash(ciFilePath))}`,\n ciFileNoChanges: (ciFilePath: string) =>\n `No updates needed for CI file ${Logger.standardText(\n winSlash(ciFilePath)\n )}`,\n ciBlockTip: (blockId: string, env: string, projectId: string) =>\n `A job is included to deploy your built container image to ${Logger.standardText(\n projectId\n )} at ${Logger.standardText(env)} in a block called ${Logger.standardText(\n blockId\n )}`,\n addGitSecretsIntro: () =>\n `We have created an API key that allows you to deploy your app image to a Contensis Block but we need you to add these details to your GitLab repository.`,\n addGitSecretsHelp: (git: GitHelper, id?: string, secret?: string) =>\n `Add secrets or variables in your repository's settings page\\n\\nGo to ${Logger.highlightText(\n git.secretsUri\n )}\\n\\n${\n git.type === 'github'\n ? `Add a \"New repository secret\"`\n : `Expand \"Variables\" and hit \"Add variable\"`\n }\\n\\n ${\n git.type === 'github' ? `Secret name:` : `Key:`\n } ${Logger.highlightText(`CONTENSIS_CLIENT_ID`)}\\n ${\n git.type === 'github' ? `Secret:` : `Value:`\n } ${Logger.standardText(\n id\n )}\\n\\n ${`Add one more secret/variable to the repository`}\\n\\n ${\n git.type === 'github' ? `Secret name:` : `Key:`\n } ${Logger.highlightText(`CONTENSIS_SHARED_SECRET`)}\\n ${\n git.type === 'github' ? `Secret:` : `Value:`\n } ${Logger.standardText(secret)}`,\n accessTokenFetch: () =>\n `Please wait, fetching Delivery API access token \u23F3`,\n accessTokenSuccess: (token: string) =>\n `Successfully fetched Delivery API token\\n ${Logger.infoText(token)}`,\n accessTokenFailed: () =>\n `Something went wrong! If the problem persists, please contact our support team \uD83D\uDEDF`,\n accessTokenPermission: () =>\n `We need permission to fetch your Delivery API token, please try again \u26A0\uFE0F`,\n clientDetailsLocation: () =>\n `Which option would you like to use for storing your client ID and secret`,\n clientDetailsInGit: (git: GitHelper) =>\n `${\n git.type === 'github' ? 'GitHub' : 'GitLab'\n } variables (recommended for public repositories)`,\n clientDetailsInEnv: () =>\n `Env variables (recommended for private repositories)`,\n success: () => `Contensis developer environment initialisation complete`,\n partialSuccess: () =>\n `Contensis developer environment initialisation completed with errors`,\n failed: () => `Contensis developer environment initialisation failed`,\n dryRun: () =>\n `Contensis developer environment initialisation dry run completed`,\n dryRunKeyMessage: (dryRun: boolean) =>\n dryRun ? '<< not created: dry-run >>' : undefined,\n noChanges: () =>\n `No changes were made to your project, run the command again without the ${Logger.highlightText(\n '--dry-run'\n )} flag to update your project with these changes`,\n startProjectTip: () =>\n `Start up your project in the normal way for development`,\n blockIdQuestion: () =>\n `Please enter your block id, this should be unquie and in kebab case e.g ${Logger.highlightText(\n 'my-awesome-website'\n )}`,\n },\n devrequests: {\n install: {\n notFound: (repo: string) =>\n `Could not find a release in ${repo} repo - please check github`,\n download: (repo: string, version: string) => `Found release ${version}`,\n downloading: (repo: string, version: string) =>\n `Downloading ${repo} ${version}`,\n downloadFail: (repo: string, version: string) =>\n `Problem downloading release ${version} from ${repo}`,\n downloaded: (repo: string, version: string) =>\n `Downloaded ${repo} ${version}`,\n applyUpdate: (version: string, existing: string) =>\n `Use updated version ${version} ${Logger.infoText(\n `(replaces ${existing})`\n )}?`,\n },\n launch: () => `Launching request handler for local development`,\n overrideBlock: () => `Which block will you be running?`,\n overrideUri: () => `How to access your development site`,\n overrideBlocks: () => `Which blocks will you be overriding?`,\n overrideBranch: (blockId: string) =>\n `Which branch would you like ${blockId} to target?`,\n spawn: () =>\n `If you see a firewall popup requesting network access, it is safe to approve`,\n exited: (code: number | null) =>\n `Request handler exited with code ${code}\\n`,\n errored: (error: Error) =>\n `Could not launch request handler due to error \\n${error}`,\n missingBinary: (version: string) =>\n `Could not locate request handler module ${version}, attempting to reinstall`,\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,uBAAe;AAEf,oBAAuB;AACvB,gBAAyB;AAElB,MAAM,cAAc;AAAA,EACzB,KAAK;AAAA,IACH,WAAW,MAAM;AAAA,IACjB,MAAM,MAAM;AAAA;AAAA,IACZ,SAAS,CAAC,YACR,IAAI,OAAO,eAAW,oBAAI,KAAK,GAAE,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAChD,MAAM,MACJ;AAAA,IACF,aAAa,MACX;AAAA,EAAK,qBAAO,UAAU,IAAI,CAAC;AAAA;AAAA,IAC7B,cAAc,MAAM;AAAA,EAAK,qBAAO,UAAU,IAAI,CAAC;AAAA,IAC/C,cAAc,MAAM;AAAA,IACpB,YAAY,CAAC,SAAS,QAAQ,SAC5B,UAAU,MAAM,UAAU,qBAAO,SAAS,IAAI,CAAC;AAAA;AAAA,IACjD,cAAc,MAAM;AAAA;AAAA,EACtB;AAAA,EACA,SAAS;AAAA,IACP,UAAU,CAAC,YAAoB,GAAG,OAAO;AAAA,EAC3C;AAAA,EACA,MAAM;AAAA,IACJ,OAAO,CAAC,QACN,2CAAuC,iBAAAA,SAAG,eAAe,KAAK,IAAI,CAAC;AAAA,IACrE,UAAU,CAAC,UACT,eAAe,qBAAO,cAAc,KAAK,CAAC;AAAA,IAC5C,SAAS,CAAC,UACR,uBAAuB,qBAAO,cAAc,KAAK,CAAC;AAAA,IACpD,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AAA,IACnB,gBAAgB,MAAM;AAAA,IACtB,gBAAgB,CAAC,YACf,+BAA+B,OAAO;AAAA,IACxC,OAAO,MACL;AAAA,IACF,QAAQ,CAAC,SACP,oCAAoC,IAAI;AAAA;AAAA,IAC1C,SAAS,CAAC,UACR;AAAA,EAAmD,KAAK;AAAA,IAC1D,eAAe,CAAC,YACd,2CAA2C,OAAO;AAAA,EACtD;AACF;",
|
|
6
6
|
"names": ["pl"]
|
|
7
7
|
}
|
|
@@ -33,12 +33,14 @@ __export(DevRequests_to_RequestHanderCliArgs_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(DevRequests_to_RequestHanderCliArgs_exports);
|
|
34
34
|
var import_p_queue = __toESM(require("p-queue"));
|
|
35
35
|
class RequestHandlerArgs {
|
|
36
|
-
cli
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
constructor(blocks, blockBranches, cli) {
|
|
37
|
+
this.blocks = blocks;
|
|
38
|
+
this.blockBranches = blockBranches;
|
|
39
|
+
this.cli = cli;
|
|
40
40
|
this.cli = cli;
|
|
41
41
|
}
|
|
42
|
+
args;
|
|
43
|
+
siteConfig;
|
|
42
44
|
Create = async () => {
|
|
43
45
|
this.siteConfig = await this.buildSiteConfig();
|
|
44
46
|
await this.cli.Login(this.cli.env.lastUserId, { silent: true });
|
|
@@ -47,7 +49,6 @@ class RequestHandlerArgs {
|
|
|
47
49
|
buildSiteConfig = async () => {
|
|
48
50
|
var _a;
|
|
49
51
|
const { currentEnv, currentProject, env, log, messages, urls } = this.cli;
|
|
50
|
-
const contensis = await this.cli.ConnectContensis();
|
|
51
52
|
const siteConfig = {
|
|
52
53
|
alias: currentEnv,
|
|
53
54
|
projectId: currentProject,
|
|
@@ -59,24 +60,30 @@ class RequestHandlerArgs {
|
|
|
59
60
|
blocks: [],
|
|
60
61
|
renderers: []
|
|
61
62
|
};
|
|
62
|
-
const
|
|
63
|
-
const [err, blocksRaw] = await contensis2.blocks.GetBlocks();
|
|
64
|
-
if (err)
|
|
65
|
-
log.error(messages.blocks.noList(currentEnv, env.currentProject));
|
|
63
|
+
const getBlockVersions = async (contensis) => {
|
|
66
64
|
const blocks = [];
|
|
67
65
|
const queue = new import_p_queue.default({ concurrency: 4 });
|
|
68
|
-
for (const block of
|
|
66
|
+
for (const block of this.blocks || []) {
|
|
69
67
|
queue.add(async () => {
|
|
70
|
-
|
|
68
|
+
var _a2;
|
|
69
|
+
const branch = (
|
|
70
|
+
// If we've set an override branch
|
|
71
|
+
this.blockBranches.get(block.id) || // If the block has no master/main branch, use the first branch
|
|
72
|
+
!block.branches.find((br) => ["master", "main"].includes(br.id)) ? (_a2 = block.branches[0]) == null ? void 0 : _a2.id : (
|
|
73
|
+
// Else use default for Contensis to fetch master or main
|
|
74
|
+
"default"
|
|
75
|
+
)
|
|
76
|
+
);
|
|
77
|
+
const [err, versions] = await contensis.blocks.GetBlockVersions(
|
|
71
78
|
block.id,
|
|
72
|
-
|
|
79
|
+
branch,
|
|
73
80
|
"latest"
|
|
74
81
|
);
|
|
75
|
-
if (
|
|
82
|
+
if (err || (versions == null ? void 0 : versions.length) === 0)
|
|
76
83
|
log.warning(
|
|
77
84
|
messages.blocks.noGet(
|
|
78
85
|
block.id,
|
|
79
|
-
|
|
86
|
+
branch,
|
|
80
87
|
"latest",
|
|
81
88
|
currentEnv,
|
|
82
89
|
env.currentProject
|
|
@@ -98,10 +105,10 @@ class RequestHandlerArgs {
|
|
|
98
105
|
await queue.onIdle();
|
|
99
106
|
return blocks;
|
|
100
107
|
};
|
|
101
|
-
if (contensis) {
|
|
108
|
+
if (this.cli.contensis) {
|
|
102
109
|
const [blocks, renderers] = await Promise.all([
|
|
103
|
-
|
|
104
|
-
contensis.renderers.GetRenderers()
|
|
110
|
+
getBlockVersions(this.cli.contensis),
|
|
111
|
+
this.cli.contensis.renderers.GetRenderers()
|
|
105
112
|
]);
|
|
106
113
|
siteConfig.blocks = blocks;
|
|
107
114
|
siteConfig.renderers = (_a = renderers == null ? void 0 : renderers[1]) == null ? void 0 : _a.filter((r) => blocks.find((b) => b.id === r.id)).map((r) => ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/mappers/DevRequests-to-RequestHanderCliArgs.ts"],
|
|
4
|
-
"sourcesContent": ["import { ContensisMigrationService } from 'migratortron';\nimport PQueue from 'p-queue';\nimport ContensisCli from '~/services/ContensisCliService';\n\ntype EndpointJson = {\n id: string;\n path: string;\n};\n\ntype BlockJson = {\n id: string;\n baseUri: string;\n staticPaths: string[];\n endpoints: EndpointJson[];\n versionNo: number;\n branch: string;\n};\n\ntype RendererJson = {\n id: string;\n name: string;\n rules: RendererRuleJson[];\n assignedContentTypes: string[];\n};\n\ntype RendererRuleJson = {\n return?: {\n blockId?: string;\n endpointId?: string | null;\n version?: string;\n };\n};\ninterface ISiteConfigYaml {\n alias: string;\n projectId: string;\n iisHostname: string;\n podClusterId: string;\n accessToken: string; // needed?\n clientId: string;\n sharedSecret: string;\n blocks: BlockJson[];\n renderers: RendererJson[];\n}\n\nclass RequestHandlerArgs {\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,qBAAmB;AA2CnB,MAAM,mBAAmB;AAAA,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { Block, ContensisMigrationService } from 'migratortron';\nimport PQueue from 'p-queue';\nimport ContensisCli from '~/services/ContensisCliService';\n\ntype EndpointJson = {\n id: string;\n path: string;\n};\n\ntype BlockJson = {\n id: string;\n baseUri: string;\n staticPaths: string[];\n endpoints: EndpointJson[];\n versionNo: number;\n branch: string;\n};\n\ntype RendererJson = {\n id: string;\n name: string;\n rules: RendererRuleJson[];\n assignedContentTypes: string[];\n};\n\ntype RendererRuleJson = {\n return?: {\n blockId?: string;\n endpointId?: string | null;\n version?: string;\n };\n};\ninterface ISiteConfigYaml {\n alias: string;\n projectId: string;\n iisHostname: string;\n podClusterId: string;\n accessToken: string; // needed?\n clientId: string;\n sharedSecret: string;\n blocks: BlockJson[];\n renderers: RendererJson[];\n}\n\nclass RequestHandlerArgs {\n args?: string[];\n siteConfig?: ISiteConfigYaml;\n\n constructor(\n public blocks: Block[],\n public blockBranches: Map<string, string>,\n private cli: ContensisCli\n ) {\n this.cli = cli;\n }\n\n Create = async () => {\n this.siteConfig = await this.buildSiteConfig();\n await this.cli.Login(this.cli.env.lastUserId, { silent: true }); // to hydrate the auth service\n this.args = this.getArgs();\n };\n\n buildSiteConfig = async () => {\n const { currentEnv, currentProject, env, log, messages, urls } = this.cli;\n\n const siteConfig: ISiteConfigYaml = {\n alias: currentEnv,\n projectId: currentProject,\n iisHostname: urls?.iisPreviewWeb.split('//')[1] || '',\n podClusterId: 'hq',\n accessToken: '',\n clientId: '',\n sharedSecret: '',\n blocks: [],\n renderers: [],\n };\n\n const getBlockVersions = async (contensis: ContensisMigrationService) => {\n const blocks: BlockJson[] = [];\n const queue = new PQueue({ concurrency: 4 });\n for (const block of this.blocks || []) {\n queue.add(async () => {\n // Retrieve block version\n const branch =\n // If we've set an override branch\n this.blockBranches.get(block.id) ||\n // If the block has no master/main branch, use the first branch\n !block.branches.find(br => ['master', 'main'].includes(br.id))\n ? block.branches[0]?.id\n : // Else use default for Contensis to fetch master or main\n 'default';\n\n const [err, versions] = await contensis.blocks.GetBlockVersions(\n block.id,\n branch,\n 'latest'\n );\n if (err || versions?.length === 0)\n log.warning(\n messages.blocks.noGet(\n block.id,\n branch,\n 'latest',\n currentEnv,\n env.currentProject\n )\n );\n if (versions?.[0]) {\n const v = versions[0];\n blocks.push({\n id: v.id,\n baseUri: v.previewUrl,\n staticPaths: v.staticPaths,\n endpoints: v.endpoints,\n versionNo: v.version.versionNo,\n branch: v.source.branch,\n });\n }\n });\n }\n\n await queue.onIdle();\n return blocks;\n };\n\n if (this.cli.contensis) {\n const [blocks, renderers] = await Promise.all([\n getBlockVersions(this.cli.contensis),\n this.cli.contensis.renderers.GetRenderers(),\n ]);\n\n siteConfig.blocks = blocks;\n siteConfig.renderers = renderers?.[1]\n ?.filter(r => blocks.find(b => b.id === r.id))\n .map(r => ({\n id: r.id,\n name: r.name,\n assignedContentTypes: r.assignedContentTypes,\n rules: r.rules,\n }));\n }\n return siteConfig;\n };\n\n getArgs = (overrideArgs: string[] = []) => {\n const args = overrideArgs\n ? typeof overrideArgs?.[0] === 'string' &&\n overrideArgs[0].includes(' ', 2)\n ? overrideArgs[0].split(' ')\n : overrideArgs\n : []; // args could be [ '-c .\\\\site_config.yaml' ] or [ '-c', '.\\\\site_config.yaml' ]\n\n const { cli, siteConfig } = this;\n if (siteConfig) {\n // Add required args\n if (!args.find(a => a === '--alias'))\n args.push('--alias', cli.currentEnv);\n if (!args.find(a => a === '--project-api-id'))\n args.push('--project-api-id', cli.currentProject);\n if (!args.find(a => a === '--iis-hostname'))\n args.push('--iis-hostname', siteConfig.iisHostname);\n if (!args.find(a => a === '--pod-cluster-id'))\n args.push('--pod-cluster-id', siteConfig.podClusterId);\n if (!args.find(a => a === '--blocks-json'))\n args.push('--blocks-json', JSON.stringify(siteConfig.blocks));\n if (!args.find(a => a === '--renderers-json'))\n args.push('--renderers-json', JSON.stringify(siteConfig.renderers));\n }\n\n const client = cli.auth?.clientDetails;\n if (client) {\n if (!args.find(a => a === '--client-id') && 'clientId' in client)\n args.push('--client-id', client.clientId);\n if (!args.find(a => a === '--client-secret') && 'clientSecret' in client)\n args.push('--client-secret', client.clientSecret);\n if (!args.find(a => a === '--username') && 'username' in client)\n args.push('--username', client.username);\n if (!args.find(a => a === '--password') && 'password' in client)\n args.push('--password', client.password);\n }\n\n return args;\n };\n\n overrideBlock = (blockId: string, overrideUri: string) => {\n if (blockId && blockId !== 'none') {\n const blockIndex = this.siteConfig?.blocks.findIndex(\n b => b.id.toLowerCase() === blockId.toLowerCase()\n );\n if (\n typeof blockIndex === 'number' &&\n !isNaN(blockIndex) &&\n this.siteConfig?.blocks[blockIndex]\n ) {\n this.siteConfig.blocks[blockIndex].baseUri = overrideUri;\n // this.siteConfig.blocks[blockIndex].staticPaths.push(\n // ...['/static/*', '/image-library/*']\n // );\n this.siteConfig.blocks[blockIndex].staticPaths.push('/*.js');\n }\n }\n };\n}\n\nexport default RequestHandlerArgs;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,qBAAmB;AA2CnB,MAAM,mBAAmB;AAAA,EAIvB,YACS,QACA,eACC,KACR;AAHO;AACA;AACC;AAER,SAAK,MAAM;AAAA,EACb;AAAA,EATA;AAAA,EACA;AAAA,EAUA,SAAS,YAAY;AACnB,SAAK,aAAa,MAAM,KAAK,gBAAgB;AAC7C,UAAM,KAAK,IAAI,MAAM,KAAK,IAAI,IAAI,YAAY,EAAE,QAAQ,KAAK,CAAC;AAC9D,SAAK,OAAO,KAAK,QAAQ;AAAA,EAC3B;AAAA,EAEA,kBAAkB,YAAY;AA9DhC;AA+DI,UAAM,EAAE,YAAY,gBAAgB,KAAK,KAAK,UAAU,KAAK,IAAI,KAAK;AAEtE,UAAM,aAA8B;AAAA,MAClC,OAAO;AAAA,MACP,WAAW;AAAA,MACX,cAAa,6BAAM,cAAc,MAAM,MAAM,OAAM;AAAA,MACnD,cAAc;AAAA,MACd,aAAa;AAAA,MACb,UAAU;AAAA,MACV,cAAc;AAAA,MACd,QAAQ,CAAC;AAAA,MACT,WAAW,CAAC;AAAA,IACd;AAEA,UAAM,mBAAmB,OAAO,cAAyC;AACvE,YAAM,SAAsB,CAAC;AAC7B,YAAM,QAAQ,IAAI,eAAAA,QAAO,EAAE,aAAa,EAAE,CAAC;AAC3C,iBAAW,SAAS,KAAK,UAAU,CAAC,GAAG;AACrC,cAAM,IAAI,YAAY;AAjF9B,cAAAC;AAmFU,gBAAM;AAAA;AAAA,YAEJ,KAAK,cAAc,IAAI,MAAM,EAAE;AAAA,YAE/B,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AAc;AACvD,aAAK,KAAK,cAAc,OAAO,QAAQ;AAAA,IAC3C;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,gBAAgB,CAAC,SAAiB,gBAAwB;AAxL5D;AAyLI,QAAI,WAAW,YAAY,QAAQ;AACjC,YAAM,cAAa,UAAK,eAAL,mBAAiB,OAAO;AAAA,QACzC,OAAK,EAAE,GAAG,YAAY,MAAM,QAAQ,YAAY;AAAA;AAElD,UACE,OAAO,eAAe,YACtB,CAAC,MAAM,UAAU,OACjB,UAAK,eAAL,mBAAiB,OAAO,cACxB;AACA,aAAK,WAAW,OAAO,UAAU,EAAE,UAAU;AAI7C,aAAK,WAAW,OAAO,UAAU,EAAE,YAAY,KAAK,OAAO;AAAA,MAC7D;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,8CAAQ;",
|
|
6
|
+
"names": ["PQueue", "_a"]
|
|
7
7
|
}
|
|
@@ -32,6 +32,7 @@ __export(ContensisDevService_exports, {
|
|
|
32
32
|
devCommand: () => devCommand
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(ContensisDevService_exports);
|
|
35
|
+
var import_prompts = require("@inquirer/prompts");
|
|
35
36
|
var import_ansi_escapes = __toESM(require("ansi-escapes"));
|
|
36
37
|
var import_await_to_js = __toESM(require("await-to-js"));
|
|
37
38
|
var import_inquirer = __toESM(require("inquirer"));
|
|
@@ -341,39 +342,86 @@ ${mappedWorkflow.diff}`
|
|
|
341
342
|
}
|
|
342
343
|
}
|
|
343
344
|
};
|
|
344
|
-
ExecRequestHandler = async (blockId, overrideArgs = [], version) => {
|
|
345
|
+
ExecRequestHandler = async (blockId, blockOverrides, overrideArgs = [], version) => {
|
|
345
346
|
var _a;
|
|
346
|
-
const { debug, log, messages } = this;
|
|
347
|
+
const { currentEnv, currentProject, debug, log, messages } = this;
|
|
347
348
|
const spinner = !debug ? (0, import_nanospinner.createSpinner)(messages.devrequests.launch()) : log.info(messages.devrequests.launch());
|
|
348
349
|
const requestHandler = await (0, import_RequestHandlerFactory.createRequestHandler)(version);
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
350
|
+
const contensis = await this.ConnectContensis();
|
|
351
|
+
if (contensis) {
|
|
352
|
+
const blockBranches = /* @__PURE__ */ new Map();
|
|
353
|
+
const [err, projectBlocks] = await contensis.blocks.GetBlocks();
|
|
354
|
+
if (err) log.error(messages.blocks.noList(currentEnv, currentProject));
|
|
355
|
+
else if (projectBlocks) {
|
|
356
|
+
const blockIdChoices = projectBlocks.map((block) => block.id) || [];
|
|
357
|
+
blockIdChoices.push("none");
|
|
358
|
+
const defaultDeveloperUri = "http://localhost:3000";
|
|
359
|
+
const { developmentBlockId, developmentBlockUri } = blockId.length ? {
|
|
360
|
+
developmentBlockId: blockId[0],
|
|
361
|
+
developmentBlockUri: (blockId == null ? void 0 : blockId[1]) || defaultDeveloperUri
|
|
362
|
+
} : await import_inquirer.default.prompt([
|
|
363
|
+
{
|
|
364
|
+
type: "list",
|
|
365
|
+
prefix: "\u{1F9F1}",
|
|
366
|
+
message: messages.devrequests.overrideBlock(),
|
|
367
|
+
name: "developmentBlockId",
|
|
368
|
+
choices: blockIdChoices
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
type: "input",
|
|
372
|
+
prefix: "\u{1F517}",
|
|
373
|
+
message: messages.devrequests.overrideUri(),
|
|
374
|
+
name: "developmentBlockUri",
|
|
375
|
+
default: defaultDeveloperUri
|
|
376
|
+
}
|
|
377
|
+
]);
|
|
378
|
+
if (blockOverrides) {
|
|
379
|
+
const blockIdChoices2 = (projectBlocks == null ? void 0 : projectBlocks.map((block) => ({
|
|
380
|
+
name: `${block.id}${block.description ? ` (${block.description})` : ""}`,
|
|
381
|
+
value: block.id
|
|
382
|
+
}))) || [];
|
|
383
|
+
blockIdChoices2.push({ name: "none", value: "none" });
|
|
384
|
+
const { overrideBlockIds } = Array.isArray(blockOverrides) ? {
|
|
385
|
+
overrideBlockIds: blockOverrides.map((bId) => {
|
|
386
|
+
var _a2;
|
|
387
|
+
return (_a2 = projectBlocks.find((b) => b.id === bId)) == null ? void 0 : _a2.id;
|
|
388
|
+
}).filter(Boolean)
|
|
389
|
+
} : await import_inquirer.default.prompt([
|
|
390
|
+
{
|
|
391
|
+
type: "checkbox",
|
|
392
|
+
prefix: "\u{1F9F1}",
|
|
393
|
+
message: messages.devrequests.overrideBlocks(),
|
|
394
|
+
name: "overrideBlockIds",
|
|
395
|
+
choices: blockIdChoices2
|
|
396
|
+
// default: blockIdChoices.findIndex(b => b.value === 'none'),
|
|
397
|
+
}
|
|
398
|
+
]);
|
|
399
|
+
for (const overrideBlockId of overrideBlockIds) {
|
|
400
|
+
if (overrideBlockId === "none") continue;
|
|
401
|
+
const choices = (_a = projectBlocks.find((b) => b.id === overrideBlockId)) == null ? void 0 : _a.branches.map((b) => b.id);
|
|
402
|
+
if (choices) {
|
|
403
|
+
const overrideBranch = await (0, import_prompts.search)({
|
|
404
|
+
message: `\u{1F33F} ${messages.devrequests.overrideBranch(overrideBlockId)}`,
|
|
405
|
+
source: (input) => {
|
|
406
|
+
input = input || "";
|
|
407
|
+
const fuzzyResult = input ? choices == null ? void 0 : choices.filter(
|
|
408
|
+
(choice) => choice.toLowerCase().includes(input.toLowerCase())
|
|
409
|
+
) : choices;
|
|
410
|
+
return fuzzyResult || [];
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
blockBranches.set(overrideBlockId, overrideBranch);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
const args = new import_DevRequests_to_RequestHanderCliArgs.default(projectBlocks, blockBranches, this);
|
|
418
|
+
spinner == null ? void 0 : spinner.start();
|
|
419
|
+
await args.Create();
|
|
420
|
+
args.overrideBlock(developmentBlockId, developmentBlockUri);
|
|
421
|
+
spinner == null ? void 0 : spinner.success();
|
|
422
|
+
await requestHandler(args.getArgs(overrideArgs));
|
|
373
423
|
}
|
|
374
|
-
|
|
375
|
-
args.overrideBlock(overrideBlockId, overrideUri);
|
|
376
|
-
await requestHandler(args.getArgs(overrideArgs));
|
|
424
|
+
}
|
|
377
425
|
};
|
|
378
426
|
}
|
|
379
427
|
const devCommand = (commandArgs, outputOpts, contensisOpts = {}) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/services/ContensisDevService.ts"],
|
|
4
|
-
"sourcesContent": ["import ansiEscapes from 'ansi-escapes';\nimport to from 'await-to-js';\nimport inquirer from 'inquirer';\nimport { createSpinner } from 'nanospinner';\n\nimport { Role } from 'contensis-management-api/lib/models';\nimport { MigrateRequest } from 'migratortron';\n\nimport ContensisRole from './ContensisRoleService';\nimport { createRequestHandler } from '~/factories/RequestHandlerFactory';\nimport { OutputOptionsConstructorArg } from '~/models/CliService';\nimport { EnvContentsToAdd } from '~/models/DevService';\nimport { mapCIWorkflowContent } from '~/mappers/DevInit-to-CIWorkflow';\nimport RequestHandlerArgs from '~/mappers/DevRequests-to-RequestHanderCliArgs';\nimport { deployKeyRole } from '~/mappers/DevInit-to-RolePermissions';\nimport { readFile, writeFile } from '~/providers/file-provider';\nimport { diffFileContent } from '~/util/diff';\nimport { mergeDotEnvFileContents } from '~/util/dotenv';\nimport { findByIdOrName } from '~/util/find';\nimport { GitHelper } from '~/util/git';\nimport { jsonFormatter } from '~/util/json.formatter';\nimport { winSlash } from '~/util/os';\nimport { mergeContentsToAddWithGitignore } from '~/util/gitignore';\n\nclass ContensisDev extends ContensisRole {\n git!: GitHelper;\n blockId!: string;\n\n deployCredentials = {\n clientId: '',\n clientSecret: '',\n };\n\n constructor(\n args: string[],\n outputOpts?: OutputOptionsConstructorArg,\n contensisOpts: Partial<MigrateRequest> = {}\n ) {\n super(args, outputOpts, contensisOpts);\n }\n\n DevelopmentInit = async (projectHome: string, opts: any) => {\n // Retrieve git info\n const git = (this.git = new GitHelper(projectHome));\n // Check if we are in a git repo\n const isRepo = git.checkIsRepo();\n if (!isRepo) return;\n\n const { dryRun = false } = opts || {};\n const { currentEnv, currentProject, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // First we need to get the block id from the user\n const validateBlockId = (blockId: string) => {\n const pattern = /^[0-9a-z](-?[0-9a-z])*$/;\n if (blockId.length >= 1 && blockId.length <= 225) {\n return pattern.test(blockId);\n } else return false;\n };\n const { blockId } = await inquirer.prompt({\n name: 'blockId',\n type: 'input',\n prefix: '\uD83E\uDDF1',\n message: messages.devinit.blockIdQuestion,\n validate: validateBlockId,\n default: git.name,\n });\n // make sure block id is lowercase\n this.blockId = blockId.toLowerCase();\n log.success(`Valid block id: ${blockId.toLowerCase()}`);\n\n // Retrieve keys list for env\n const [keysErr, apiKeys] = await contensis.apiKeys.GetKeys();\n if (keysErr) {\n log.error(messages.keys.noList(currentEnv));\n log.error(jsonFormatter(keysErr));\n return;\n }\n const apiKeyExists = (findKey: string) =>\n apiKeys?.find(\n k => k.name.trim().toLowerCase() === findKey?.trim().toLowerCase()\n );\n\n // Retrieve ci workflow info\n const workflowFiles = git.workflows;\n\n // Set variables for performing operations and logging etc.\n let ciFileName = git.ciFileName;\n\n const apiKeyName = `block-${currentProject}-${blockId}`.toLowerCase();\n\n const devKeyName = `${apiKeyName}`;\n const devKeyDescription = `Created by Contensis to allow API access from the running block`;\n let existingDevKey = apiKeyExists(devKeyName);\n\n const deployKeyName = `${apiKeyName}-ci`;\n const deployKeyDescription = `Created by the Contensis CLI for use in continuous integration`;\n\n let existingDeployKey = apiKeyExists(deployKeyName);\n\n // const blockId = git.name;\n const errors = [] as AppError[];\n\n // Start render console output\n log.raw('');\n log.success(messages.devinit.intro());\n log.raw(\n log.infoText(\n messages.devinit.projectDetails(\n git.name,\n currentEnv,\n currentProject,\n blockId,\n git\n )\n )\n );\n log.raw(\n log.infoText(\n messages.devinit.developmentKey(devKeyName, !!existingDevKey)\n )\n );\n log.raw(\n log.infoText(\n messages.devinit.deploymentKey(deployKeyName, !!existingDeployKey)\n )\n );\n log.raw('');\n\n if (Array.isArray(workflowFiles) && workflowFiles.length > 1) {\n // Choose GitHub workflow file (if multiple)\n ({ ciFileName } = await inquirer.prompt([\n {\n type: 'list',\n prefix: '\u29F0',\n message: messages.devinit.ciMultipleChoices(),\n name: 'ciFileName',\n choices: workflowFiles,\n default: workflowFiles.find(f => f.includes('docker')),\n },\n ]));\n log.raw('');\n git.ciFileName = ciFileName;\n }\n\n log.raw(log.infoText(messages.devinit.ciDetails(ciFileName)));\n\n // Location for Client ID / Secret.\n const { loc } = await inquirer.prompt({\n name: 'loc',\n type: 'list',\n prefix: '\uD83D\uDD11',\n // Where would you like to store your client id/secret?\n message: messages.devinit.clientDetailsLocation(),\n choices: [\n {\n name: messages.devinit.clientDetailsInGit(git),\n value: 'git',\n },\n {\n name: messages.devinit.clientDetailsInEnv(),\n value: 'env',\n },\n ],\n });\n\n log.raw('');\n log.help(messages.devinit.ciIntro(git, loc));\n\n if (!dryRun) {\n // Confirm prompt\n const { confirm } = await inquirer.prompt([\n {\n type: 'confirm',\n message: messages.devinit.confirm(),\n name: 'confirm',\n default: false,\n },\n ]);\n log.raw('');\n if (!confirm) return;\n }\n\n // Fetching access token\n let accessToken: string | undefined = undefined;\n\n const spinner = createSpinner(messages.devinit.accessTokenFetch());\n spinner.start();\n\n const token = await this.GetDeliveryApiKey();\n\n if (token) {\n accessToken = token;\n spinner.success({ text: messages.devinit.accessTokenSuccess(token) });\n log.raw('');\n } else {\n spinner.error();\n this.log.error(messages.devinit.accessTokenFailed());\n return;\n }\n\n // Magic happens...\n const checkpoint = (op: string) => {\n if (errors.length) throw errors[0];\n else log.debug(`${op} completed ok`);\n return true;\n };\n\n // Arrange API keys for development and deployment\n const [getRolesErr, roles] = await to(contensis.roles.GetRoles());\n if (!roles && getRolesErr) errors.push(getRolesErr);\n checkpoint(`fetched ${roles?.length} roles`);\n\n if (dryRun) {\n checkpoint(`skip api key creation (dry-run)`);\n } else {\n // if dev api key doesn't exist go and create it (we need this for local development, we will store these details in the .env file).\n const devKeyExisted = !!existingDevKey;\n if (!existingDevKey) {\n existingDevKey = await this.CreateOrUpdateApiKey(\n existingDevKey,\n devKeyName,\n devKeyDescription\n );\n log.success(messages.devinit.createDevKey(devKeyName, devKeyExisted));\n }\n // NF 24/11/23 Added this commented code back in as we are not assigning the dev key to any role here\n // // Ensure dev API key is assigned to a role\n // let existingDevRole = findByIdOrName(roles || [], devKeyName, true) as\n // | Role\n // | undefined;\n // existingDevRole = await this.CreateOrUpdateRole(\n // existingDevRole,\n // devKeyRole(devKeyName, devKeyDescription)\n // );\n // checkpoint('dev key role assigned');\n\n // if deploy api key doesn't exist go and create it (we need this for yml file).\n const deployKeyExisted = !!existingDeployKey;\n if (!existingDeployKey) {\n existingDeployKey = await this.CreateOrUpdateApiKey(\n existingDeployKey,\n deployKeyName,\n deployKeyDescription\n );\n }\n\n // check we have the deploy key so we can assign them to this values\n if (existingDeployKey) {\n // Add client id and secret to credentials\n this.deployCredentials.clientId = existingDeployKey?.id;\n this.deployCredentials.clientSecret = existingDeployKey?.sharedSecret;\n }\n\n // Ensure deploy API key is assigned to a role with the right permissions\n const deployRoleName = `Role for CI push of block '${blockId}'`;\n const deplyRoleDescription = `Created by the Contensis CLI for use in continuous integration`;\n let existingDeployRole = findByIdOrName(\n roles || [],\n deployRoleName,\n true\n ) as Role | undefined;\n existingDeployRole = await this.CreateOrUpdateRole(\n existingDeployRole,\n deployKeyRole(deployKeyName, deployRoleName, deplyRoleDescription)\n );\n\n checkpoint('deploy key role assigned');\n log.success(\n messages.devinit.createDeployKey(deployRoleName, deployKeyExisted)\n );\n checkpoint('api keys done');\n }\n\n const envFilePath = `${projectHome}/.env`;\n const existingEnvFile = readFile(envFilePath);\n const existingEnvFileArray = (existingEnvFile || '')\n .split('\\n')\n .filter(l => !!l);\n\n // Update or create a file called .env in project home\n const envContentsToAdd: EnvContentsToAdd = {\n ALIAS: currentEnv,\n PROJECT_API_ID: currentProject,\n BLOCK_ID: blockId,\n };\n if (accessToken) envContentsToAdd['ACCESS_TOKEN'] = accessToken;\n // add client id and secret to the env file\n if (loc === 'env') {\n envContentsToAdd['CONTENSIS_CLIENT_ID'] =\n existingDevKey?.id || messages.devinit.dryRunKeyMessage(dryRun);\n envContentsToAdd['CONTENSIS_CLIENT_SECRET'] =\n existingDevKey?.sharedSecret ||\n messages.devinit.dryRunKeyMessage(dryRun);\n }\n\n // if we have client id / secret in our env remove it\n const removeEnvItems = (items: string[]) => {\n const indexesToRemove = [];\n\n for (let i = 0; i < existingEnvFileArray.length; i++) {\n for (const item of items) {\n if (existingEnvFileArray[i].includes(item)) {\n indexesToRemove.push(i);\n break;\n }\n }\n }\n\n for (let i = indexesToRemove.length - 1; i >= 0; i--) {\n existingEnvFileArray.splice(indexesToRemove[i], 1);\n }\n };\n\n // remove client id and secret from env file\n if (loc === 'git') {\n removeEnvItems(['CONTENSIS_CLIENT_ID', 'CONTENSIS_CLIENT_SECRET']);\n }\n\n const envFileLines = mergeDotEnvFileContents(\n existingEnvFileArray,\n envContentsToAdd\n );\n const newEnvFileContent = envFileLines.join('\\n');\n const envDiff = diffFileContent(existingEnvFile || '', newEnvFileContent);\n\n if (dryRun) {\n if (envDiff) {\n log.info(`Updating .env file ${winSlash(envFilePath)}:\\n${envDiff}`);\n log.raw('');\n }\n checkpoint('skip .env file update (dry-run)');\n } else {\n if (envDiff) log.info(`Updating .env file ${winSlash(envFilePath)}`);\n writeFile(envFilePath, envFileLines.join('\\n'));\n checkpoint('.env file updated');\n log.success(messages.devinit.writeEnvFile());\n // log.help(messages.devinit.useEnvFileTip());\n }\n\n // Update git ignore\n if (dryRun) {\n checkpoint('skip .gitignore file update (dry-run)');\n } else {\n mergeContentsToAddWithGitignore(`${projectHome}/.gitignore`, ['.env']);\n log.raw('');\n }\n\n // Update CI Workflow\n const mappedWorkflow = await mapCIWorkflowContent(this, loc);\n\n // Update CI file -- different for GH/GL\n if (mappedWorkflow?.diff) {\n log.info(\n `Updating ${winSlash(ciFileName)} file:\\n${mappedWorkflow.diff}`\n );\n log.raw('');\n }\n if (dryRun) {\n checkpoint('skip CI file update (dry-run)');\n //log.object(ciFileLines);\n } else {\n if (mappedWorkflow?.newWorkflow) {\n if (mappedWorkflow?.diff) {\n writeFile(git.ciFilePath, mappedWorkflow.newWorkflow);\n log.success(messages.devinit.writeCiFile(`./${ciFileName}`));\n log.info(\n messages.devinit.ciBlockTip(blockId, currentEnv, currentProject)\n );\n } else {\n log.info(messages.devinit.ciFileNoChanges(`./${ciFileName}`));\n }\n log.raw('');\n checkpoint('CI file updated');\n }\n }\n\n if (loc === 'git') {\n // Echo Deployment API key to console, ask user to add secrets to repo\n log.warning(messages.devinit.addGitSecretsIntro());\n log.help(\n messages.devinit.addGitSecretsHelp(\n git,\n existingDeployKey?.id || messages.devinit.dryRunKeyMessage(dryRun),\n existingDeployKey?.sharedSecret ||\n messages.devinit.dryRunKeyMessage(dryRun)\n )\n );\n }\n\n if (dryRun) {\n log.success(messages.devinit.dryRun());\n log.help(messages.devinit.noChanges());\n } else {\n log.success(messages.devinit.success());\n log.help(messages.devinit.startProjectTip());\n // open the cms link -- if no classic token just return the cms url\n\n // go and fetch the classic token from auth service\n const classicToken = await this.auth?.ClassicToken();\n log.help(\n ansiEscapes.link(\n `Open Contensis`,\n `${this.urls?.cms}${\n classicToken ? `?SecurityToken=${classicToken}` : ''\n }`\n )\n );\n }\n }\n };\n\n ExecRequestHandler = async (\n blockId: string[],\n overrideArgs: string[] = [],\n version?: string\n ) => {\n const { debug, log, messages } = this;\n\n const spinner = !debug\n ? createSpinner(messages.devrequests.launch())\n : log.info(messages.devrequests.launch());\n\n // Ensure request handler is available to use\n const requestHandler = await createRequestHandler(version);\n\n // Generate args for request handler using CLI methods\n const args = new RequestHandlerArgs(this);\n spinner?.start();\n await args.Create();\n spinner?.success();\n\n // Prompt block id and dev uri to run locally (if not supplied)\n const blockIdChoices = args.siteConfig?.blocks.map(block => block.id) || [];\n blockIdChoices.push('none');\n const defaultDeveloperUri = 'http://localhost:3000';\n\n const { overrideBlockId, overrideUri } = blockId.length\n ? {\n overrideBlockId: blockId[0],\n overrideUri: blockId?.[1] || defaultDeveloperUri,\n }\n : await inquirer.prompt([\n {\n type: 'list',\n prefix: '\uD83E\uDDF1',\n message: messages.devrequests.overrideBlock(),\n name: 'overrideBlockId',\n choices: blockIdChoices,\n },\n {\n type: 'input',\n prefix: '\uD83D\uDD17',\n message: messages.devrequests.overrideUri(),\n name: 'overrideUri',\n default: defaultDeveloperUri,\n },\n ]);\n\n args.overrideBlock(overrideBlockId, overrideUri);\n\n // Launch request handler\n await requestHandler(args.getArgs(overrideArgs));\n };\n}\nexport const devCommand = (\n commandArgs: string[],\n outputOpts: OutputOptionsConstructorArg,\n contensisOpts: Partial<MigrateRequest> = {}\n) => {\n return new ContensisDev(['', '', ...commandArgs], outputOpts, contensisOpts);\n};\n\nexport default ContensisDev;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAwB;AACxB,yBAAe;AACf,sBAAqB;AACrB,yBAA8B;AAK9B,kCAA0B;AAC1B,mCAAqC;AAGrC,mCAAqC;AACrC,iDAA+B;AAC/B,wCAA8B;AAC9B,2BAAoC;AACpC,kBAAgC;AAChC,oBAAwC;AACxC,kBAA+B;AAC/B,iBAA0B;AAC1B,kBAA8B;AAC9B,gBAAyB;AACzB,uBAAgD;AAEhD,MAAM,qBAAqB,4BAAAA,QAAc;AAAA,EACvC;AAAA,EACA;AAAA,EAEA,oBAAoB;AAAA,IAClB,UAAU;AAAA,IACV,cAAc;AAAA,EAChB;AAAA,EAEA,YACE,MACA,YACA,gBAAyC,CAAC,GAC1C;AACA,UAAM,MAAM,YAAY,aAAa;AAAA,EACvC;AAAA,EAEA,kBAAkB,OAAO,aAAqB,SAAc;
|
|
6
|
-
"names": ["ContensisRole", "blockId", "inquirer", "to", "ansiEscapes", "RequestHandlerArgs"]
|
|
4
|
+
"sourcesContent": ["import { search } from '@inquirer/prompts';\nimport ansiEscapes from 'ansi-escapes';\nimport to from 'await-to-js';\nimport inquirer from 'inquirer';\nimport { createSpinner } from 'nanospinner';\n\nimport { Role } from 'contensis-management-api/lib/models';\nimport { MigrateRequest } from 'migratortron';\n\nimport ContensisRole from './ContensisRoleService';\nimport { createRequestHandler } from '~/factories/RequestHandlerFactory';\nimport { OutputOptionsConstructorArg } from '~/models/CliService';\nimport { EnvContentsToAdd } from '~/models/DevService';\nimport { mapCIWorkflowContent } from '~/mappers/DevInit-to-CIWorkflow';\nimport RequestHandlerArgs from '~/mappers/DevRequests-to-RequestHanderCliArgs';\nimport { deployKeyRole } from '~/mappers/DevInit-to-RolePermissions';\nimport { readFile, writeFile } from '~/providers/file-provider';\nimport { diffFileContent } from '~/util/diff';\nimport { mergeDotEnvFileContents } from '~/util/dotenv';\nimport { findByIdOrName } from '~/util/find';\nimport { GitHelper } from '~/util/git';\nimport { jsonFormatter } from '~/util/json.formatter';\nimport { winSlash } from '~/util/os';\nimport { mergeContentsToAddWithGitignore } from '~/util/gitignore';\n\nclass ContensisDev extends ContensisRole {\n git!: GitHelper;\n blockId!: string;\n\n deployCredentials = {\n clientId: '',\n clientSecret: '',\n };\n\n constructor(\n args: string[],\n outputOpts?: OutputOptionsConstructorArg,\n contensisOpts: Partial<MigrateRequest> = {}\n ) {\n super(args, outputOpts, contensisOpts);\n }\n\n DevelopmentInit = async (projectHome: string, opts: any) => {\n // Retrieve git info\n const git = (this.git = new GitHelper(projectHome));\n // Check if we are in a git repo\n const isRepo = git.checkIsRepo();\n if (!isRepo) return;\n\n const { dryRun = false } = opts || {};\n const { currentEnv, currentProject, log, messages } = this;\n const contensis = await this.ConnectContensis();\n\n if (contensis) {\n // First we need to get the block id from the user\n const validateBlockId = (blockId: string) => {\n const pattern = /^[0-9a-z](-?[0-9a-z])*$/;\n if (blockId.length >= 1 && blockId.length <= 225) {\n return pattern.test(blockId);\n } else return false;\n };\n const { blockId } = await inquirer.prompt({\n name: 'blockId',\n type: 'input',\n prefix: '\uD83E\uDDF1',\n message: messages.devinit.blockIdQuestion,\n validate: validateBlockId,\n default: git.name,\n });\n // make sure block id is lowercase\n this.blockId = blockId.toLowerCase();\n log.success(`Valid block id: ${blockId.toLowerCase()}`);\n\n // Retrieve keys list for env\n const [keysErr, apiKeys] = await contensis.apiKeys.GetKeys();\n if (keysErr) {\n log.error(messages.keys.noList(currentEnv));\n log.error(jsonFormatter(keysErr));\n return;\n }\n const apiKeyExists = (findKey: string) =>\n apiKeys?.find(\n k => k.name.trim().toLowerCase() === findKey?.trim().toLowerCase()\n );\n\n // Retrieve ci workflow info\n const workflowFiles = git.workflows;\n\n // Set variables for performing operations and logging etc.\n let ciFileName = git.ciFileName;\n\n const apiKeyName = `block-${currentProject}-${blockId}`.toLowerCase();\n\n const devKeyName = `${apiKeyName}`;\n const devKeyDescription = `Created by Contensis to allow API access from the running block`;\n let existingDevKey = apiKeyExists(devKeyName);\n\n const deployKeyName = `${apiKeyName}-ci`;\n const deployKeyDescription = `Created by the Contensis CLI for use in continuous integration`;\n\n let existingDeployKey = apiKeyExists(deployKeyName);\n\n // const blockId = git.name;\n const errors = [] as AppError[];\n\n // Start render console output\n log.raw('');\n log.success(messages.devinit.intro());\n log.raw(\n log.infoText(\n messages.devinit.projectDetails(\n git.name,\n currentEnv,\n currentProject,\n blockId,\n git\n )\n )\n );\n log.raw(\n log.infoText(\n messages.devinit.developmentKey(devKeyName, !!existingDevKey)\n )\n );\n log.raw(\n log.infoText(\n messages.devinit.deploymentKey(deployKeyName, !!existingDeployKey)\n )\n );\n log.raw('');\n\n if (Array.isArray(workflowFiles) && workflowFiles.length > 1) {\n // Choose GitHub workflow file (if multiple)\n ({ ciFileName } = await inquirer.prompt([\n {\n type: 'list',\n prefix: '\u29F0',\n message: messages.devinit.ciMultipleChoices(),\n name: 'ciFileName',\n choices: workflowFiles,\n default: workflowFiles.find(f => f.includes('docker')),\n },\n ]));\n log.raw('');\n git.ciFileName = ciFileName;\n }\n\n log.raw(log.infoText(messages.devinit.ciDetails(ciFileName)));\n\n // Location for Client ID / Secret.\n const { loc } = await inquirer.prompt({\n name: 'loc',\n type: 'list',\n prefix: '\uD83D\uDD11',\n // Where would you like to store your client id/secret?\n message: messages.devinit.clientDetailsLocation(),\n choices: [\n {\n name: messages.devinit.clientDetailsInGit(git),\n value: 'git',\n },\n {\n name: messages.devinit.clientDetailsInEnv(),\n value: 'env',\n },\n ],\n });\n\n log.raw('');\n log.help(messages.devinit.ciIntro(git, loc));\n\n if (!dryRun) {\n // Confirm prompt\n const { confirm } = await inquirer.prompt([\n {\n type: 'confirm',\n message: messages.devinit.confirm(),\n name: 'confirm',\n default: false,\n },\n ]);\n log.raw('');\n if (!confirm) return;\n }\n\n // Fetching access token\n let accessToken: string | undefined = undefined;\n\n const spinner = createSpinner(messages.devinit.accessTokenFetch());\n spinner.start();\n\n const token = await this.GetDeliveryApiKey();\n\n if (token) {\n accessToken = token;\n spinner.success({ text: messages.devinit.accessTokenSuccess(token) });\n log.raw('');\n } else {\n spinner.error();\n this.log.error(messages.devinit.accessTokenFailed());\n return;\n }\n\n // Magic happens...\n const checkpoint = (op: string) => {\n if (errors.length) throw errors[0];\n else log.debug(`${op} completed ok`);\n return true;\n };\n\n // Arrange API keys for development and deployment\n const [getRolesErr, roles] = await to(contensis.roles.GetRoles());\n if (!roles && getRolesErr) errors.push(getRolesErr);\n checkpoint(`fetched ${roles?.length} roles`);\n\n if (dryRun) {\n checkpoint(`skip api key creation (dry-run)`);\n } else {\n // if dev api key doesn't exist go and create it (we need this for local development, we will store these details in the .env file).\n const devKeyExisted = !!existingDevKey;\n if (!existingDevKey) {\n existingDevKey = await this.CreateOrUpdateApiKey(\n existingDevKey,\n devKeyName,\n devKeyDescription\n );\n log.success(messages.devinit.createDevKey(devKeyName, devKeyExisted));\n }\n // NF 24/11/23 Added this commented code back in as we are not assigning the dev key to any role here\n // // Ensure dev API key is assigned to a role\n // let existingDevRole = findByIdOrName(roles || [], devKeyName, true) as\n // | Role\n // | undefined;\n // existingDevRole = await this.CreateOrUpdateRole(\n // existingDevRole,\n // devKeyRole(devKeyName, devKeyDescription)\n // );\n // checkpoint('dev key role assigned');\n\n // if deploy api key doesn't exist go and create it (we need this for yml file).\n const deployKeyExisted = !!existingDeployKey;\n if (!existingDeployKey) {\n existingDeployKey = await this.CreateOrUpdateApiKey(\n existingDeployKey,\n deployKeyName,\n deployKeyDescription\n );\n }\n\n // check we have the deploy key so we can assign them to this values\n if (existingDeployKey) {\n // Add client id and secret to credentials\n this.deployCredentials.clientId = existingDeployKey?.id;\n this.deployCredentials.clientSecret = existingDeployKey?.sharedSecret;\n }\n\n // Ensure deploy API key is assigned to a role with the right permissions\n const deployRoleName = `Role for CI push of block '${blockId}'`;\n const deplyRoleDescription = `Created by the Contensis CLI for use in continuous integration`;\n let existingDeployRole = findByIdOrName(\n roles || [],\n deployRoleName,\n true\n ) as Role | undefined;\n existingDeployRole = await this.CreateOrUpdateRole(\n existingDeployRole,\n deployKeyRole(deployKeyName, deployRoleName, deplyRoleDescription)\n );\n\n checkpoint('deploy key role assigned');\n log.success(\n messages.devinit.createDeployKey(deployRoleName, deployKeyExisted)\n );\n checkpoint('api keys done');\n }\n\n const envFilePath = `${projectHome}/.env`;\n const existingEnvFile = readFile(envFilePath);\n const existingEnvFileArray = (existingEnvFile || '')\n .split('\\n')\n .filter(l => !!l);\n\n // Update or create a file called .env in project home\n const envContentsToAdd: EnvContentsToAdd = {\n ALIAS: currentEnv,\n PROJECT_API_ID: currentProject,\n BLOCK_ID: blockId,\n };\n if (accessToken) envContentsToAdd['ACCESS_TOKEN'] = accessToken;\n // add client id and secret to the env file\n if (loc === 'env') {\n envContentsToAdd['CONTENSIS_CLIENT_ID'] =\n existingDevKey?.id || messages.devinit.dryRunKeyMessage(dryRun);\n envContentsToAdd['CONTENSIS_CLIENT_SECRET'] =\n existingDevKey?.sharedSecret ||\n messages.devinit.dryRunKeyMessage(dryRun);\n }\n\n // if we have client id / secret in our env remove it\n const removeEnvItems = (items: string[]) => {\n const indexesToRemove = [];\n\n for (let i = 0; i < existingEnvFileArray.length; i++) {\n for (const item of items) {\n if (existingEnvFileArray[i].includes(item)) {\n indexesToRemove.push(i);\n break;\n }\n }\n }\n\n for (let i = indexesToRemove.length - 1; i >= 0; i--) {\n existingEnvFileArray.splice(indexesToRemove[i], 1);\n }\n };\n\n // remove client id and secret from env file\n if (loc === 'git') {\n removeEnvItems(['CONTENSIS_CLIENT_ID', 'CONTENSIS_CLIENT_SECRET']);\n }\n\n const envFileLines = mergeDotEnvFileContents(\n existingEnvFileArray,\n envContentsToAdd\n );\n const newEnvFileContent = envFileLines.join('\\n');\n const envDiff = diffFileContent(existingEnvFile || '', newEnvFileContent);\n\n if (dryRun) {\n if (envDiff) {\n log.info(`Updating .env file ${winSlash(envFilePath)}:\\n${envDiff}`);\n log.raw('');\n }\n checkpoint('skip .env file update (dry-run)');\n } else {\n if (envDiff) log.info(`Updating .env file ${winSlash(envFilePath)}`);\n writeFile(envFilePath, envFileLines.join('\\n'));\n checkpoint('.env file updated');\n log.success(messages.devinit.writeEnvFile());\n // log.help(messages.devinit.useEnvFileTip());\n }\n\n // Update git ignore\n if (dryRun) {\n checkpoint('skip .gitignore file update (dry-run)');\n } else {\n mergeContentsToAddWithGitignore(`${projectHome}/.gitignore`, ['.env']);\n log.raw('');\n }\n\n // Update CI Workflow\n const mappedWorkflow = await mapCIWorkflowContent(this, loc);\n\n // Update CI file -- different for GH/GL\n if (mappedWorkflow?.diff) {\n log.info(\n `Updating ${winSlash(ciFileName)} file:\\n${mappedWorkflow.diff}`\n );\n log.raw('');\n }\n if (dryRun) {\n checkpoint('skip CI file update (dry-run)');\n //log.object(ciFileLines);\n } else {\n if (mappedWorkflow?.newWorkflow) {\n if (mappedWorkflow?.diff) {\n writeFile(git.ciFilePath, mappedWorkflow.newWorkflow);\n log.success(messages.devinit.writeCiFile(`./${ciFileName}`));\n log.info(\n messages.devinit.ciBlockTip(blockId, currentEnv, currentProject)\n );\n } else {\n log.info(messages.devinit.ciFileNoChanges(`./${ciFileName}`));\n }\n log.raw('');\n checkpoint('CI file updated');\n }\n }\n\n if (loc === 'git') {\n // Echo Deployment API key to console, ask user to add secrets to repo\n log.warning(messages.devinit.addGitSecretsIntro());\n log.help(\n messages.devinit.addGitSecretsHelp(\n git,\n existingDeployKey?.id || messages.devinit.dryRunKeyMessage(dryRun),\n existingDeployKey?.sharedSecret ||\n messages.devinit.dryRunKeyMessage(dryRun)\n )\n );\n }\n\n if (dryRun) {\n log.success(messages.devinit.dryRun());\n log.help(messages.devinit.noChanges());\n } else {\n log.success(messages.devinit.success());\n log.help(messages.devinit.startProjectTip());\n // open the cms link -- if no classic token just return the cms url\n\n // go and fetch the classic token from auth service\n const classicToken = await this.auth?.ClassicToken();\n log.help(\n ansiEscapes.link(\n `Open Contensis`,\n `${this.urls?.cms}${\n classicToken ? `?SecurityToken=${classicToken}` : ''\n }`\n )\n );\n }\n }\n };\n\n ExecRequestHandler = async (\n blockId: string[],\n blockOverrides: string[] | boolean,\n overrideArgs: string[] = [],\n version?: string\n ) => {\n const { currentEnv, currentProject, debug, log, messages } = this;\n\n const spinner = !debug\n ? createSpinner(messages.devrequests.launch())\n : log.info(messages.devrequests.launch());\n\n // Ensure request handler is available to use\n const requestHandler = await createRequestHandler(version);\n\n // Get the available blocks for the project\n const contensis = await this.ConnectContensis();\n if (contensis) {\n const blockBranches = new Map<string, string>();\n\n const [err, projectBlocks] = await contensis.blocks.GetBlocks();\n if (err) log.error(messages.blocks.noList(currentEnv, currentProject));\n else if (projectBlocks) {\n // Prompt block id and dev uri to run locally (if not supplied)\n const blockIdChoices = projectBlocks.map(block => block.id) || [];\n blockIdChoices.push('none');\n const defaultDeveloperUri = 'http://localhost:3000';\n\n const { developmentBlockId, developmentBlockUri } = blockId.length\n ? {\n developmentBlockId: blockId[0],\n developmentBlockUri: blockId?.[1] || defaultDeveloperUri,\n }\n : await inquirer.prompt([\n {\n type: 'list',\n prefix: '\uD83E\uDDF1',\n message: messages.devrequests.overrideBlock(),\n name: 'developmentBlockId',\n choices: blockIdChoices,\n },\n {\n type: 'input',\n prefix: '\uD83D\uDD17',\n message: messages.devrequests.overrideUri(),\n name: 'developmentBlockUri',\n default: defaultDeveloperUri,\n },\n ]);\n\n // Prompt for other block overrides (e.g. branch)\n if (blockOverrides) {\n // Prompt for which blocks to override\n const blockIdChoices =\n projectBlocks\n // ?.filter(block => block.id !== developmentBlockId)\n ?.map(block => ({\n name: `${block.id}${block.description ? ` (${block.description})` : ''}`,\n value: block.id,\n })) || [];\n blockIdChoices.push({ name: 'none', value: 'none' });\n\n const { overrideBlockIds } = Array.isArray(blockOverrides)\n ? {\n overrideBlockIds: blockOverrides\n .map(bId => projectBlocks.find(b => b.id === bId)?.id)\n .filter(Boolean) as string[],\n }\n : await inquirer.prompt<{ overrideBlockIds: string[] }>([\n {\n type: 'checkbox',\n prefix: '\uD83E\uDDF1',\n message: messages.devrequests.overrideBlocks(),\n name: 'overrideBlockIds',\n choices: blockIdChoices,\n // default: blockIdChoices.findIndex(b => b.value === 'none'),\n },\n ]);\n\n // For each block to override, prompt for the branch to use\n for (const overrideBlockId of overrideBlockIds) {\n if (overrideBlockId === 'none') continue;\n const choices = projectBlocks\n .find(b => b.id === overrideBlockId)\n ?.branches.map(b => b.id);\n if (choices) {\n const overrideBranch = await search<string>({\n message: `\uD83C\uDF3F ${messages.devrequests.overrideBranch(overrideBlockId)}`,\n source: input => {\n input = input || '';\n const fuzzyResult = input\n ? choices?.filter(choice =>\n choice.toLowerCase().includes(input.toLowerCase())\n )\n : choices;\n return fuzzyResult || [];\n },\n });\n blockBranches.set(overrideBlockId, overrideBranch);\n }\n }\n }\n\n // Generate args for request handler using CLI methods\n const args = new RequestHandlerArgs(projectBlocks, blockBranches, this);\n spinner?.start();\n await args.Create();\n args.overrideBlock(developmentBlockId, developmentBlockUri);\n spinner?.success();\n\n // Launch request handler\n await requestHandler(args.getArgs(overrideArgs));\n }\n }\n };\n}\nexport const devCommand = (\n commandArgs: string[],\n outputOpts: OutputOptionsConstructorArg,\n contensisOpts: Partial<MigrateRequest> = {}\n) => {\n return new ContensisDev(['', '', ...commandArgs], outputOpts, contensisOpts);\n};\n\nexport default ContensisDev;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAuB;AACvB,0BAAwB;AACxB,yBAAe;AACf,sBAAqB;AACrB,yBAA8B;AAK9B,kCAA0B;AAC1B,mCAAqC;AAGrC,mCAAqC;AACrC,iDAA+B;AAC/B,wCAA8B;AAC9B,2BAAoC;AACpC,kBAAgC;AAChC,oBAAwC;AACxC,kBAA+B;AAC/B,iBAA0B;AAC1B,kBAA8B;AAC9B,gBAAyB;AACzB,uBAAgD;AAEhD,MAAM,qBAAqB,4BAAAA,QAAc;AAAA,EACvC;AAAA,EACA;AAAA,EAEA,oBAAoB;AAAA,IAClB,UAAU;AAAA,IACV,cAAc;AAAA,EAChB;AAAA,EAEA,YACE,MACA,YACA,gBAAyC,CAAC,GAC1C;AACA,UAAM,MAAM,YAAY,aAAa;AAAA,EACvC;AAAA,EAEA,kBAAkB,OAAO,aAAqB,SAAc;AA1C9D;AA4CI,UAAM,MAAO,KAAK,MAAM,IAAI,qBAAU,WAAW;AAEjD,UAAM,SAAS,IAAI,YAAY;AAC/B,QAAI,CAAC,OAAQ;AAEb,UAAM,EAAE,SAAS,MAAM,IAAI,QAAQ,CAAC;AACpC,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AAEA,IAAO,8BAAQ;",
|
|
6
|
+
"names": ["ContensisRole", "blockId", "inquirer", "to", "ansiEscapes", "blockIdChoices", "_a", "RequestHandlerArgs"]
|
|
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.6.1-beta.
|
|
24
|
+
const LIB_VERSION = "1.6.1-beta.8";
|
|
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.6.1-beta.
|
|
4
|
+
"sourcesContent": ["export const LIB_VERSION = \"1.6.1-beta.8\";\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contensis-cli",
|
|
3
|
-
"version": "1.6.1-beta.
|
|
3
|
+
"version": "1.6.1-beta.8",
|
|
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": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"license": "ISC",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@action-validator/core": "^0.6.0",
|
|
31
|
+
"@inquirer/prompts": "^8.2.0",
|
|
31
32
|
"adm-zip": "^0.5.16",
|
|
32
33
|
"app-root-path": "^3.1.0",
|
|
33
34
|
"chalk": "^4.1.2",
|
package/src/commands/dev.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
1
|
+
import { Command, Option } from 'commander';
|
|
2
2
|
import { devCommand } from '~/services/ContensisDevService';
|
|
3
3
|
|
|
4
4
|
export const makeDevCommand = () => {
|
|
@@ -58,6 +58,10 @@ Example call:
|
|
|
58
58
|
'--release <release>',
|
|
59
59
|
'launch a specific release version of the request handler'
|
|
60
60
|
)
|
|
61
|
+
.option(
|
|
62
|
+
'--override [override...]',
|
|
63
|
+
'override configurations for other blocks'
|
|
64
|
+
)
|
|
61
65
|
.usage('[block-id] [local-uri]')
|
|
62
66
|
.addHelpText(
|
|
63
67
|
'after',
|
|
@@ -70,7 +74,7 @@ Example call:
|
|
|
70
74
|
await devCommand(
|
|
71
75
|
['dev', 'requests', blockId.join(' ')],
|
|
72
76
|
opts
|
|
73
|
-
).ExecRequestHandler(blockId, opts?.args, opts.release);
|
|
77
|
+
).ExecRequestHandler(blockId, opts?.override, opts?.args, opts.release);
|
|
74
78
|
});
|
|
75
79
|
|
|
76
80
|
return dev;
|
|
@@ -712,6 +712,9 @@ export const LogMessages = {
|
|
|
712
712
|
launch: () => `Launching request handler for local development`,
|
|
713
713
|
overrideBlock: () => `Which block will you be running?`,
|
|
714
714
|
overrideUri: () => `How to access your development site`,
|
|
715
|
+
overrideBlocks: () => `Which blocks will you be overriding?`,
|
|
716
|
+
overrideBranch: (blockId: string) =>
|
|
717
|
+
`Which branch would you like ${blockId} to target?`,
|
|
715
718
|
spawn: () =>
|
|
716
719
|
`If you see a firewall popup requesting network access, it is safe to approve`,
|
|
717
720
|
exited: (code: number | null) =>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContensisMigrationService } from 'migratortron';
|
|
1
|
+
import { Block, ContensisMigrationService } from 'migratortron';
|
|
2
2
|
import PQueue from 'p-queue';
|
|
3
3
|
import ContensisCli from '~/services/ContensisCliService';
|
|
4
4
|
|
|
@@ -43,11 +43,14 @@ interface ISiteConfigYaml {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
class RequestHandlerArgs {
|
|
46
|
-
private cli;
|
|
47
46
|
args?: string[];
|
|
48
47
|
siteConfig?: ISiteConfigYaml;
|
|
49
48
|
|
|
50
|
-
constructor(
|
|
49
|
+
constructor(
|
|
50
|
+
public blocks: Block[],
|
|
51
|
+
public blockBranches: Map<string, string>,
|
|
52
|
+
private cli: ContensisCli
|
|
53
|
+
) {
|
|
51
54
|
this.cli = cli;
|
|
52
55
|
}
|
|
53
56
|
|
|
@@ -59,7 +62,6 @@ class RequestHandlerArgs {
|
|
|
59
62
|
|
|
60
63
|
buildSiteConfig = async () => {
|
|
61
64
|
const { currentEnv, currentProject, env, log, messages, urls } = this.cli;
|
|
62
|
-
const contensis = await this.cli.ConnectContensis();
|
|
63
65
|
|
|
64
66
|
const siteConfig: ISiteConfigYaml = {
|
|
65
67
|
alias: currentEnv,
|
|
@@ -73,28 +75,31 @@ class RequestHandlerArgs {
|
|
|
73
75
|
renderers: [],
|
|
74
76
|
};
|
|
75
77
|
|
|
76
|
-
const
|
|
77
|
-
const [err, blocksRaw] = await contensis.blocks.GetBlocks();
|
|
78
|
-
if (err)
|
|
79
|
-
log.error(messages.blocks.noList(currentEnv, env.currentProject));
|
|
80
|
-
|
|
81
|
-
// const blocksRaw = await cli.PrintBlocks();
|
|
82
|
-
|
|
78
|
+
const getBlockVersions = async (contensis: ContensisMigrationService) => {
|
|
83
79
|
const blocks: BlockJson[] = [];
|
|
84
80
|
const queue = new PQueue({ concurrency: 4 });
|
|
85
|
-
for (const block of
|
|
81
|
+
for (const block of this.blocks || []) {
|
|
86
82
|
queue.add(async () => {
|
|
87
83
|
// Retrieve block version
|
|
84
|
+
const branch =
|
|
85
|
+
// If we've set an override branch
|
|
86
|
+
this.blockBranches.get(block.id) ||
|
|
87
|
+
// If the block has no master/main branch, use the first branch
|
|
88
|
+
!block.branches.find(br => ['master', 'main'].includes(br.id))
|
|
89
|
+
? block.branches[0]?.id
|
|
90
|
+
: // Else use default for Contensis to fetch master or main
|
|
91
|
+
'default';
|
|
92
|
+
|
|
88
93
|
const [err, versions] = await contensis.blocks.GetBlockVersions(
|
|
89
94
|
block.id,
|
|
90
|
-
|
|
95
|
+
branch,
|
|
91
96
|
'latest'
|
|
92
97
|
);
|
|
93
98
|
if (err || versions?.length === 0)
|
|
94
99
|
log.warning(
|
|
95
100
|
messages.blocks.noGet(
|
|
96
101
|
block.id,
|
|
97
|
-
|
|
102
|
+
branch,
|
|
98
103
|
'latest',
|
|
99
104
|
currentEnv,
|
|
100
105
|
env.currentProject
|
|
@@ -118,10 +123,10 @@ class RequestHandlerArgs {
|
|
|
118
123
|
return blocks;
|
|
119
124
|
};
|
|
120
125
|
|
|
121
|
-
if (contensis) {
|
|
126
|
+
if (this.cli.contensis) {
|
|
122
127
|
const [blocks, renderers] = await Promise.all([
|
|
123
|
-
|
|
124
|
-
contensis.renderers.GetRenderers(),
|
|
128
|
+
getBlockVersions(this.cli.contensis),
|
|
129
|
+
this.cli.contensis.renderers.GetRenderers(),
|
|
125
130
|
]);
|
|
126
131
|
|
|
127
132
|
siteConfig.blocks = blocks;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { search } from '@inquirer/prompts';
|
|
1
2
|
import ansiEscapes from 'ansi-escapes';
|
|
2
3
|
import to from 'await-to-js';
|
|
3
4
|
import inquirer from 'inquirer';
|
|
@@ -413,10 +414,11 @@ class ContensisDev extends ContensisRole {
|
|
|
413
414
|
|
|
414
415
|
ExecRequestHandler = async (
|
|
415
416
|
blockId: string[],
|
|
417
|
+
blockOverrides: string[] | boolean,
|
|
416
418
|
overrideArgs: string[] = [],
|
|
417
419
|
version?: string
|
|
418
420
|
) => {
|
|
419
|
-
const { debug, log, messages } = this;
|
|
421
|
+
const { currentEnv, currentProject, debug, log, messages } = this;
|
|
420
422
|
|
|
421
423
|
const spinner = !debug
|
|
422
424
|
? createSpinner(messages.devrequests.launch())
|
|
@@ -425,43 +427,105 @@ class ContensisDev extends ContensisRole {
|
|
|
425
427
|
// Ensure request handler is available to use
|
|
426
428
|
const requestHandler = await createRequestHandler(version);
|
|
427
429
|
|
|
428
|
-
//
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
430
|
+
// Get the available blocks for the project
|
|
431
|
+
const contensis = await this.ConnectContensis();
|
|
432
|
+
if (contensis) {
|
|
433
|
+
const blockBranches = new Map<string, string>();
|
|
434
|
+
|
|
435
|
+
const [err, projectBlocks] = await contensis.blocks.GetBlocks();
|
|
436
|
+
if (err) log.error(messages.blocks.noList(currentEnv, currentProject));
|
|
437
|
+
else if (projectBlocks) {
|
|
438
|
+
// Prompt block id and dev uri to run locally (if not supplied)
|
|
439
|
+
const blockIdChoices = projectBlocks.map(block => block.id) || [];
|
|
440
|
+
blockIdChoices.push('none');
|
|
441
|
+
const defaultDeveloperUri = 'http://localhost:3000';
|
|
442
|
+
|
|
443
|
+
const { developmentBlockId, developmentBlockUri } = blockId.length
|
|
444
|
+
? {
|
|
445
|
+
developmentBlockId: blockId[0],
|
|
446
|
+
developmentBlockUri: blockId?.[1] || defaultDeveloperUri,
|
|
447
|
+
}
|
|
448
|
+
: await inquirer.prompt([
|
|
449
|
+
{
|
|
450
|
+
type: 'list',
|
|
451
|
+
prefix: '🧱',
|
|
452
|
+
message: messages.devrequests.overrideBlock(),
|
|
453
|
+
name: 'developmentBlockId',
|
|
454
|
+
choices: blockIdChoices,
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
type: 'input',
|
|
458
|
+
prefix: '🔗',
|
|
459
|
+
message: messages.devrequests.overrideUri(),
|
|
460
|
+
name: 'developmentBlockUri',
|
|
461
|
+
default: defaultDeveloperUri,
|
|
462
|
+
},
|
|
463
|
+
]);
|
|
464
|
+
|
|
465
|
+
// Prompt for other block overrides (e.g. branch)
|
|
466
|
+
if (blockOverrides) {
|
|
467
|
+
// Prompt for which blocks to override
|
|
468
|
+
const blockIdChoices =
|
|
469
|
+
projectBlocks
|
|
470
|
+
// ?.filter(block => block.id !== developmentBlockId)
|
|
471
|
+
?.map(block => ({
|
|
472
|
+
name: `${block.id}${block.description ? ` (${block.description})` : ''}`,
|
|
473
|
+
value: block.id,
|
|
474
|
+
})) || [];
|
|
475
|
+
blockIdChoices.push({ name: 'none', value: 'none' });
|
|
476
|
+
|
|
477
|
+
const { overrideBlockIds } = Array.isArray(blockOverrides)
|
|
478
|
+
? {
|
|
479
|
+
overrideBlockIds: blockOverrides
|
|
480
|
+
.map(bId => projectBlocks.find(b => b.id === bId)?.id)
|
|
481
|
+
.filter(Boolean) as string[],
|
|
482
|
+
}
|
|
483
|
+
: await inquirer.prompt<{ overrideBlockIds: string[] }>([
|
|
484
|
+
{
|
|
485
|
+
type: 'checkbox',
|
|
486
|
+
prefix: '🧱',
|
|
487
|
+
message: messages.devrequests.overrideBlocks(),
|
|
488
|
+
name: 'overrideBlockIds',
|
|
489
|
+
choices: blockIdChoices,
|
|
490
|
+
// default: blockIdChoices.findIndex(b => b.value === 'none'),
|
|
491
|
+
},
|
|
492
|
+
]);
|
|
493
|
+
|
|
494
|
+
// For each block to override, prompt for the branch to use
|
|
495
|
+
for (const overrideBlockId of overrideBlockIds) {
|
|
496
|
+
if (overrideBlockId === 'none') continue;
|
|
497
|
+
const choices = projectBlocks
|
|
498
|
+
.find(b => b.id === overrideBlockId)
|
|
499
|
+
?.branches.map(b => b.id);
|
|
500
|
+
if (choices) {
|
|
501
|
+
const overrideBranch = await search<string>({
|
|
502
|
+
message: `🌿 ${messages.devrequests.overrideBranch(overrideBlockId)}`,
|
|
503
|
+
source: input => {
|
|
504
|
+
input = input || '';
|
|
505
|
+
const fuzzyResult = input
|
|
506
|
+
? choices?.filter(choice =>
|
|
507
|
+
choice.toLowerCase().includes(input.toLowerCase())
|
|
508
|
+
)
|
|
509
|
+
: choices;
|
|
510
|
+
return fuzzyResult || [];
|
|
511
|
+
},
|
|
512
|
+
});
|
|
513
|
+
blockBranches.set(overrideBlockId, overrideBranch);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
443
516
|
}
|
|
444
|
-
: await inquirer.prompt([
|
|
445
|
-
{
|
|
446
|
-
type: 'list',
|
|
447
|
-
prefix: '🧱',
|
|
448
|
-
message: messages.devrequests.overrideBlock(),
|
|
449
|
-
name: 'overrideBlockId',
|
|
450
|
-
choices: blockIdChoices,
|
|
451
|
-
},
|
|
452
|
-
{
|
|
453
|
-
type: 'input',
|
|
454
|
-
prefix: '🔗',
|
|
455
|
-
message: messages.devrequests.overrideUri(),
|
|
456
|
-
name: 'overrideUri',
|
|
457
|
-
default: defaultDeveloperUri,
|
|
458
|
-
},
|
|
459
|
-
]);
|
|
460
517
|
|
|
461
|
-
|
|
518
|
+
// Generate args for request handler using CLI methods
|
|
519
|
+
const args = new RequestHandlerArgs(projectBlocks, blockBranches, this);
|
|
520
|
+
spinner?.start();
|
|
521
|
+
await args.Create();
|
|
522
|
+
args.overrideBlock(developmentBlockId, developmentBlockUri);
|
|
523
|
+
spinner?.success();
|
|
462
524
|
|
|
463
|
-
|
|
464
|
-
|
|
525
|
+
// Launch request handler
|
|
526
|
+
await requestHandler(args.getArgs(overrideArgs));
|
|
527
|
+
}
|
|
528
|
+
}
|
|
465
529
|
};
|
|
466
530
|
}
|
|
467
531
|
export const devCommand = (
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "1.6.1-beta.
|
|
1
|
+
export const LIB_VERSION = "1.6.1-beta.8";
|