UNPKG

mili

Version:

Scaffolding with continuous control over the development of the project.

22 lines (21 loc) 723 B
import * as R from 'ramda'; import Ajv from 'ajv8'; import * as evalstr from 'eval'; import { genEvalContent } from "../util/gen-eval-content"; const ajv = new Ajv(); export const compile = function (dist, src, filepath, resource, options) { if (('schema' in options)) { const validate = ajv.compile(options.schema); const valid = validate(R.fromPairs(Array.from(resource.entries()))); if (valid) return '/dev/null'; } else if (options.eval) { const content = genEvalContent(JSON.stringify(R.fromPairs(Array.from(resource.entries()))), options.eval); if (evalstr(content)) return '/dev/null'; } else { return '/dev/null'; } };