mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 16:12:12 +00:00
feat: add options.ignore support
This commit is contained in:
parent
47af154320
commit
347fa3e9fd
@ -274,7 +274,7 @@ module.exports = class Builder {
|
|||||||
if (existsSync(resolve(this.options.srcDir, 'layouts'))) {
|
if (existsSync(resolve(this.options.srcDir, 'layouts'))) {
|
||||||
const layoutsFiles = await glob('layouts/**/*.{vue,js}', {
|
const layoutsFiles = await glob('layouts/**/*.{vue,js}', {
|
||||||
cwd: this.options.srcDir,
|
cwd: this.options.srcDir,
|
||||||
ignore: [`layouts/**/${this.options.ignorePrefix}*.{vue,js}`]
|
ignore: this.options.ignore
|
||||||
})
|
})
|
||||||
let hasErrorLayout = false
|
let hasErrorLayout = false
|
||||||
layoutsFiles.forEach(file => {
|
layoutsFiles.forEach(file => {
|
||||||
@ -316,7 +316,7 @@ module.exports = class Builder {
|
|||||||
const files = {}
|
const files = {}
|
||||||
;(await glob('pages/**/*.{vue,js}', {
|
;(await glob('pages/**/*.{vue,js}', {
|
||||||
cwd: this.options.srcDir,
|
cwd: this.options.srcDir,
|
||||||
ignore: [`pages/**/${this.options.ignorePrefix}*.{vue,js}`]
|
ignore: this.options.ignore
|
||||||
})).forEach(f => {
|
})).forEach(f => {
|
||||||
const key = f.replace(/\.(js|vue)$/, '')
|
const key = f.replace(/\.(js|vue)$/, '')
|
||||||
if (/\.vue$/.test(f) || !files[key]) {
|
if (/\.vue$/.test(f) || !files[key]) {
|
||||||
|
@ -119,6 +119,14 @@ Options.from = function (_options) {
|
|||||||
options.debug = options.dev
|
options.debug = options.dev
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Normalize ignore
|
||||||
|
options.ignore = options.ignore ? [].concat(options.ignore) : []
|
||||||
|
|
||||||
|
// Append ignorePrefix glob to ignore
|
||||||
|
if (typeof options.ignorePrefix === 'string') {
|
||||||
|
options.ignore.push(`**/${options.ignorePrefix}*.*`)
|
||||||
|
}
|
||||||
|
|
||||||
// Apply mode preset
|
// Apply mode preset
|
||||||
let modePreset =
|
let modePreset =
|
||||||
Options.modes[options.mode || 'universal'] || Options.modes['universal']
|
Options.modes[options.mode || 'universal'] || Options.modes['universal']
|
||||||
@ -167,6 +175,9 @@ Options.defaults = {
|
|||||||
nuxtAppDir: resolve(__dirname, '../app'),
|
nuxtAppDir: resolve(__dirname, '../app'),
|
||||||
modulesDir: ['node_modules'], // ~> relative to options.rootDir
|
modulesDir: ['node_modules'], // ~> relative to options.rootDir
|
||||||
ignorePrefix: '-',
|
ignorePrefix: '-',
|
||||||
|
ignore: [
|
||||||
|
'**/*.test.*'
|
||||||
|
],
|
||||||
extensions: [],
|
extensions: [],
|
||||||
build: {
|
build: {
|
||||||
analyze: false,
|
analyze: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user