2019-01-04 19:30:28 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
2019-01-28 13:29:13 +00:00
|
|
|
const { resolve } = require('path')
|
|
|
|
|
2019-01-04 21:10:18 +00:00
|
|
|
// Globally indicate we are running in ts mode
|
2019-01-04 19:30:28 +00:00
|
|
|
process.env.NUXT_TS = 'true'
|
|
|
|
|
2019-01-24 10:54:00 +00:00
|
|
|
const nuxtCommands = ['dev', 'build', 'generate', 'start']
|
|
|
|
const rootDir = (process.argv[2] && !nuxtCommands.includes(process.argv[2])) ? process.argv[2] : process.cwd()
|
2019-01-28 13:29:13 +00:00
|
|
|
const tsConfigPath = resolve(rootDir, 'tsconfig.json')
|
2019-01-04 19:30:28 +00:00
|
|
|
|
2019-01-04 21:10:18 +00:00
|
|
|
const suffix = require('../package.json').name.includes('-edge') ? '-edge' : ''
|
2019-01-23 09:53:52 +00:00
|
|
|
|
2019-02-25 20:09:26 +00:00
|
|
|
const errorHandler = (error) => {
|
2019-01-23 09:53:52 +00:00
|
|
|
require('consola').fatal(error)
|
|
|
|
process.exit(2)
|
2019-02-25 20:09:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
require('@nuxt/typescript' + suffix).setup(tsConfigPath).then(() => {
|
|
|
|
require('@nuxt/cli' + suffix).run().catch(errorHandler)
|
|
|
|
}).catch(errorHandler)
|