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(`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 // Create .nuxt/, .nuxt/components and .nuxt/dist folders
await remove(r(this.buildDir)) await remove(r(this.buildDir))
await mkdirp(r(this.buildDir, 'components')) await mkdirp(r(this.buildDir, 'components'))

View File

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

View File

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

View File

@ -26,7 +26,7 @@ test('Vendor', async t => {
}) })
test('Plugin', 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('/') const { html } = await nuxt.renderRoute('/')
t.true(html.includes('<h1>TXUN</h1>'), 'plugin works') t.true(html.includes('<h1>TXUN</h1>'), 'plugin works')
}) })