How xaboy/form-create-designer works
Project Type and Purpose
• This is a monorepo (managed by Lerna + pnpm) containing three parallel Vue component libraries:
• @form-create/element-ui‑designer (Element Plus)
• @form-create/antd-designer (Ant Design Vue)
• @form-create/vant‑designer (Vant)
• Each package wraps FormCreate core + UI framework to provide a low‑code form designer component.
• It hosts source components, configuration/rules, utilities, examples, and build scripts.
File Structure & Readme
• Top level:
• Monorepo controls: lerna.json, pnpm-workspace.yaml, package.json
• CI and quality: .github/, .eslintrc.js, tsconfig.json
• packages/ant‑design‑vue, element‑ui, vant:
• src/components: the designer UI pieces (drag, editors, preview, table, style, language, etc.)
• src/config: base configs + rule definitions for each UI component
• src/utils: shared helpers (form, locale, template, highlight, message)
• examples/: demo sandbox (Vue App.vue, main.js, index.html)
• build scripts: gulpfile.js, vite.config.*.js, babel.config.js, vue.config.js
• types/: TypeScript declarations
• README clarifies the purpose: a low‑code form design component that plugs into Vue apps via CDN or NPM.
Main Components
A. Monorepo Orchestration Layer
• Lerna + pnpm
• Root scripts: lint, test, build, release
B. Package Modules (for each of the three frameworks)
• Designer Wrapper Component (entry point: index.js)
• FormCreate Core Plugin (form-create library)
• UI Framework Adapter (Element Plus / Ant Design Vue / Vant)
• Components Layer (DragBox, Table, FnEditor, etc.)
• Configuration Layer (base, menu, rule definitions)
• Utilities Layer (form utils, locale, template engine, code highlight)
• Examples App (Vue CLI or Vite powered demo)
• Build & Packaging (Gulp, Vite, Babel, Rollup under the hood)
C. External Dependencies
• Vue (v2/v3 as applicable)
• UI frameworks (Element Plus, Ant Design Vue, Vant)
• NPM registry (publish/consume)
• CDN (for UMD builds)
Relationships & Data Flows
• Developer → Clone Monorepo → Run pnpm install (Lerna bootstraps packages)
• Developer → Code changes in packages/* → Local build (Gulp/Vite) → Examples app hot‑reload
• CI pipeline → Runs lint, tests (if any), builds all packages → Publishes to NPM registry
• Consumer App → Installs @form-create/designer + UI framework → Vue.use(FcDesigner) → <fc-designer/> renders
Architectural Patterns & Design Principles
• Monorepo with modular packages for reuse & version consistency
• Plugin architecture: each designer “plugin” wraps core + UI framework
• Layered structure inside each package:
1. Adapter Layer (Wrappers + plugin registration)
2. UI Components Layer (visual building blocks)
3. Config/Rules Layer (declarative definitions)
4. Utilities Layer (shared helpers)
5. Examples/Docs Layer
• Build abstraction: Gulp for legacy, Vite for modern ES modules, Babel for transpilation
Final Advice
• Be as granular as possible: separate Layers → Modules → Files if needed
• Monorepo Management (e.g., blue)
• Package internals (e.g., green)
• External dependencies (e.g., gray)