GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — lowcode-engine/modules/material-parser/scripts/transform.js at main · live0717/lowcode-engine Expand file tree/ Copy pathtransform.jsMore file actions 35 lines (30 loc) · 1.18 KB / Copy pathtransform.jsFile metadata and controls35 lines (30 loc) · 1.18 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 const yaml = require('js-yaml'); const fs = require('fs'); const path = require('path'); const Ajv = require('ajv'); const { compile } = require('json-schema-to-typescript'); const { ESLint } = require('eslint'); const ajv = new Ajv(); const eslint = new ESLint({ fix: true }); const YamlPath = path.resolve(__dirname, '../schemas/schema.yml'); const JsonPath = path.resolve(__dirname, '../src/validate/schema.json'); const tsPath = path.resolve(__dirname, '../src/core/schema/types.ts'); // Get document, or throw exception on error (async function () { try { const schema = yaml.load(fs.readFileSync(YamlPath, 'utf8')); ajv.compile(schema); fs.writeFileSync(JsonPath, JSON.stringify(schema, null, 2), 'utf-8'); console.log('yaml file is successfully transformed into json'); const ts = await compile(schema, 'ComponentMeta'); fs.writeFileSync(tsPath, ts); // Lint files. This doesn't modify target files. const results = await eslint.lintFiles([tsPath]); // Modify the files with the fixed code. await ESLint.outputFixes(results); console.log('schema/types.d.ts is successfully generated'); } catch (e) { console.log(e); process.exit(1); } })(); |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |