1 | const joi = require('joi')
|
2 |
|
3 | const schema = joi.object().keys({
|
4 | entry: joi.string(),
|
5 | outDir: joi.string(),
|
6 | fsRoutes: joi.alternatives().try([
|
7 | joi.object().keys({
|
8 | baseDir: joi.string(),
|
9 | basePath: joi.string(),
|
10 | match: joi.object().type(RegExp)
|
11 | }),
|
12 | joi.boolean()
|
13 | ]),
|
14 | transpileDependencies: joi.array().items(joi.string()),
|
15 | runtimeCompiler: joi.boolean(),
|
16 | productionSourceMap: joi.boolean(),
|
17 | chainWebpack: joi.func(),
|
18 | configureWebpack: joi.alternatives().try(joi.object(), joi.func()),
|
19 | server: joi.object().keys({
|
20 | port: joi.number(),
|
21 | host: joi.string()
|
22 | }),
|
23 | plugins: joi.array().items(
|
24 | joi.object().keys({
|
25 | name: joi.string().required(),
|
26 | apply: joi.func().required()
|
27 | })
|
28 | ),
|
29 | generate: joi.object().keys({
|
30 | routes: joi.array().items(joi.string())
|
31 | }),
|
32 | css: joi.object().keys({
|
33 | extract: joi.boolean()
|
34 | }),
|
35 |
|
36 |
|
37 | pwa: joi.boolean(),
|
38 | minimize: joi.boolean(),
|
39 | defaultBabelPreset: joi.any().valid(['minimal', false]),
|
40 | minifyHtml: joi.alternatives().try(joi.object(), joi.boolean())
|
41 | })
|
42 |
|
43 | module.exports = config => {
|
44 | return schema.validate(config, {
|
45 | convert: false
|
46 | })
|
47 | }
|