Remove buildNamespace in favor of buildDir

This commit is contained in:
Sebastien Chopin 2017-05-30 16:09:36 +02:00
parent 488010bf78
commit 2bb5cca1d5
4 changed files with 5 additions and 8 deletions

View File

@ -110,7 +110,7 @@ export async function build () {
}
}
debug(`App root: ${this.srcDir}`)
debug(`Generating .nuxt/${this.options.build.buildNamespace ? (this.options.build.buildNamespace + '/') : ''} files...`)
debug(`Generating ${this.buildDir} files...`)
// Create .nuxt/, .nuxt/components and .nuxt/dist folders
await remove(r(this.buildDir))
await mkdirp(r(this.buildDir, 'components'))

View File

@ -52,7 +52,7 @@ class Module {
const {dst} = this.addTemplate(template)
// Add to nuxt plugins
this.options.plugins.push({
src: '~/.nuxt/' + dst,
src: path.join(this.nuxt.buildDir, dst),
ssr: template.ssr
})
}

View File

@ -17,6 +17,7 @@ class Nuxt {
constructor (options = {}) {
const defaults = {
dev: true,
buildDir: '.nuxt',
env: {},
head: {
meta: [],
@ -61,9 +62,6 @@ class Nuxt {
watchers: {
webpack: {},
chokidar: {}
},
build: {
buildNamespace: null
}
}
// Sanitization
@ -79,8 +77,7 @@ class Nuxt {
// Explicit srcDir, rootDir and buildDir
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)
this.buildDir = (typeof options.build.buildNamespace === 'string' && options.build.buildNamespace)
? resolve(this.dir, '.nuxt', options.build.buildNamespace) : resolve(this.dir, '.nuxt')
this.buildDir = join(this.dir, options.buildDir)
options.rootDir = this.dir
options.srcDir = this.srcDir
options.buildDir = this.buildDir

View File

@ -26,7 +26,7 @@ test('Vendor', async t => {
})
test('Plugin', async t => {
t.true(nuxt.options.plugins[0].src.startsWith('~/.nuxt/basic.reverse'), 'plugin added to config')
t.true(nuxt.options.plugins[0].src.includes('fixtures/module/.nuxt/basic.reverse.'), 'plugin added to config')
const { html } = await nuxt.renderRoute('/')
t.true(html.includes('<h1>TXUN</h1>'), 'plugin works')
})