Nuxt/distributions/nuxt-ts/bin/nuxt-ts.js

20 lines
627 B
JavaScript
Raw Normal View History

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