Skip to content

Commit

Permalink
FIX: add exit 1 when commands fail (#1198)
Browse files Browse the repository at this point in the history
Co-authored-by: leydev <[email protected]>
  • Loading branch information
ayelsew and leydev authored May 2, 2024
1 parent 8354db7 commit 1c5a20d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/modules/apps/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ function handleAccountNotSponsoredByVendorError(app: string) {
}

const prepareInstall = async (appsList: string[], force: boolean): Promise<void> => {
let exitWithError = false;

for (const app of appsList) {
ManifestValidator.validateApp(app)
try {
Expand All @@ -79,6 +81,7 @@ const prepareInstall = async (appsList: string[], force: boolean): Promise<void>
}
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(
Expand Down Expand Up @@ -107,6 +110,8 @@ const prepareInstall = async (appsList: string[], force: boolean): Promise<void>
log.warn(`The following app was not installed: ${app}`)
}
}

if (exitWithError) process.exit(1);
}

export default async (optionalApps: string[], options) => {
Expand Down
3 changes: 2 additions & 1 deletion src/modules/apps/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
2 changes: 2 additions & 0 deletions src/modules/apps/unlink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Make sure you typed the right app vendor, name and version.`)
log.error(e.response.data.message)
}
}
process.exit(1);
}
}

Expand All @@ -40,6 +41,7 @@ const unlinkAllApps = async (): Promise<void> => {
if (e?.response?.data?.message) {
log.error(e.response.data.message)
}
process.exit(1);
}
}

Expand Down

0 comments on commit 1c5a20d

Please sign in to comment.