feat: add Nuxt.version

This commit is contained in:
Clark Du 2017-11-30 18:24:06 +08:00 committed by Pooya Parsa
parent b9268df91b
commit 06ae3868fe
2 changed files with 10 additions and 1 deletions

View File

@ -44,6 +44,10 @@ export default class Nuxt {
this._ready = this.ready().catch(this.errorHandler)
}
static get version() {
return '__VERSION__'
}
async ready() {
if (this._ready) {
return this._ready

View File

@ -1,6 +1,11 @@
import test from 'ava'
import { resolve } from 'path'
import { Options } from '../index'
import { Nuxt, Options } from '../index'
import { version } from '../package.json'
test('Nuxt.version is same as package', t => {
t.is(Nuxt.version, version)
})
test('modulesDir uses /node_modules as default if not set', async t => {
const options = Options.from({})