fix(nuxt-ts): error catch in nuxt-ts binary (#5086)

* fix: nuxt-ts binary error catch

* test: update cli snapshot
This commit is contained in:
Kevin Marrec 2019-02-25 21:09:26 +01:00 committed by Sébastien Chopin
parent 4b82aa9d84
commit 4f887f6963
2 changed files with 20 additions and 18 deletions

View File

@ -11,9 +11,11 @@ const tsConfigPath = resolve(rootDir, 'tsconfig.json')
const suffix = require('../package.json').name.includes('-edge') ? '-edge' : ''
require('@nuxt/typescript' + suffix).setup(tsConfigPath).then(() => {
require('@nuxt/cli' + suffix).run()
}).catch((error) => {
const errorHandler = (error) => {
require('consola').fatal(error)
process.exit(2)
})
}
require('@nuxt/typescript' + suffix).setup(tsConfigPath).then(() => {
require('@nuxt/cli' + suffix).run().catch(errorHandler)
}).catch(errorHandler)

View File

@ -1,36 +1,36 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`cli/command builds help text 1`] = `
" Usage: nuxt this is how you do it
" Usage: nuxt this is how you do it
[options]
a very long description that should wrap
to the next line because is not longer
a very long description that should wrap
to the next line because is not longer
than the terminal width
Options:
--spa, -s Launch in SPA mode
--universal, -u Launch in Universal
--universal, -u Launch in Universal
mode (default)
--config-file, -c Path to Nuxt.js
--config-file, -c Path to Nuxt.js
config file (default: nuxt.config.js)
--modern, -m Build/Start app for
modern browsers, e.g. server, client and
--modern, -m Build/Start app for
modern browsers, e.g. server, client and
false
--force-exit Whether Nuxt.js
should force exit after the command has
--force-exit Whether Nuxt.js
should force exit after the command has
finished
--version, -v Display the Nuxt
--version, -v Display the Nuxt
version
--help, -h Display this message
--port, -p Port number on which
--port, -p Port number on which
to start the application
--hostname, -H Hostname on which to
--hostname, -H Hostname on which to
start the application
--unix-socket, -n Path to a UNIX socket
--foo very long option that
is longer than the terminal width and
--foo very long option that
is longer than the terminal width and
should wrap to the next line
"