Giter Site home page Giter Site logo

imcuttle / mometa Goto Github PK

View Code? Open in Web Editor NEW
3.9K 3.9K 597.0 11.78 MB

🛠 [Beta] 面向研发的低代码元编程,代码可视编辑,辅助编码工具 The coding tools which is visual code editing, auxiliary and Low-code metaprogramming for R&D

License: MIT License

JavaScript 43.81% Handlebars 0.21% TypeScript 53.98% HTML 0.65% SCSS 1.15% CSS 0.20%
frontend lowcode react webpack

mometa's Introduction

The tool for R&D which has low-code meta programming and WYSIWYG editing

English | 简体中文


Why use it?

mometa is not similar to the traditional lowcode project which is schema based. mometa is code based, It's WYSIWYG editing following code ast.

Which problems mometa can resolved:

  • There is no dependence on low-code platforms, and secondary development can seamlessly enter code development mode.
  • It also supports WYSIWYG visual editing to improve efficiency and development experience.
  • Provide material ecology, customize materials, improve material use experience, and increase reuse rate.

The positioning of mometa is more based on the local development model of programmers, adding the ability of visual coding (the local code file itself is also modified);
It is not recommended to set up a local development environment for remote services, so there is no online deployment.
The current implementation relies on the webpack dev development mode, and compatibility with vite will be considered in the future.

Features

  • 🛠 Code visual editing for R&D, directly acting on source code
    • Responsive layout, routing simulation, material preview
    • Reverse locating (locating source code)
    • Drag and drop to insert materials
    • Drag and move
    • Moving up and down
    • Deleting
    • Replacing
    • Layers Selecting
  • 🍒 Open material ecology, customizable material library within the team, see mometa-mat
  • 💎 Multi-language, multi-ecological support, currently only supports React, there are plans to support Vue in the future
  • 🔥 Access-friendly, Webpack>=4 plug-in access
  • 🌟 Development friendly, the material library supports hot updates without destroying the existing development model

scenes to be used

Develop a new page

  1. Use team development instructions to add an empty placeholder route & page
  2. Enter mometa, view local materials and remote material markets, select the materials you need, drag and drop directly, and the basic page layout is completed.
  3. Enter the IDE, complete data joint debugging, data transfer, etc., and source code development

There are existing historical projects and the iteration function is needed, only in a small ui module.

  1. Enter mometa and insert material operation
  2. Reverse positioning to directly enter IDE source code development

Operation demonstration

edit

Reverse positioning

Support positioning code location from view

Insert material

Visually insert materials

Delete view

Mobile view

Edit code

Preview

Material Preview

Responsive layout

Route simulation

How to implement

See mometa implementation principle

Quick start

Since mometa relies on the local development environment and is only used in the local development environment, there is no online demo built; it can be used during local development.

git clone https://github.com/imcuttle/mometa.git
cd mometa
pnpm install
pnpm run start:app:cr # 开启本地开发预览模式

how to use

Install dependencies

npm i @mometa/editor -D

Use antd material

  1. Install antd materials
npm i @mometa-mat/antd -D
  1. Create mometa-material.config.js in the project root directory
module.exports = [require('@mometa-mat/antd').default]

You can also create your own material library. For data structure rules, see Material definition

Access editor

webpack.config.js is modified as follows:

const MometaEditorPlugin = require('@mometa/editor/webpack')

module.exports = {
  module: {
    rules: [
      {
        test: /\.(js|mjs|jsx|ts|tsx)$/,
        // Note that only the file directory you need to edit needs to be processed
        include: paths.appSrc,
        loader: require.resolve('babel-loader'),
        options: {
          plugins: [isEnvDevelopment && require.resolve('@mometa/editor/babel/plugin-react')]
        }
      }
    ]
  },
  plugins: [
    isEnvDevelopment &&
      new MometaEditorPlugin({
        react: true,
        //Open material preview
        experimentalMaterialsClientRender: true
      })
  ]
}

Note: You do not need to enable the official default react-refresh when using it. Mometa will enable the react-refresh capability by default

Start webpack dev server and open http://localhost:${port}/mometa/

The provided example can be found at @mometa/app

NPM Packages

Author

This library is written and maintained by imcuttle, [email protected].

mometa's People

Contributors

imcuttle avatar zhongmeizhi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mometa's Issues

Bug:

image
image

无法编辑 panel 找不到

Bug:

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • mometa version:
  • OS: [e.g. iOS]
  • npm/pnpm/Node.js Version: [e.g. 22]

Additional context
Add any other context about the problem here.

如何启动项目啊?

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • mometa version:
  • OS: [e.g. iOS]
  • npm/pnpm/Node.js Version: [e.g. 22]

Additional context
Add any other context about the problem here.

Bug: 快速启动报错

pnpm start启动不了
运行环境: window10
node版本:16.13.1
npm版本: 8.1.2
报错代码:
node:internal/modules/cjs/loader:361
throw err;
^

Error: Cannot find module 'D:\zxw\zxwProject\低代码\mometa\packages\editor\node_modules@mometa\fs-handler\lib'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:353:19)
at Function.Module._findPath (node:internal/modules/cjs/loader:566:18)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (D:\zxw\zxwProject\低代码\mometa\packages\editor\webpack\create-server.js:4:48)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32) {
code: 'MODULE_NOT_FOUND',
path: 'D:\zxw\zxwProject\低代码\mometa\packages\editor\node_modules\@mometa\fs-handler\package.json',
requestPath: '@mometa/fs-handler'
看了一下@mometa\fs-handler下面,没有lib文件夹

Bug: 物料库遇到含有 "/" 的名称时会报错

Describe the bug
物料库遇到含有 "/" 的名称时会报错,因为 write-runtime-preview-render.js 中调用 writeFile 方法时没有确认文件夹是否存在

To Reproduce

Expected behavior

  1. 使用了物料使用了公司内部组件库,命名如:@abc/xxx
  2. run start:app:cr

Screenshots

  • mometa version:

Additional context
已经解决。会提个PR

Bug: Uncaught Error: Expected options to be injected

Describe the bug
Uncaught Error: Expected options to be injected

MIMLTI rMeELen e ontoad (index 1sformatted2645MM)

实际定位到的异常代码是在 fetch-preload.ts 中的 loadJs 方法加载文件 "http://localhost:4000/mometa/mometa-client-render.627066b810abe6de77c5.bundler.js" 导致的。

因为我使用了公司内部的物料库,物料库的 iconfont.css 中包含相对路径,如:

@font-face {
  font-family: "xxx-iconfont";
  src: url('./iconfont/iconfont.woff2') format('woff2'),
       url('./iconfont/iconfont.woff') format('woff'),
       url('./iconfont/iconfont.ttf') format('truetype');
}

该代码会报错 Uncaught TypeError: Failed to construct 'URL': Invalid URL 之后会被error传递为 Uncaught Error: Expected options to be injected

To Reproduce
Steps to reproduce the behavior:

  1. 使用内部含有相对路径的 css 文件的物料库
  2. run start:app:cr

Expected behavior

Screenshots
MIMLTI rMeELen e ontoad (index 1sformatted2645MM)

image

Environment (please complete the following information):

  • mometa version:
  • macOS v11.6
  • node.js v16.13.1

Additional context

run pnpm install Error

I cloned this repo, and now First Step error occurs :
pnpm install :
image
THEN I updated node.js and npm,pnpm to these version.
image
but problem still occurs like before.

添加编辑器支持提示

Is your feature request related to a problem? Please describe.
在 mac pro 中,将 MOMETA_EDITOR 配置设置为 “vscode” 时 会提示 "The editor process exited with an error: spawn vscode ENOENT."

Describe alternatives you've considered
上述问题产生的原因是因为 vscode 在 mac 上的执行名称为 “code”,所以 MOMETA_EDITOR 应该配置为 “code”,而很多用户并不清楚应用的真实名称,特别是诸如 ‘/Applications/GoLand.app/Contents/MacOS/goland’ 之类的。

所以希望在预期 MOMETA_EDITOR 不匹配时提供正确的参考。类似于 webpack 参数错误那样的提示

Bug:

Describe the bug
按照快速开始:

git clone https://github.com/imcuttle/mometa.git
cd mometa
pnpm install
cd packages/app && pnpm start

无法启动,
没有反应;
浏览器打开localhost:4000后一直白屏加载中,控制台也没有任何消息;
image

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • mometa version:
  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Feature: better asset struct

Asset code attribute without $XXX$, and dependiencies without local and imported is optional

{
   code: `<Button></Button>`,
   dependiences: {
      Button: {
         mode: 'named',
         source: 'antd'
      }
   }
}

pnpm i报错

按照快速开始命令进行操作,第一步的pnpm i之后报错,这个问题怎么解决
image
版本信息
image

Bug: pnpm install报错

Node版本:v12.22.7

 ERR_PNPM_FETCH_404  GET https://registry.npm.taobao.org/filelist/-/filelist-1.0.2.tgz: Not Found - 404

Bug: 请问不能使用window运行吗?

警告: PowerShell 检测到你可能正在使用屏幕阅读器,并且已出于兼容性目的禁用 PSReadLine。如果要重新启用它,请运行 "Import-Module PSReadLine"。

PS C:\Users\v.guanym\Desktop> git clone https://github.com/imcuttle/mometa.git
Cloning into 'mometa'...
remote: Enumerating objects: 4233, done.
remote: Counting objects: 100% (3535/3535), done.
remote: Compressing objects: 100% (2155/2155), done.
remote: Total 4233 (delta 2341), reused 2363 (delta 1217), pack-reused 698Receiving objects: 100% (4233/4233), 11.03 MiBReceiving objects: 100% (4233/4233), 11.33 MiB | 946.00 KiB/s, done.

Resolving deltas: 100% (2624/2624), done.
PS C:\Users\v.guanym\Desktop> cd mometa
PS C:\Users\v.guanym\Desktop\mometa> pnpm install
Scope: all 10 workspace projects
Lockfile is up-to-date, resolution step is skipped
Packages: +3050
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
Content-addressable store is at: C:\Users\v.guanym.pnpm-store\v3
Virtual store is at: node_modules/.pnpm
Progress: resolved 3050, reused 2895, downloaded 0, added 3050, done
node_modules/.pnpm/[email protected]/node_modules/core-js: Running postinstall script, done in 152ms
node_modules/.pnpm/[email protected]/node_modules/core-js-pure: Running postinstall script, done in 154ms
node_modules/.pnpm/[email protected]/node_modules/core-js: Running postinstall script, done in 184ms
node_modules/.pnpm/[email protected]/node_modules/ejs: Running postinstall script, done in 164ms
node_modules/.pnpm/@[email protected]/node_modules/@moyuyc/husky: Running install script, done in 451ms
node_modules/.pnpm/[email protected]/node_modules/highlight.js: Running postinstall script, done in 132ms
node_modules/.pnpm/[email protected]/node_modules/husky: Running install script, done in 559ms
node_modules/.pnpm/[email protected]/node_modules/husky: Running postinstall script, done in 109ms
node_modules/.pnpm/[email protected]/node_modules/edam-cli: Running postinstall script, done in 88ms
 WARN  Failed to create bin at C:\Users\v.guanym\Desktop\mometa\node_modules.bin\webpack. The source file at C:\Users\v.guanym\Desktop\mometa\node_modules\webpack\bin\webpack.js does not exist.
 EPERM  EPERM: operation not permitted, open 'C:\Users\v.guanym\Desktop\mometa\node_modules.bin\webpack.CMD'

PS C:\Users\v.guanym\Desktop\mometa> pnpm run start:app:cr # 开启本地开发预览模式

[email protected] start:app:cr C:\Users\v.guanym\Desktop\mometa
pnpm run start:cr --filter=@mometa/app

@mometa/[email protected] start:cr C:\Users\v.guanym\Desktop\mometa\packages\app
NODE_OPTIONS="$INNER_NODE_OPTIONS" CLIENT_RENDER=1 node scripts/start.js

'NODE_OPTIONS' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
C:\Users\v.guanym\Desktop\mometa\packages\app:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @mometa/[email protected] start:cr: NODE_OPTIONS="$INNER_NODE_OPTIONS" CLIENT_RENDER=1 node scripts/start.js
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.
PS C:\Users\v.guanym\Desktop\mometa>

Feature: Variable Binding

Is your feature request related to a problem? Please describe.
I did not find a way to adjust code by injecting variables.

Describe the solution you'd like
image

Describe alternatives you've considered
Directly modify code.

I will implement/expose an interface to inject a variable into code. This allows more advanced usage to be developed. I hope that the pull request implementing this feature can be accepted.

Feature: 元素(语义化代码块)跨文件拖拽

已有元素(代码块)的移动,目前有限制,只能在同一个文件内;
理论上是可以做到 “元素跨文件拖拽”,就需要把所有用到的祖先依赖都迁移到另一个文件里面;
需要对整个上下文(alias 之类)知晓,同时对于文件的语义也需要感知;

Bug: 只能在本地run吗?

由于 mometa 依赖本地开发环境,只使用在本地开发环境,所以没有搭建在线 demo

所以 mometa 是不支持在线部署,是吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.