mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
dbba642d56
env.DEBUG should be set BEFORE requireing Utils
28 lines
534 B
JavaScript
Executable File
28 lines
534 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
// Show logs
|
|
process.env.DEBUG = process.env.DEBUG || 'nuxt:*'
|
|
|
|
const { join } = require('path')
|
|
const { Utils } = require('..')
|
|
|
|
// Global error handler
|
|
process.on('unhandledRejection', _error => {
|
|
Utils.printError(_error)
|
|
})
|
|
|
|
const defaultCommand = 'dev'
|
|
const commands = new Set([defaultCommand, 'init', 'build', 'start', 'generate'])
|
|
|
|
var cmd = process.argv[2]
|
|
|
|
if (commands.has(cmd)) {
|
|
process.argv.splice(2, 1)
|
|
} else {
|
|
cmd = defaultCommand
|
|
}
|
|
|
|
const bin = join(__dirname, 'nuxt-' + cmd)
|
|
|
|
require(bin)
|