From 1c5a20d23c8354ccf7b8c1157531e6bb1035ff1f Mon Sep 17 00:00:00 2001 From: "Wesley (leydev)" <33585141+ayelsew@users.noreply.github.com> Date: Thu, 2 May 2024 14:24:42 -0300 Subject: [PATCH] FIX: add exit 1 when commands fail (#1198) Co-authored-by: leydev --- src/modules/apps/install.ts | 5 +++++ src/modules/apps/publish.ts | 3 ++- src/modules/apps/unlink.ts | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/apps/install.ts b/src/modules/apps/install.ts index dbd18e882..f980fa0e5 100644 --- a/src/modules/apps/install.ts +++ b/src/modules/apps/install.ts @@ -53,6 +53,8 @@ function handleAccountNotSponsoredByVendorError(app: string) { } const prepareInstall = async (appsList: string[], force: boolean): Promise => { + let exitWithError = false; + for (const app of appsList) { ManifestValidator.validateApp(app) try { @@ -79,6 +81,7 @@ const prepareInstall = async (appsList: string[], force: boolean): Promise } log.info(`Installed app ${chalk.green(app)} successfully`) } catch (e) { + exitWithError = true; if (isNotFoundError(e)) { log.warn( `Billing app not found in current workspace. Please install it with ${chalk.green( @@ -107,6 +110,8 @@ const prepareInstall = async (appsList: string[], force: boolean): Promise log.warn(`The following app was not installed: ${app}`) } } + + if (exitWithError) process.exit(1); } export default async (optionalApps: string[], options) => { diff --git a/src/modules/apps/publish.ts b/src/modules/apps/publish.ts index 8e2f39e41..774f86868 100644 --- a/src/modules/apps/publish.ts +++ b/src/modules/apps/publish.ts @@ -111,7 +111,8 @@ const publisher = (workspace = 'master') => { ) } } catch (e) { - log.error(`Failed to publish ${appId}`) + log.error(`Failed to publish ${appId}`); + process.exit(1); } await returnToPreviousAccount({ previousAccount, previousWorkspace }) diff --git a/src/modules/apps/unlink.ts b/src/modules/apps/unlink.ts index d6b30c2a7..a56fe69b6 100644 --- a/src/modules/apps/unlink.ts +++ b/src/modules/apps/unlink.ts @@ -22,6 +22,7 @@ Make sure you typed the right app vendor, name and version.`) log.error(e.response.data.message) } } + process.exit(1); } } @@ -40,6 +41,7 @@ const unlinkAllApps = async (): Promise => { if (e?.response?.data?.message) { log.error(e.response.data.message) } + process.exit(1); } }