Browse Source

Ask the user to `--force` if the build step fails

master
Matheus Fernandes 8 years ago
parent
commit
edde07a21f
No known key found for this signature in database GPG Key ID: DD07CA4EA7B65C4F
  1. 9
      bin/now-deploy.js
  2. 3
      lib/build-logger.js

9
bin/now-deploy.js

@ -29,6 +29,7 @@ const checkPath = require('../lib/utils/check-path')
const {reAlias, assignAlias} = require('../lib/re-alias')
const exit = require('../lib/utils/exit')
const logo = require('../lib/utils/output/logo')
const cmd = require('../lib/utils/output/cmd')
const argv = minimist(process.argv.slice(2), {
string: [
@ -587,9 +588,13 @@ function printLogs(host, token) {
// log build
const logger = new Logger(host, {debug, quiet})
logger.on('error', async () => {
logger.on('error', async err => {
if (!quiet) {
console.log(`${chalk.cyan('> Deployment failed!')}`)
if (err && err.type === 'BUILD_ERROR') {
error(`The build step of your project failed. To retry, run ${cmd('now --force')}.`)
} else {
error('Deployment failed')
}
}
if (gitRepo && gitRepo.cleanup) {

3
lib/build-logger.js

@ -50,6 +50,7 @@ module.exports = class Logger extends EventEmitter {
}
onState(state) {
// console.log(state)
if (!state.id) {
console.error('> Deployment not found')
this.emit('error')
@ -57,7 +58,7 @@ module.exports = class Logger extends EventEmitter {
}
if (state.error) {
this.emit('error')
this.emit('error', state)
return
}

Loading…
Cancel
Save