Skip to content

Commit

Permalink
feat: support buildModules
Browse files Browse the repository at this point in the history
  • Loading branch information
dword-design committed Mar 6, 2021
1 parent 135d1ca commit 97ffa2c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default filename => {
if (P.basename(filename) === 'nuxt.config.js') {
babelRegister()
const config = require(filename)
const modules = config.modules || []
const modules = [...(config.modules || []), ...(config.buildModules || [])]
return (
modules
|> map(mod => [].concat(mod) |> first)
Expand Down
28 changes: 22 additions & 6 deletions src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@ export default {
}),
},
},
function: {
buildModules: {
files: {
'nuxt.config.js': endent`
export default {
modules: [
buildModules: [
'foo',
() => {},
],
}
`,
Expand All @@ -65,17 +64,24 @@ export default {
}),
},
},
'unused dependency': {
fail: true,
function: {
files: {
'nuxt.config.js': endent`
export default {
modules: [
'foo',
() => {},
],
}
`,
'package.json': JSON.stringify({
dependencies: {
foo: '^1.0.0',
},
}),
},
},
valid: {
modules: {
files: {
'nuxt.config.js': endent`
export default {
Expand All @@ -91,4 +97,14 @@ export default {
}),
},
},
'unused dependency': {
fail: true,
files: {
'package.json': JSON.stringify({
dependencies: {
foo: '^1.0.0',
},
}),
},
},
} |> mapValues(runTest)

0 comments on commit 97ffa2c

Please sign in to comment.