Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Commit

Permalink
Add exit code 1 to deploy. Closes #663
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Oct 18, 2017
1 parent 3617e87 commit 86b2c4a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cli/packages/graphcool-cli-core/src/commands/deploy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ https://console.graph.cool/${encodeURIComponent(info.name)}/settings/general`)
this.definition.set(migrationResult.projectDefinition)
}

let hasError = false

if (migrationResult.errors.length > 0) {
this.out.log(
chalk.rgb(244, 157, 65)(
Expand All @@ -325,6 +327,7 @@ https://console.graph.cool/${encodeURIComponent(info.name)}/settings/general`)
)
this.out.migration.printErrors(migrationResult.errors)
this.out.log('')
hasError = true
}

if (
Expand All @@ -339,9 +342,13 @@ https://console.graph.cool/${encodeURIComponent(info.name)}/settings/general`)
`\`graphcool deploy --force\``,
)} if you know what you're doing!\n`,
)
hasError = true
}
this.deploying = false
this.printEndpoints(projectId)
if (hasError) {
this.out.exit(1)
}
}

private printEndpoints(projectId) {
Expand Down Expand Up @@ -462,6 +469,8 @@ https://console.graph.cool/${encodeURIComponent(info.name)}/settings/general`)
this.definition.set(migrationResult.projectDefinition)
}

let hasError = false

if (migrationResult.errors.length > 0) {
this.out.log(
chalk.rgb(244, 157, 65)(
Expand All @@ -470,6 +479,7 @@ https://console.graph.cool/${encodeURIComponent(info.name)}/settings/general`)
)
this.out.migration.printErrors(migrationResult.errors)
this.out.log('')
hasError = true
}

if (
Expand All @@ -484,6 +494,10 @@ https://console.graph.cool/${encodeURIComponent(info.name)}/settings/general`)
`\`graphcool deploy --force\``,
)} if you know what you're doing!\n`,
)
hasError = true
}
if (hasError) {
this.out.exit(1)
}
} catch (e) {
this.out.action.stop()
Expand Down

2 comments on commit 86b2c4a

@kbrandwijk
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it have been easier to just set process.exitCode where the error happens?

@timsuchanek
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point! Just refactored it: e3f89b7

Please sign in to comment.