Skip to content

Commit

Permalink
Make messages mandatory for Partner Updates (#135)
Browse files Browse the repository at this point in the history
Mandatory messaging solution
  • Loading branch information
Toby-Masters-SF authored Jun 25, 2024
1 parent 8318c6e commit 7036945
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 deletions.
19 changes: 15 additions & 4 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ program
const settings = runCommandChecks(
["handle", "all"],
options,
firmIdDefault
firmIdDefault,
true,
true // Message required
);

if (options.handle) {
Expand Down Expand Up @@ -192,7 +194,8 @@ program
["name", "all"],
options,
firmIdDefault,
false
false,
true // Message required (added for later)
);

if (options.name) {
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -402,7 +411,9 @@ program
const settings = runCommandChecks(
["sharedPart", "all"],
options,
firmIdDefault
firmIdDefault,
true,
true // Message required
);

if (options.sharedPart) {
Expand Down
22 changes: 16 additions & 6 deletions lib/cli/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 7036945

Please sign in to comment.