@sanpjs/generator
Version:
@sanpjs/generator
103 lines • 2.86 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const schema_utils_1 = require("schema-utils");
const schema = {
type: 'object',
properties: {
configFile: {
anyOf: [
{
type: 'string'
},
{
type: 'boolean'
}
]
},
outputDir: {
type: 'string'
},
templateDir: {
type: 'string'
},
lodashTemplateSettings: {
type: 'object'
},
templateVars: {
type: 'object'
},
before: {
instanceof: 'Function'
},
after: {
instanceof: 'Function'
},
actions: {
type: 'array',
items: {
type: 'object',
properties: {
type: {
type: 'string',
enum: ['add', 'modify', 'move', 'remove']
},
files: {
anyOf: [
{
type: 'string'
},
{
type: 'array',
items: { type: 'string' }
},
{
instanceof: 'Function'
}
]
},
filters: {
type: 'object'
},
patterns: {
anyOf: [
{
type: 'object'
},
{
instanceof: 'Function'
}
]
},
handler: {
instanceof: 'Function'
},
templateDir: {
type: 'string'
},
outputDir: {
type: 'string'
},
templateVars: {
type: 'object'
},
cwdbase: {
type: 'boolean'
}
},
additionalProperties: true
}
}
},
additionalProperties: false
};
/**
* 校验参数
* @param {Object} options 校验参数
*/
exports.default = (options) => {
// @ts-ignore
(0, schema_utils_1.validate)(schema, options, {
baseDataPath: 'generator config',
});
};
//# sourceMappingURL=validate.js.map