mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-13 12:13:10 +00:00
Merge pull request #19 from alibaba/release/material-parser
Release/material parser
This commit is contained in:
commit
12f04cc603
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
> 入料模块
|
> 入料模块
|
||||||
|
|
||||||
本模块负责物料接入,能自动扫描、解析源码组件,并最终产出一份符合 **[《中后台搭建组件描述协议》](https://yuque.antfin-inc.com/rt656r/spec/pbeaqx)** 的 **JSON Schema**。
|
本模块负责物料接入,能自动扫描、解析源码组件,并最终产出一份符合《中后台搭建组件描述协议》的 **JSON Schema**。
|
||||||
|
|
||||||
详见[文档](https://yuque.antfin-inc.com/ali-lowcode/docs/tyktrt)。
|
详见[文档](https://yuque.antfin-inc.com/ali-lowcode/docs/tyktrt)。
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-material-parser",
|
"name": "@alilc/lowcode-material-parser",
|
||||||
"version": "1.0.0-beta.15",
|
"version": "1.0.0",
|
||||||
"description": "material parser for Ali lowCode engine",
|
"description": "material parser for Ali lowCode engine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -8,7 +8,6 @@
|
|||||||
"lib",
|
"lib",
|
||||||
"schemas"
|
"schemas"
|
||||||
],
|
],
|
||||||
"private": true,
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/runtime": "^7.11.2",
|
"@babel/runtime": "^7.11.2",
|
||||||
"@types/debug": "^4.1.5",
|
"@types/debug": "^4.1.5",
|
||||||
|
|||||||
@ -3,8 +3,10 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const Ajv = require('ajv');
|
const Ajv = require('ajv');
|
||||||
const { compile } = require('json-schema-to-typescript');
|
const { compile } = require('json-schema-to-typescript');
|
||||||
|
const { ESLint } = require('eslint');
|
||||||
|
|
||||||
const ajv = new Ajv();
|
const ajv = new Ajv();
|
||||||
|
const eslint = new ESLint({ fix: true });
|
||||||
|
|
||||||
const YamlPath = path.resolve(__dirname, '../schemas/schema.yml');
|
const YamlPath = path.resolve(__dirname, '../schemas/schema.yml');
|
||||||
const JsonPath = path.resolve(__dirname, '../src/validate/schema.json');
|
const JsonPath = path.resolve(__dirname, '../src/validate/schema.json');
|
||||||
@ -19,9 +21,15 @@ const tsPath = path.resolve(__dirname, '../src/core/schema/types.ts');
|
|||||||
console.log('yaml file is successfully transformed into json');
|
console.log('yaml file is successfully transformed into json');
|
||||||
const ts = await compile(schema, 'ComponentMeta');
|
const ts = await compile(schema, 'ComponentMeta');
|
||||||
fs.writeFileSync(tsPath, ts);
|
fs.writeFileSync(tsPath, ts);
|
||||||
console.log('schema.d.ts is successfully generated');
|
// 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) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
Loading…
x
Reference in New Issue
Block a user