From 7036945f4fca62b0657ed57a6a86d3d491b1887d Mon Sep 17 00:00:00 2001 From: Toby-Masters-SF <128508661+Toby-Masters-SF@users.noreply.github.com> Date: Tue, 25 Jun 2024 15:45:45 +0100 Subject: [PATCH] Make messages mandatory for Partner Updates (#135) Mandatory messaging solution --- bin/cli.js | 19 +++++++++++++++---- lib/cli/utils.js | 22 ++++++++++++++++------ package.json | 2 +- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/bin/cli.js b/bin/cli.js index ef5b3332..740c9719 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -92,7 +92,9 @@ program const settings = runCommandChecks( ["handle", "all"], options, - firmIdDefault + firmIdDefault, + true, + true // Message required ); if (options.handle) { @@ -192,7 +194,8 @@ program ["name", "all"], options, firmIdDefault, - false + false, + true // Message required (added for later) ); if (options.name) { @@ -296,7 +299,13 @@ program ) .option("--yes", "Skip the prompt confirmation (optional)") .action((options) => { - const settings = runCommandChecks(["name", "all"], options, firmIdDefault); + const settings = runCommandChecks( + ["name", "all"], + options, + firmIdDefault, + true, + true // Message required + ); if (options.name) { toolkit.publishAccountTemplateByName( @@ -402,7 +411,9 @@ program const settings = runCommandChecks( ["sharedPart", "all"], options, - firmIdDefault + firmIdDefault, + true, + true // Message required ); if (options.sharedPart) { diff --git a/lib/cli/utils.js b/lib/cli/utils.js index e8b197a7..e54a3065 100644 --- a/lib/cli/utils.js +++ b/lib/cli/utils.js @@ -138,13 +138,23 @@ function runCommandChecks( requiredTemplateOptions, options, firmIdDefault, - partnerSupported = true + partnerSupported = true, + messageRequired = false ) { - if (!partnerSupported && options.partner) { - consola.error( - `The option "--partner" is not supported when using "--export-file"` - ); - process.exit(1); + if (options.partner) { + // To delete once export files are supported + if (!partnerSupported) { + consola.error( + `The option "--partner" is not supported when using "--export-file"` + ); + process.exit(1); + } + else if (messageRequired && !options.message) { + consola.error( + `Message required when updating a partner template. Please use "--message"` + ); + process.exit(1); + } } checkRequiredFirmOrPartner( diff --git a/package.json b/package.json index e4425cf1..5e0e6ba4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "silverfin-cli", - "version": "1.26.11", + "version": "1.26.12", "description": "Command line tool for Silverfin template development", "main": "index.js", "license": "MIT",