Explicit srcDir and rootDir

This makes dir and srcDir consistent and explicitly defined in both places.
This commit is contained in:
Pooya Parsa 2017-05-11 14:18:09 +04:30
parent ffefa6d724
commit 252e5cce0a

View File

@ -68,8 +68,11 @@ class Nuxt {
this.options = _.defaultsDeep(options, defaults)
// Env variables
this.dev = this.options.dev
// Explicit srcDir and rootDir
this.dir = (typeof options.rootDir === 'string' && options.rootDir ? options.rootDir : process.cwd())
this.srcDir = (typeof options.srcDir === 'string' && options.srcDir ? resolve(this.dir, options.srcDir) : this.dir)
options.rootDir = this.dir
options.srcDir = this.srcDir
// If store defined, update store options to true
if (fs.existsSync(join(this.srcDir, 'store'))) {
this.options.store = true