From 06ae3868fe381d2a4771793754600a12689aa4c6 Mon Sep 17 00:00:00 2001 From: Clark Du Date: Thu, 30 Nov 2017 18:24:06 +0800 Subject: [PATCH] feat: add Nuxt.version --- lib/core/nuxt.js | 4 ++++ test/basic.config.defaults.test.js | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/core/nuxt.js b/lib/core/nuxt.js index 072f0f665a..f9a8f00f29 100644 --- a/lib/core/nuxt.js +++ b/lib/core/nuxt.js @@ -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 diff --git a/test/basic.config.defaults.test.js b/test/basic.config.defaults.test.js index e0a14ed0a8..d23ad57a1f 100644 --- a/test/basic.config.defaults.test.js +++ b/test/basic.config.defaults.test.js @@ -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({})