UNPKG

637 BPlain TextView Raw
1#!/usr/bin/env node
2
3var join = require('path').join
4var spawn = require('cross-spawn').spawn
5
6var defaultCommand = 'dev'
7var commands = new Set([
8 defaultCommand,
9 'init',
10 'build',
11 'start',
12 'generate'
13])
14
15var cmd = process.argv[2]
16var args
17
18if (commands.has(cmd)) {
19 args = process.argv.slice(3)
20} else {
21 cmd = defaultCommand
22 args = process.argv.slice(2)
23}
24
25var bin = join(__dirname, 'nuxt-' + cmd)
26
27var proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] })
28proc.on('close', (code) => process.exit(code))
29proc.on('error', (err) => {
30 console.error(err) // eslint-disable-line no-console
31 process.exit(1)
32})