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' : '' const suffix = require('../package.json').name.includes('-edge') ? '-edge' : ''
require('@nuxt/typescript' + suffix).setup(tsConfigPath).then(() => { const errorHandler = (error) => {
require('@nuxt/cli' + suffix).run()
}).catch((error) => {
require('consola').fatal(error) require('consola').fatal(error)
process.exit(2) 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 // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`cli/command builds help text 1`] = ` exports[`cli/command builds help text 1`] = `
" Usage: nuxt this is how you do it " Usage: nuxt this is how you do it
[options] [options]
a very long description that should wrap a very long description that should wrap
to the next line because is not longer to the next line because is not longer
than the terminal width than the terminal width
Options: Options:
--spa, -s Launch in SPA mode --spa, -s Launch in SPA mode
--universal, -u Launch in Universal --universal, -u Launch in Universal
mode (default) mode (default)
--config-file, -c Path to Nuxt.js --config-file, -c Path to Nuxt.js
config file (default: nuxt.config.js) config file (default: nuxt.config.js)
--modern, -m Build/Start app for --modern, -m Build/Start app for
modern browsers, e.g. server, client and modern browsers, e.g. server, client and
false false
--force-exit Whether Nuxt.js --force-exit Whether Nuxt.js
should force exit after the command has should force exit after the command has
finished finished
--version, -v Display the Nuxt --version, -v Display the Nuxt
version version
--help, -h Display this message --help, -h Display this message
--port, -p Port number on which --port, -p Port number on which
to start the application to start the application
--hostname, -H Hostname on which to --hostname, -H Hostname on which to
start the application start the application
--unix-socket, -n Path to a UNIX socket --unix-socket, -n Path to a UNIX socket
--foo very long option that --foo very long option that
is longer than the terminal width and is longer than the terminal width and
should wrap to the next line should wrap to the next line
" "