Skip to content

Commit

Permalink
feat: add lowcode-materails-init
Browse files Browse the repository at this point in the history
  • Loading branch information
JN committed May 10, 2024
1 parent 5afef84 commit 696d8fd
Show file tree
Hide file tree
Showing 20 changed files with 1,234 additions and 128 deletions.
1 change: 1 addition & 0 deletions .dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const pkgDirList = readdirSync(join(__dirname, 'packages')).filter(
);
const pkgs = {
'lowcode-i18n-extract': 'lowcode-i18n-extract',
'lowcode-materails-init': 'lowcode-materails-init',
};
export const alias = pkgDirList.reduce((pre, name) => {
pre[`@yuntijs/${pkgs[name]}`] = join(__dirname, 'packages', name, 'src');
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ jobs:
run: |
npm install -g cnpm
cnpm sync @yuntijs/lowcode-i18n-extract
cnpm sync @yuntijs/lowcode-materails-init
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ English ・ [简体中文](./README.zh-CN.md) ・ [Report Bug][github-issues-lin

## 📦 Ecosystem

| NAME | REPO | NPM | DOWNLOAD |
| ------------------------------------------------- | ---------------------------------------------------- | -------------------------------------------- | -------------------------- |
| [@yuntijs/lowcode-i18n-extract][i18n-extract-url] | [packages/lowcode-i18n-extract][i18n-extract-github] | [![][i18n-extract-shield]][i18n-extract-url] | ![][i18n-extract-download] |
| NAME | REPO | NPM | DOWNLOAD |
| ----------------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------ | ---------------------------- |
| [@yuntijs/lowcode-i18n-extract][i18n-extract-url] | [packages/lowcode-i18n-extract][i18n-extract-github] | [![][i18n-extract-shield]][i18n-extract-url] | ![][i18n-extract-download] |
| [@yuntijs/lowcode-materails-init][materails-init-url] | [packages/lowcode-materails-init][materails-init-github] | [![][materails-init-shield]][materails-init-url] | ![][materails-init-download] |

<div align="right">

Expand Down Expand Up @@ -103,5 +104,9 @@ This project is [MIT](./LICENSE) licensed.
[i18n-extract-github]: https://github.com/yuntijs/lowcode-tools/tree/master/packages/lowcode-i18n-extract/README.md
[i18n-extract-shield]: https://img.shields.io/npm/v/@yuntijs/lowcode-i18n-extract?color=369eff&labelColor=black&logo=npm&logoColor=white&style=flat-square
[i18n-extract-url]: https://www.npmjs.com/package/@yuntijs/lowcode-i18n-extract
[materails-init-download]: https://img.shields.io/npm/dt/@yuntijs/lowcode-materails-init?labelColor=black&style=flat-square
[materails-init-github]: https://github.com/yuntijs/lowcode-tools/tree/master/packages/lowcode-materails-init/README.md
[materails-init-shield]: https://img.shields.io/npm/v/@yuntijs/lowcode-materails-init?color=369eff&labelColor=black&logo=npm&logoColor=white&style=flat-square
[materails-init-url]: https://www.npmjs.com/package/@yuntijs/lowcode-materails-init
[pr-welcome-link]: https://github.com/yuntijs/lowcode-tools/pulls
[pr-welcome-shield]: https://img.shields.io/badge/☁️_pr_welcome-%E2%86%92-ffcb47?labelColor=black&style=for-the-badge
5 changes: 5 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ features:
title: i18n-extract
link: /packages/lowcode-i18n-extract
description: 国际化文案提取工具

- emoji: 🧩
title: materials-init
link: /packages/lowcode-materails-init
description: 低码物料自动生成工具
---
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"build": "dumi build",
"dev": "dumi dev",
"dev:i18n-extract": "concurrently \"pnpm --filter 'lowcode-i18n-extract' dev\" \"npm run dev\"",
"dev:materials-init": "concurrently \"pnpm --filter 'lowcode-materails-init' dev\" \"npm run dev\"",
"lint": "npm run lint:es && npm run lint:style && npm run lint:md",
"lint-fix": "npm run lint-fix:es && npm run lint-fix:style",
"lint-fix:es": "eslint \"{docs,packages}/**/*.{js,jsx,ts,tsx}\" --fix",
Expand Down
1 change: 1 addition & 0 deletions packages/lowcode-materails-init/.changelogrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../.changelogrc');
10 changes: 10 additions & 0 deletions packages/lowcode-materails-init/.fatherrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'father';

export default defineConfig({
extends: '../../.fatherrc.base.ts',
cjs: {
input: 'src', // 默认编译目录
platform: 'node', // 默认构建为 Node.js 环境的产物
transformer: 'esbuild', // 默认使用 esbuild 以获得更快的构建速度
},
});
3 changes: 3 additions & 0 deletions packages/lowcode-materails-init/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
lowcode
Empty file.
177 changes: 177 additions & 0 deletions packages/lowcode-materails-init/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<a name="readme-top"></a>

<div align="center">

<h1>Yunti Lowcode Materails Init Tools</h1>

🌐 [@yuntijs/lowcode-materails-init](https://www.npmjs.com/package/@yuntijs/lowcode-materails-init) is an lowcode materails init tools for [Low Code Engine Material Protocol Specification](https://lowcode-engine.cn/site/docs/specs/material-spec) inspired by [@alilc/lowcode-material-parser](https://github.com/alibaba/lowcode-engine/tree/main/modules/material-parser).

English ・ [简体中文](./README.zh-CN.md)[Changelog](./CHANGELOG.md) · [Report Bug][github-issues-link] · [Request Feature][github-issues-link]

<!-- SHIELD GROUP -->

[![][npm-release-shield]][npm-release-link]

<!-- [![][vercel-shield]][vercel-link] -->

[![][npm-downloads-shield]][npm-downloads-link]
[![][github-releasedate-shield]][github-releasedate-link]
[![][github-action-test-shield]][github-action-test-link]
[![codecov][codecov-shield]][codecov-link]<br/>
[![][github-action-release-shield]][github-action-release-link]
[![][github-contributors-shield]][github-contributors-link]
[![][github-forks-shield]][github-forks-link]
[![][github-stars-shield]][github-stars-link]
[![][github-issues-shield]][github-issues-link]
[![][github-license-shield]][github-license-link]

<!-- [![][banner]][vercel-link] -->

</div>

<details>
<summary><kbd>Table of contents</kbd></summary>

#### TOC

- [✨ Features](#-features)
- [📦 Installation](#-installation)
- [🌐 Usage](#-usage)
- [⌨️ Local Development](#️-local-development)
- [🤝 Contributing](#-contributing)

####

</details>

## ✨ Features

- [x] 🚀 Supports parsing components into material descriptions that conform to low code Engine Material Agreement specifications.
- [x] 🚀 Supports configuration to generate a single component material.
- [x] 🚀 Supports the configuration of filtering some components to generate materials.

## 📦 Installation

To install @yuntijs/lowcode-materails-init, run the following command:

```bash
pnpm add @yuntijs/lowcode-materails-init
```

<div align="right">

[![][back-to-top]](#readme-top)

</div>

## 🌐 Usage

init.mjs

```mjs
import init from '@yuntijs/lowcode-materails-init';

init({
components: undefined,
skipComponents: ['TreeNode', 'DirectoryTree', 'Item', 'MonacoDiffEditor', 'BaseMonacoEditor'],
});
```

pakage.json

```json
{
"scripts": {
"init": "node init.mjs"
}
}
```

<div align="right">

[![][back-to-top]](#readme-top)

</div>

## ⌨️ Local Development

You can use Github Codespaces for online development:

[![][codespaces-shield]][codespaces-link]

Or clone it for local development:

```bash
git clone https://github.com/yuntijs/lowcode-tools.git
cd lowcode-tools
pnpm install
pnpm dev:materials-init
```

<div align="right">

[![][back-to-top]](#readme-top)

</div>

## 🤝 Contributing

Contributions of all types are more than welcome, if you are interested in contributing code, feel free to check out our GitHub [Issues][github-issues-link] to get stuck in to show us what you’re made of.

[![][pr-welcome-shield]][pr-welcome-link]

[![][contributors-contrib]][contributors-link]

<div align="right">

[![][back-to-top]](#readme-top)

</div>

---

<details><summary><h4>📝 License</h4></summary>

[![][fossa-license-shield]][fossa-license-link]

</details>

Copyright © 2024 [YuntiJS][profile-link]. <br />
This project is [MIT](./LICENSE) licensed.

<!-- LINK GROUP -->

<!-- [vercel-link]: https://ui.yuntijs.com -->

[back-to-top]: https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square
[codecov-link]: https://codecov.io/gh/yuntijs/lowcode-tools
[codecov-shield]: https://img.shields.io/codecov/c/github/yuntijs/lowcode-tools?token=XVQEXR75U4&style=flat-square&logo=Codecov&logoColor=white&labelColor=black&color=4c1
[codespaces-link]: https://codespaces.new/yuntijs/lowcode-tools
[codespaces-shield]: https://github.com/codespaces/badge.svg
[contributors-contrib]: https://contrib.rocks/image?repo=yuntijs/lowcode-tools
[contributors-link]: https://github.com/yuntijs/lowcode-tools/graphs/contributors
[fossa-license-link]: https://app.fossa.com/projects/git%2Bgithub.com%2Fyuntijs%2Flowcode-tools
[fossa-license-shield]: https://app.fossa.com/api/projects/git%2Bgithub.com%2Fyuntijs%2Flowcode-tools.svg?type=large
[github-action-release-link]: https://github.com/actions/workflows/yuntijs/lowcode-tools/release.yml
[github-action-release-shield]: https://img.shields.io/github/actions/workflow/status/yuntijs/lowcode-tools/release.yml?label=release&labelColor=black&logo=semanticrelease&logoColor=white&style=flat-square
[github-action-test-link]: https://github.com/actions/workflows/yuntijs/lowcode-tools/test.yml
[github-action-test-shield]: https://img.shields.io/github/actions/workflow/status/yuntijs/lowcode-tools/test.yml?label=test&labelColor=black&logo=jest&logoColor=white&style=flat-square
[github-contributors-link]: https://github.com/yuntijs/lowcode-tools/graphs/contributors
[github-contributors-shield]: https://img.shields.io/github/contributors/yuntijs/lowcode-tools?color=c4f042&labelColor=black&style=flat-square
[github-forks-link]: https://github.com/yuntijs/lowcode-tools/network/members
[github-forks-shield]: https://img.shields.io/github/forks/yuntijs/lowcode-tools?color=8ae8ff&labelColor=black&style=flat-square
[github-issues-link]: https://github.com/yuntijs/lowcode-tools/issues
[github-issues-shield]: https://img.shields.io/github/issues/yuntijs/lowcode-tools?color=ff80eb&labelColor=black&style=flat-square
[github-license-link]: https://github.com/yuntijs/lowcode-tools/blob/master/LICENSE
[github-license-shield]: https://img.shields.io/github/license/yuntijs/lowcode-tools?color=white&labelColor=black&style=flat-square
[github-releasedate-link]: https://github.com/yuntijs/lowcode-tools/releases
[github-releasedate-shield]: https://img.shields.io/github/release-date/yuntijs/lowcode-tools?labelColor=black&style=flat-square
[github-stars-link]: https://github.com/yuntijs/lowcode-tools/network/stargazers
[github-stars-shield]: https://img.shields.io/github/stars/yuntijs/lowcode-tools?color=ffcb47&labelColor=black&style=flat-square
[npm-downloads-link]: https://www.npmjs.com/package/@yuntijs/lowcode-materails-init
[npm-downloads-shield]: https://img.shields.io/npm/dt/@yuntijs/lowcode-materails-init?labelColor=black&style=flat-square
[npm-release-link]: https://www.npmjs.com/package/@yuntijs/lowcode-materails-init
[npm-release-shield]: https://img.shields.io/npm/v/@yuntijs/lowcode-materails-init?color=369eff&labelColor=black&logo=npm&logoColor=white&style=flat-square
[pr-welcome-link]: https://github.com/yuntijs/lowcode-tools/pulls
[pr-welcome-shield]: https://img.shields.io/badge/☁️_pr_welcome-%E2%86%92-ffcb47?labelColor=black&style=for-the-badge
[profile-link]: https://github.com/yuntijs
7 changes: 7 additions & 0 deletions packages/lowcode-materails-init/demo/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import init from '../src/index.mjs'

init({
entryPath: "demo/index.tsx",
components: undefined,
skipComponents: ['TreeNode', 'DirectoryTree', 'Item', 'MonacoDiffEditor', 'BaseMonacoEditor'],
})
1 change: 1 addition & 0 deletions packages/lowcode-materails-init/demo/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@yuntijs/ui';
69 changes: 69 additions & 0 deletions packages/lowcode-materails-init/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: materials-init
order: 0
---

<a name="readme-top"></a>

<div align="center">

<h1>Yunti Lowcode Materials Init Tools</h1>

🌐 [@yuntijs/lowcode-materails-init](https://www.npmjs.com/package/@yuntijs/lowcode-materails-init) is an lowcode materails init tools for [Low Code Engine Material Protocol Specification](https://lowcode-engine.cn/site/docs/specs/material-spec) inspired by [@alilc/lowcode-material-parser](https://github.com/alibaba/lowcode-engine/tree/main/modules/material-parser).

</div>

## 📦 Installation

To install @yuntijs/lowcode-materails-init, run the following command:

```bash
pnpm add @yuntijs/lowcode-materails-init
```

## 🌐 Usage

init.mjs

```mjs
import init from '@yuntijs/lowcode-materails-init';

init({
components: undefined,
skipComponents: ['TreeNode', 'DirectoryTree', 'Item', 'MonacoDiffEditor', 'BaseMonacoEditor'],
});
```

pakage.json

```json
{
"scripts": {
"init": "node init.mjs"
}
}
```

## 🤝 API

### `init(options)`

#### `options`

| name | Description | Type | Default | Version |
| :------------- | :------------------------------ | :-------- | :-------------- | :------ |
| rootDir | Entry file root path | string | '' | - |
| entryPath | Relative path of the entry file | string | "src/index.tsx" | - |
| components | Parsed components only | string\[] | - | - |
| skipComponents | Unparsed components | string\[] | \[] | - |
| lowcodeDir | Generate folder name | string | 'lowcode' | - |
| metaFormat | Generated file type | string | ts | - |
| devAlias | Generate filename suffix | string | '' | - |

<div align="right">

[![][back-to-top]](#readme-top)

</div>

[back-to-top]: https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square
51 changes: 51 additions & 0 deletions packages/lowcode-materails-init/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "@yuntijs/lowcode-materails-init",
"version": "0.0.1",
"description": "lowcode materails init tools for components",
"keywords": [
"yuntijs",
"lowcode",
"low-code",
"low-code engine",
"low-code materails",
"materails"
],
"homepage": "https://yuntijs.github.io/lowcode-tools/packages/lowcode-materails-init",
"bugs": {
"url": "https://github.com/yuntijs/lowcode-tools/issues/new"
},
"repository": {
"type": "git",
"url": "https://github.com/yuntijs/lowcode-tools.git"
},
"license": "MIT",
"main": "dist/cjs/index.js",
"module": "dist/es/index.js",
"types": "dist/es/index.d.ts",
"files": [
"dist",
"compiled"
],
"scripts": {
"build": "father build",
"build:deps": "father prebundle",
"demo": "node demo/index.mjs",
"dev": "cross-env NODE_ENV=development father dev",
"prepublishOnly": "father doctor && npm run build",
"test": "node demo/index.mjs"
},
"dependencies": {
"@alilc/lowcode-material-parser": "^1.0.3",
"@alilc/lowcode-types": "^1.3.1",
"@types/react": "^18.2.79"
},
"devDependencies": {
"@types/fs-extra": "^11.0.4",
"antd": "^5.15.2",
"fs-extra": "^11.2.0"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
}
}
Loading

0 comments on commit 696d8fd

Please sign in to comment.