Permalink
Browse files

feat: add options.ignore support

  • Loading branch information...
pi0 committed Jan 15, 2018
1 parent 47af154 commit 347fa3e9fd878f0aca19cf9e509ff555894f8f86
Showing with 13 additions and 2 deletions.
  1. +2 −2 lib/builder/builder.js
  2. +11 −0 lib/common/options.js
View
@@ -274,7 +274,7 @@ module.exports = class Builder {
if (existsSync(resolve(this.options.srcDir, 'layouts'))) {
const layoutsFiles = await glob('layouts/**/*.{vue,js}', {
cwd: this.options.srcDir,
ignore: [`layouts/**/${this.options.ignorePrefix}*.{vue,js}`]
ignore: this.options.ignore
})
let hasErrorLayout = false
layoutsFiles.forEach(file => {
@@ -316,7 +316,7 @@ module.exports = class Builder {
const files = {}
;(await glob('pages/**/*.{vue,js}', {
cwd: this.options.srcDir,
ignore: [`pages/**/${this.options.ignorePrefix}*.{vue,js}`]
ignore: this.options.ignore
})).forEach(f => {
const key = f.replace(/\.(js|vue)$/, '')
if (/\.vue$/.test(f) || !files[key]) {
View
@@ -119,6 +119,14 @@ Options.from = function (_options) {
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
let modePreset =
Options.modes[options.mode || 'universal'] || Options.modes['universal']
@@ -167,6 +175,9 @@ Options.defaults = {
nuxtAppDir: resolve(__dirname, '../app'),
modulesDir: ['node_modules'], // ~> relative to options.rootDir
ignorePrefix: '-',
ignore: [
'**/*.test.*'
],
extensions: [],
build: {
analyze: false,

0 comments on commit 347fa3e

Please sign in to comment.