Merge branch 'develop' into release/1.0.1-beta

This commit is contained in:
LeoYuan 袁力皓 2022-02-18 19:48:23 +08:00
commit a76618c858
27 changed files with 138 additions and 293 deletions

19
.github/workflows/stale.yml vendored Normal file
View File

@ -0,0 +1,19 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 1 * * *'
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
with:
stale-issue-message: 'This issue is stale because it has been open 10 days with no activity. Remove stale label or comment or this will be closed in 2 days.'
stale-pr-message: 'This PR is stale because it has been open 10 days with no activity. Remove stale label or comment or this will be closed in 2 days.'
close-issue-message: 'This issue was closed because it has been stalled for 10 days with no activity.'
close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.'
days-before-issue-stale: 10
days-before-issue-close: 2
days-before-pr-stale: 10
days-before-pr-close: 2

36
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,36 @@
name: lint & test
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: install
run: npm i && npm run setup:skip-build
- name: lint
run: npm run lint
test-designer:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: install
run: npm i && npm run setup:skip-build
- name: test
run: cd packages/designer && npm test

View File

@ -2,6 +2,8 @@
- [albertxiao1994](https://github.com/albertxiao1994)
- [alex-mm](https://github.com/alex-mm)
- [alvarto](https://github.com/alvarto)
- [alvinhui](https://github.com/alvinhui)
- [boycgit](https://github.com/boycgit)
- [chenmingjia](https://github.com/chenmingjia)
- [Clarence-pan](https://github.com/Clarence-pan)
- [hujiulong](https://github.com/hujiulong)
@ -18,6 +20,7 @@
- [mochen666](https://github.com/mochen666)
- [tsy77](https://github.com/tsy77)
- [Ychangqing](https://github.com/Ychangqing)
- [yize](https://github.com/yize)
- [youluna](https://github.com/youluna)
如果您贡献过低代码引擎,但是没有看到您的名字,为我们的疏忽感到抱歉。欢迎您通过 PR 补充上自己的名字。
如果您贡献过低代码引擎,但是没有看到您的名字,为我们的疏忽感到抱歉。欢迎您通过 PR 补充上自己的名字。

145
README.md
View File

@ -1,145 +0,0 @@
<p align="center">
<a href="http://lowcode-engine.cn">
<img width="200" src="https://img.alicdn.com/imgextra/i3/O1CN01i8K9cD1d0HU7TjDtv_!!6000000003673-2-tps-500-591.png">
</a>
</p>
<h1 align="center">LowCodeEngine</h1>
<div align="center">
一套面向扩展设计的企业级低代码技术体系
[![NPM version][npm-image]][npm-url] [![NPM downloads][download-image]][download-url]
[![Discussions][discussions-image]][discussions-url] [![][issues-helper-image]][issues-helper-url] [![Issues need help][help-wanted-image]][help-wanted-url]
[npm-image]: https://img.shields.io/npm/v/@alilc/lowcode-engine.svg?style=flat-square
[npm-url]: http://npmjs.org/package/@alilc/lowcode-engine
[download-image]: https://img.shields.io/npm/dm/@alilc/lowcode-engine.svg?style=flat-square
[download-url]: https://npmjs.org/package/@alilc/lowcode-engine
[help-wanted-image]: https://flat.badgen.net/github/label-issues/alibaba/lowcode-engine/help%20wanted/open
[help-wanted-url]: https://github.com/alibaba/lowcode-engine/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22
[discussions-image]: https://img.shields.io/badge/discussions-on%20github-blue?style=flat-square
[discussions-url]: https://github.com/alibaba/lowcode-engine/discussions
[issues-helper-image]: https://img.shields.io/badge/using-issues--helper-orange?style=flat-square
[issues-helper-url]: https://github.com/actions-cool/issues-helper
</div>
[![](https://img.alicdn.com/imgextra/i4/O1CN01GhzQuE1rnenyCCQTF_!!6000000005676-0-tps-2878-1588.jpg)](http://lowcode-engine.cn)
## ✨ 特性
- 🌈 提炼自企业级低代码平台的面向扩展开发的内核引擎,奉行最小内核,最强生态的设计理念
- 📦 开箱即用的高质量生态元素,包括 物料体系、设置器、插件 等
- ⚙️ 完善的工具链,支持 物料体系、设置器、插件 等生态元素的全链路研发周期
- 🔌 强大的扩展能力,已支撑近 100 个各种垂直类低代码平台
- 🛡 使用 TypeScript 开发,提供完整的类型定义文件
## 🎯 兼容环境
- 现代浏览器Chrome >= 80, Edge >= 80, last 2 safari versions, last 2 firefox versions
## 📚 引擎协议
引擎完整实现了《阿里巴巴中后台前端基础搭建协议规范》和《阿里巴巴中后台前端物料协议规范》,协议栈是低代码领域的物料能否流通的关键部分。
![image](https://user-images.githubusercontent.com/1195765/150266126-fef3e3a9-d6a4-4f8e-8592-745f1a344162.png)
## 🌰 使用示例
```bash
npm install @alilc/lowcode-engine --save-dev
```
> **TIPS仅支持 cdn 方式引入npm 包用于提供 typings 等代码提示能力**
```ts
import { init, skeleton } from '@alilc/lowcode-engine';
skeleton.add({
area: 'topArea',
type: 'Widget',
name: 'logo',
content: YourFantaticLogo,
contentProps: {
logo:
'https://img.alicdn.com/tfs/TB1_SocGkT2gK0jSZFkXXcIQFXa-66-66.png',
href: '/',
},
props: {
align: 'left',
width: 100,
},
});
init(document.getElementById('lce'));
```
### 工程化配置:
```json
{
"externals": {
"@alilc/lowcode-engine": "var window.AliLowCodeEngine",
"@alilc/lowcode-engine-ext": "var window.AliLowCodeEngineExt"
}
}
```
### cdn 可选方式:
#### 方式 1alifd cdn
```html
https://alifd.alicdn.com/npm/@alilc/lowcode-engine@1.0.0/dist/js/engine-core.js
https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@1.0.0/dist/js/react-simulator-renderer.js
```
#### 方式 2unpkg
```html
https://unpkg.com/@alilc/lowcode-engine@1.0.0/dist/js/engine-core.js
https://unpkg.com/@alilc/lowcode-react-simulator-renderer@1.0.0/dist/js/react-simulator-renderer.js
```
#### 方式 3jsdelivr
```html
https://cdn.jsdelivr.net/npm/@alilc/lowcode-engine@1.0.0/dist/js/engine-core.js
https://cdn.jsdelivr.net/npm/@alilc/lowcode-react-simulator-renderer@1.0.0/dist/js/react-simulator-renderer.js
```
#### 方式 3使用自有 cdn
将源码中 packages/engine/dist 和 packages/(react|rax)-simulator-renderer/dist 下的文件传至你的 cdn 提供商
## 🔗 链接
- [官网首页 WIP](http://lowcode-engine.cn/)
- [官方物料 WIP](http://lowcode-engine.cn/)
- [官方设置器setterWIP](http://lowcode-engine.cn/)
- [官方插件pluginWIP](http://lowcode-engine.cn/)
- [用户文档 WIP](http://lowcode-engine.cn/)
- [贡献指南 WIP](http://lowcode-engine.cn/)
- [更新日志](CHANGELOG..md)
## 💻 本地调试
```bash
$ git clone git@github.com:alibaba/lowcode-engine.git
$ cd lowcode-engine
$ npm install
$ npm run setup
$ npm start
```
> 📢 npm 访问速度较慢,阿里员工可以使用 tnpm其他同学建议使用 cnpm 或者指定镜像 registry。
lowcode-engine 启动后,提供了几个 umd 文件,可以结合 [lowcode-demo](https://github.com/alibaba/lowcode-demo) 项目做调试,文件代理规则参考这里。
## 🤝 参与共建
请先阅读 [贡献指南 WIP](http://lowcode-engine.cn/?docs#/doc?url=contributing).
> 强烈推荐阅读 [《提问的智慧》](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way)、[《如何向开源社区提问题》](https://github.com/seajs/seajs/issues/545) 和 [《如何有效地报告 Bug》](http://www.chiark.greenend.org.uk/%7Esgtatham/bugs-cn.html)、[《如何向开源项目提交无法解答的问题》](https://zhuanlan.zhihu.com/p/25795393),更好的问题更容易获得帮助。

1
README.md Symbolic link
View File

@ -0,0 +1 @@
packages/engine/README.md

View File

@ -2,104 +2,9 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [1.0.0-beta.20](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/compare/@alilc/lowcode-code-generator@1.0.0-beta.19...@alilc/lowcode-code-generator@1.0.0-beta.20) (2022-02-14)
### Bug Fixes
* 🐛 解决 standalone 入口的类型定义找不到的问题 ([ea735b0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/ea735b0422f26f4fdde4989478b308c22bae8f07))
## [1.0.0-beta.19](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/compare/@alilc/lowcode-code-generator@1.0.0-beta.18...@alilc/lowcode-code-generator@1.0.0-beta.19) (2022-02-14)
### Bug Fixes
* 🐛 补充自定义出码方案中缺失的示例插件文件 ([b583421](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/b5834214482ba73dc33753aed9e1166bca4b7374))
* 🐛 解决 init-solution 命令生成的 demo-schema.json 格式非法的问题 ([b090732](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/b090732cb750aa60dfe9c7e34dd6709bfd537642))
## [1.0.0-beta.18](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/compare/@alilc/lowcode-code-generator@1.0.0-beta.16...@alilc/lowcode-code-generator@1.0.0-beta.18) (2022-02-14)
## 1.0.0 (2022-02-17)
### Features
* 插件版本号校验 ([b22ae6a](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/b22ae6a75065e0c4dfa290c7b8c4ec4c7e661b53))
* 插件版本号校验,调整判断条件 ([2cf2182](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/2cf218245812825aa729657a9b1ac4b574d75cb5))
* 增加 setKey / rerender 几个 API, shell node 单例化 ([e7999fa](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/e7999faf78ec22395f218aab22e7accc18ad9b53))
* add contributor list ([9368ea4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/9368ea46bd4b1eaae0848d51780d8a0896384875))
### Bug Fixes
* 🐛 解决通过命令行初始化自定义出码方案的时候报错的问题 ([ca6daff](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/ca6daff89498056b0248e3996edfee75379881ac))
* 🐛 解决通过命令行方式使用出码模块的时候报错的问题 ([da3f301](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/da3f3011d3ea34f59f0f3d6bd230fcfa436be103))
* 处理遗留下来的 todo ([67c20a9](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/67c20a993d44d6b2353eec6aab94636c1b2328b6))
* 单测问题修复 ([b940fc2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/b940fc215737936267d2a3a202c7269695293060))
* 调整 slot 默认关闭逻辑 ([0c0cd84](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/0c0cd8452cef94afc3afe025b9ce54a18274f5a4))
* cr问题修复 ([a27f5aa](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/a27f5aaf73dd884051714a98d85644a9a0b6d69b))
## [1.0.0-beta.17](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/compare/@alilc/lowcode-code-generator@1.0.0-beta.16...@alilc/lowcode-code-generator@1.0.0-beta.17) (2022-02-14)
### Features
* 插件版本号校验 ([b22ae6a](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/b22ae6a75065e0c4dfa290c7b8c4ec4c7e661b53))
* 插件版本号校验,调整判断条件 ([2cf2182](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/2cf218245812825aa729657a9b1ac4b574d75cb5))
* 增加 setKey / rerender 几个 API, shell node 单例化 ([e7999fa](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/e7999faf78ec22395f218aab22e7accc18ad9b53))
* add contributor list ([9368ea4](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/9368ea46bd4b1eaae0848d51780d8a0896384875))
### Bug Fixes
* 🐛 解决通过命令行初始化自定义出码方案的时候报错的问题 ([ca6daff](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/ca6daff89498056b0248e3996edfee75379881ac))
* 🐛 解决通过命令行方式使用出码模块的时候报错的问题 ([da3f301](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/da3f3011d3ea34f59f0f3d6bd230fcfa436be103))
* 处理遗留下来的 todo ([67c20a9](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/67c20a993d44d6b2353eec6aab94636c1b2328b6))
* 单测问题修复 ([b940fc2](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/b940fc215737936267d2a3a202c7269695293060))
* 调整 slot 默认关闭逻辑 ([0c0cd84](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/0c0cd8452cef94afc3afe025b9ce54a18274f5a4))
* cr问题修复 ([a27f5aa](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/a27f5aaf73dd884051714a98d85644a9a0b6d69b))
## [1.0.0-beta.16](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/compare/@alilc/lowcode-code-generator@1.0.0-beta.15...@alilc/lowcode-code-generator@1.0.0-beta.16) (2022-02-07)
### Features
* 🎸 升级 @alilc/lowcode-types ([71f9c6c](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/71f9c6c88f55f3e176e5bd40ddf4593a24ad3aea))
* 补充 node#isEmpty ([e8229b8](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/e8229b89dbdf1b93d529f2534ec9bf1fd25c2566))
* 调整插件依赖配置位置 ([655b597](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/655b5976ac2a310bb679a06f418a154ccefd9d56))
* 增加 setting-prop-entry#getDefaultValue ([3e43cd3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/3e43cd3af9c213b2b7694b6204b509850e786749))
* 增设计模式作为是否使用循环判断的条件 & NotFoundComponent 组件新增 __componentName 属性 ([06f86de](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/06f86deef7bb88249c54731df9f2deb374443d21))
* add preference declaration control to plugin ([2256156](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/22561563451dc565a2aea930d0679fe528520513))
### Bug Fixes
* 🐛 解决出码模块在 node 环境中使用时 zip publisher 不能正确识别为 node 环境的问题 ([ffa9908](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/ffa9908365fbe6fa5230c6f890cebf4fb44a7188))
* 🐛 解决通过 npm 安装并测试的时候一堆报错问题 ([7245617](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/7245617da2bae55e67e4dff5eeda6c14981fdd4b))
* 🐛 修正 icejs 模板中的 abc.json 的 builder ([e63cf7a](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/e63cf7affb0bf7f072d965bda3c8dd90cf015e2d))
* 根据新的插件 pluginName 修改代码 ([1faed05](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/1faed05dab26674b84ab0f065263b9ad9aeade46))
* 兼容 arraysetter 场景 ([f462f3d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/f462f3de172d3d05db38234db982c58f5e6321ee))
* 修复 getResizingHandlers 回调参数没有转换的问题 ([2e6c51d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/2e6c51d9cb0835791889656b3b9709a9a6cd630d))
## [1.0.0-beta.15](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/compare/@alilc/lowcode-code-generator@1.0.0-beta.14...@alilc/lowcode-code-generator@1.0.0-beta.15) (2022-01-19)
### Bug Fixes
* 🐛 修正 standalone-worker 的默认地址 ([f477372](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/f477372f8c2432d6300b39b82e73cdfe4cf25f8d))
## 1.0.0-beta.14 (2022-01-19)
### Features
* 补充 dragon 以及部分代码优化 ([595478a](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/595478a7cb2d1288450920404bd79bf0b7fa4424))
* 补充 setting-prop-entry#getPropValue 值 ([224acbf](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/224acbff2c8a949d4cda01f2371d6a7ba0b8df4d))
* 补充几个 API 以及调整为 umd 导出 AliLowCodeEngine ([b56debc](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/b56debc9b7cb78a5a049291d9079292a32e85d20))
* 出码模块支持 standalone 模式 ([f1fb35a](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/f1fb35a1c39ebff3d1ddb28262ac556dbd249df3))
* 第一版 readme ([db42cb5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/db42cb529a27f58a42cda4f9c33107f4d24abc23))
* setting-prop-entry 增加一个 API ([6c1fdc3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/6c1fdc35828cdf0133846454c0a33708dc606d9a))
### Bug Fixes
* 修正命令行的位置 ([eb046c0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/eb046c0fd5983105e2d93fbc1c53b6b08935f66f))
* less-variables ([15cccd6](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine-2.x/commit/15cccd6892e375c7d83719aed416e3a320bcd931))
* first commit - genesis ([4f4ac51](https://github.com/alibaba/lowcode-engine/commit/4f4ac5115d18357a7399632860808f6cffc33fad))

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-code-generator",
"version": "1.0.0-beta.20",
"version": "1.0.0",
"description": "出码引擎 for LowCode Engine",
"license": "MIT",
"main": "lib/index.js",
@ -56,7 +56,7 @@
"**/*.{js,jsx,ts,tsx}": "eslint"
},
"dependencies": {
"@alilc/lowcode-types": "^1.0.0-beta.19",
"@alilc/lowcode-types": "^1.0.0",
"@babel/generator": "^7.12.11",
"@babel/parser": "^7.12.11",
"@babel/runtime": "^7.12.5",

View File

@ -53,7 +53,6 @@ export function flattenResult(dir: ResultDir, cwd = ''): FlattenFile[] {
),
].concat(
...dir.dirs.map((subDir) =>
flattenResult(subDir, [cwd, subDir.name].filter((x) => x !== '' && x !== '.').join('/')),
),
flattenResult(subDir, [cwd, subDir.name].filter((x) => x !== '' && x !== '.').join('/'))),
);
}

View File

@ -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)。

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-material-parser",
"version": "1.0.0-beta.15",
"version": "1.0.0",
"description": "material parser for Ali lowCode engine",
"main": "lib/index.js",
"module": "es/index.js",
@ -8,7 +8,6 @@
"lib",
"schemas"
],
"private": true,
"devDependencies": {
"@babel/runtime": "^7.11.2",
"@types/debug": "^4.1.5",

View File

@ -3,8 +3,10 @@ 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');
@ -19,9 +21,15 @@ const tsPath = path.resolve(__dirname, '../src/core/schema/types.ts');
console.log('yaml file is successfully transformed into json');
const ts = await compile(schema, 'ComponentMeta');
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) {
console.log(e);
process.exit(1);
}
})();
})();

View File

@ -50,6 +50,7 @@ export function resolveToImport(initialPath) {
}
pathBuffer.unshift(...paths);
}
// eslint-disable-next-line no-fallthrough
case 'Identifier':
case 'JSXIdentifier': {
const valuePath = resolveToValue(path);

View File

@ -25,6 +25,7 @@ export default function getComposedPropTypesPath(documentation, propName, p) {
const ast = parser.parse(fileContent);
visit(ast, {
// eslint-disable-next-line no-loop-func
visitAssignmentExpression(path: any) {
// Ignore anything that is not `exports.X = ...;` or
// `module.exports = ...;`

View File

@ -299,8 +299,7 @@ function getDocgenTypeHelper(
name: 'union',
// @ts-ignore
value: type.types.map((t) =>
getDocgenTypeHelper(checker, t, true, getNextParentIds(parentIds, type)),
),
getDocgenTypeHelper(checker, t, true, getNextParentIds(parentIds, type))),
});
} else if (isComplexType(type)) {
return makeResult({
@ -494,8 +493,7 @@ export default function parseTS(filePath: string, args: IParseArgs): ComponentDo
log('ts config path is', tsConfigPath);
const { config, error } = ts.readConfigFile(tsConfigPath, (filename) =>
readFileSync(filename, 'utf8'),
);
readFileSync(filename, 'utf8'));
if (error !== undefined) {
const errorText = `Cannot load custom tsconfig.json from provided path: ${tsConfigPath}, with error code: ${error.code}, message: ${error.messageText}`;

View File

@ -1,13 +1,16 @@
const esModules = ['@recore/obx-react'].join('|');
const fs = require('fs');
const { join } = require('path');
const esModules = ['zen-logger'].join('|');
const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.'));
module.exports = {
const jestConfig = {
// transform: {
// '^.+\\.[jt]sx?$': 'babel-jest',
// // '^.+\\.(ts|tsx)$': 'ts-jest',
// // '^.+\\.(js|jsx)$': 'babel-jest',
// },
// testMatch: ['**/document/node/node.test.ts'],
// testMatch: ['**/designer/bultin-hotkey.test.ts'],
// testMatch: ['**/designer/builtin-hotkey.test.ts'],
// testMatch: ['**/plugin/plugin-manager.test.ts'],
// testMatch: ['(/tests?/.*(test))\\.[jt]s$'],
transformIgnorePatterns: [
@ -32,3 +35,9 @@ module.exports = {
'!**/vendor/**',
],
};
// 只对本仓库内的 pkg 做 mapping
jestConfig.moduleNameMapper = {};
jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src';
module.exports = jestConfig;

View File

@ -1,3 +1,4 @@
import '../fixtures/window';
import { ActiveTracker } from '../../src/designer/active-tracker';
it('ActiveTracker 测试Node', () => {

View File

@ -2,6 +2,7 @@ import '../fixtures/window';
import { Editor, globalContext } from '@alilc/lowcode-editor-core';
import { Designer } from '../../src/designer/designer';
import formSchema from '../fixtures/schema/form';
import '../../src/designer/builtin-hotkey';
import { fireEvent } from '@testing-library/react';
const editor = new Editor();
@ -242,49 +243,50 @@ describe('快捷键测试', () => {
expect(designer.currentDocument?.selection.selected[0]).toBe('page');
});
it('isFormEvent: true', () => {
const inputDOMNode = document.createElement('INPUT');
designer.currentDocument?.selection.select('page');
// nothing happened
fireEvent.keyDown(document, { keyCode: 39 });
fireEvent.keyDown(inputDOMNode, { keyCode: 39 });
expect(designer.currentDocument?.selection.selected[0]).toBe('page');
fireEvent.keyDown(document, { keyCode: 37 });
fireEvent.keyDown(inputDOMNode, { keyCode: 37 });
expect(designer.currentDocument?.selection.selected[0]).toBe('page');
fireEvent.keyDown(document, { keyCode: 40 });
fireEvent.keyDown(inputDOMNode, { keyCode: 40 });
expect(designer.currentDocument?.selection.selected[0]).toBe('page');
fireEvent.keyDown(document, { keyCode: 38 });
fireEvent.keyDown(inputDOMNode, { keyCode: 38 });
expect(designer.currentDocument?.selection.selected[0]).toBe('page');
fireEvent.keyDown(document, { keyCode: 39, altKey: true });
fireEvent.keyDown(inputDOMNode, { keyCode: 39, altKey: true });
expect(designer.currentDocument?.selection.selected[0]).toBe('page');
fireEvent.keyDown(document, { keyCode: 37, altKey: true });
fireEvent.keyDown(inputDOMNode, { keyCode: 37, altKey: true });
expect(designer.currentDocument?.selection.selected[0]).toBe('page');
fireEvent.keyDown(document, { keyCode: 40, altKey: true });
fireEvent.keyDown(inputDOMNode, { keyCode: 40, altKey: true });
expect(designer.currentDocument?.selection.selected[0]).toBe('page');
fireEvent.keyDown(document, { keyCode: 38, altKey: true });
fireEvent.keyDown(inputDOMNode, { keyCode: 38, altKey: true });
expect(designer.currentDocument?.selection.selected[0]).toBe('page');
fireEvent.keyDown(document, { keyCode: 90, metaKey: true });
fireEvent.keyDown(inputDOMNode, { keyCode: 90, metaKey: true });
expect(designer.currentDocument?.selection.selected[0]).toBe('page');
fireEvent.keyDown(document, { keyCode: 89, metaKey: true });
fireEvent.keyDown(inputDOMNode, { keyCode: 89, metaKey: true });
expect(designer.currentDocument?.selection.selected[0]).toBe('page');
fireEvent.keyDown(document, { keyCode: 67, metaKey: true });
fireEvent.keyDown(inputDOMNode, { keyCode: 67, metaKey: true });
expect(designer.currentDocument?.selection.selected[0]).toBe('page');
fireEvent.keyDown(document, { keyCode: 86, metaKey: true });
fireEvent.keyDown(inputDOMNode, { keyCode: 86, metaKey: true });
expect(designer.currentDocument?.selection.selected[0]).toBe('page');
fireEvent.keyDown(document, { keyCode: 27 });
fireEvent.keyDown(inputDOMNode, { keyCode: 27 });
expect(designer.currentDocument?.selection.selected[0]).toBe('page');
fireEvent.keyDown(document, { keyCode: 46 });
fireEvent.keyDown(inputDOMNode, { keyCode: 46 });
expect(designer.currentDocument?.selection.selected[0]).toBe('page');
});
});

View File

@ -75,7 +75,8 @@ describe('setting-prop-entry 测试', () => {
const prop1 = mockTopEntry.getProp('a');
prop1.extraProps = {
getValue: (prop, val) => `prefix ${val}`,
setValue: (prop, val) => { prop.setValue(`modified ${val}`, false, false, { disableMutator: true }) },
// prop 是 shell prop entry
setValue: (prop, val) => { prop.setValue(`modified ${val}`, { disableMutator: true }) },
defaultValue: 'default',
};

View File

@ -18,5 +18,5 @@ Object.defineProperty(window, 'React', {
});
window.scrollTo = () => {};
window.console.warn = () => {};
window.React = window.React || {};

View File

@ -37,6 +37,7 @@ export declare interface Editor extends StrictEventEmitter<EventEmitter, GlobalE
getPreference(): Preference;
}
// eslint-disable-next-line no-redeclare
export class Editor extends (EventEmitter as any) implements IEditor {
/**
* Ioc Container

View File

@ -28,11 +28,11 @@ window.__newFunc = (funContext: string): ((...args: any[]) => any) => {
};
// 关闭浏览器前提醒,只有产生过交互才会生效
window.onbeforeunload = function (e: Event): string | void {
window.onbeforeunload = function (e: Event): string {
const ev = e || window.event;
// 本地调试不生效
if (location.href.indexOf('localhost') > 0) {
return;
return '';
}
const msg = '您确定要离开此页面吗?';
ev.cancelBubble = true;

View File

@ -2,6 +2,6 @@ import Logger, { Level } from 'zen-logger';
export { Logger };
export function getLogger(config: { level: Level, bizName: string }): Logger {
export function getLogger(config: { level: Level; bizName: string }): Logger {
return new Logger(config);
}

View File

@ -16,7 +16,7 @@ export default class Preference {
return `${STORAGE_KEY_PREFIX}_${moduleKey}.${key}`;
}
set(key: string, value:any, module?: string) {
set(key: string, value: any, module?: string) {
if (!key || typeof key !== 'string' || key.length === 0) {
logger.error('Invalid key when setting preference', key);
return;
@ -26,7 +26,7 @@ export default class Preference {
store.set(storageKey, value);
}
get(key: string, module: string) : any {
get(key: string, module: string): any {
if (!key || typeof key !== 'string' || key.length === 0) {
logger.error('Invalid key when getting from preference', key);
return;
@ -44,7 +44,7 @@ export default class Preference {
* @returns {boolean}
* @memberof Preference
*/
contains(key: string, module: string) : boolean {
contains(key: string, module: string): boolean {
if (!key || typeof key !== 'string' || key.length === 0) {
logger.error('Invalid key when getting from preference', key);
return false;

View File

@ -120,9 +120,8 @@ https://cdn.jsdelivr.net/npm/@alilc/lowcode-react-simulator-renderer@1.0.0/dist/
- [官方物料 WIP](http://lowcode-engine.cn/)
- [官方设置器setterWIP](http://lowcode-engine.cn/)
- [官方插件pluginWIP](http://lowcode-engine.cn/)
- [用户文档 WIP](http://lowcode-engine.cn/)
- [贡献指南 WIP](http://lowcode-engine.cn/)
- [更新日志](CHANGELOG..md)
- [用户文档 WIP](http://lowcode-engine.cn/#/doc)
- [更新日志](http://lowcode-engine.cn/#/doc?url=engine-changelog)
## 💻 本地调试
@ -135,11 +134,18 @@ $ npm start
```
> 📢 npm 访问速度较慢,阿里员工可以使用 tnpm其他同学建议使用 cnpm 或者指定镜像 registry。
>
> ❕node 版本限制在 14
>
> ❕windows 环境尽量使用 [WSL](https://docs.microsoft.com/zh-cn/windows/wsl/install)
lowcode-engine 启动后,提供了几个 umd 文件,可以结合 [lowcode-demo](https://github.com/alibaba/lowcode-demo) 项目做调试,文件代理规则参考这里。
## 🤝 参与共建
请先阅读 [贡献指南 WIP](http://lowcode-engine.cn/?docs#/doc?url=contributing).
请先阅读:
1. [如何配置引擎调试环境?](https://www.yuque.com/lce/doc/glz0fx)
2. [关于引擎的研发协作流程](https://www.yuque.com/lce/doc/contributing)
3. [引擎的工程化配置](https://www.yuque.com/lce/doc/gxwqg6)
> 强烈推荐阅读 [《提问的智慧》](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way)、[《如何向开源社区提问题》](https://github.com/seajs/seajs/issues/545) 和 [《如何有效地报告 Bug》](http://www.chiark.greenend.org.uk/%7Esgtatham/bugs-cn.html)、[《如何向开源项目提交无法解答的问题》](https://zhuanlan.zhihu.com/p/25795393),更好的问题更容易获得帮助。
> 强烈推荐阅读 [《提问的智慧》](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way)、[《如何向开源社区提问题》](https://github.com/seajs/seajs/issues/545) 和 [《如何有效地报告 Bug》](http://www.chiark.greenend.org.uk/%7Esgtatham/bugs-cn.html)、[《如何向开源项目提交无法解答的问题》](https://zhuanlan.zhihu.com/p/25795393),更好的问题更容易获得帮助。(此段参考 [antd](https://github.com/ant-design/ant-design)

View File

@ -7,7 +7,7 @@ interface UtilsMetadata {
subName?: string;
destructuring?: boolean;
main?: string;
}
};
}
interface LibrayMap {

View File

@ -1,4 +1,4 @@
import { SettingField } from '@alilc/lowcode-designer';
import { SettingField, ISetValueOptions } from '@alilc/lowcode-designer';
import { CompositeValue, FieldConfig } from '@alilc/lowcode-types';
import { settingPropEntrySymbol } from './symbols';
import Node from './node';
@ -111,8 +111,8 @@ export default class SettingPropEntry {
*
* @param val
*/
setValue(val: CompositeValue) {
this[settingPropEntrySymbol].setValue(val);
setValue(val: CompositeValue, extraOptions?: ISetValueOptions) {
this[settingPropEntrySymbol].setValue(val, false, false, extraOptions);
}
/**

View File

@ -126,7 +126,8 @@ function toCss(runtime) {
css.push(
`:root${pseudo === 'default' ? '' : `${prefix}${pseudo}`} {
${runtimeToCss(normalizeStyle(runtime[pseudo]))}
}\n`);
}\n`,
);
});
return css.join('\n');
}

View File

@ -1,7 +1,6 @@
export function setPrototypeOf(target: any, proto: any) {
// tslint:disable-next-line
if (typeof Object.setPrototypeOf !== 'undefined') {
Object.setPrototypeOf(target, proto); // tslint:disable-line
Object.setPrototypeOf(target, proto);
} else {
// eslint-disable-next-line no-proto
target.__proto__ = proto;