# element-plus/element-plus-icons architecture

> Architecture diagram of the GitHub repository element-plus/element-plus-icons, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/element-plus/element-plus-icons
- Repository: https://github.com/element-plus/element-plus-icons

## Overview

##### Project type and purpose
- It contains two npm packages:
- It also includes a “playground” subproject for manual UI testing/demos.
- CI/CD pipelines run unit tests and publish releases to npm.

##### File structure
- Root: workspace configs (.gitignore, pnpm-workspace.yaml, tsconfig.json, package.json, GitHub workflows).
- packages/svg: source of raw SVG assets and its own package.json.
- packages/vue: TypeScript source for Vue components; a build/ folder with build scripts (build.ts, generate.ts); tsconfig files.
- CI: .github/workflows for unit tests and release automation.

##### Extract README insights
- Confirms the two output packages and their npm names.
- Points to external documentation and previews.

##### Main components
a. Monorepo root (pnpm workspace)
d. Playground app (Vue + Vite)
e. CI/CD pipelines (GitHub Actions)
f. npm registry (publish target)
g. Consumers (downstream projects)

##### Relationships and data flow
- Developers commit to GitHub → GitHub Actions run unit tests.
- On a tagged release: build scripts in packages/vue compile TS → dist bundles for both packages.
- Artifacts are published to npm registry under their package names.
- The vue package build uses the svg package as a local dependency.

##### Architectural patterns & principles
- Monorepo with pnpm workspaces for shared tooling and versioning.
- Package composition: svg assets separated from Vue logic (single responsibility).
- Build pipeline scripts generate code (generate.ts) and compile (build.ts).
- CI/CD automates testing and publishing.

##### Technologies & frameworks
- Node.js, pnpm, TypeScript
- Vue 3 & Vite (in playground)
- GitHub Actions (unit-test.yml, release.yml)
- NPM registry

##### Final checklist
- Components: Monorepo root, svg package, vue package, playground, GitHub Actions, npm registry, consumer.
- A note on build scripts within packages/vue/build.
- Workspace binding via pnpm-workspace.yaml.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Monorepo Root (pnpm workspace)" 
        direction TB
        Root["Monorepo Root"]:::monorepo
        Lockfile["pnpm-lock.yaml"]:::config
        TSConfig["tsconfig.json"]:::config
        EditorConfig[".editorconfig"]:::config
        ESLint["eslint.config.js"]:::config
        GitIgnore[".gitignore"]:::config
        Npmrc[".npmrc"]:::config
        GAttr[".gitattributes"]:::config
    end

    subgraph "Package @element-plus/icons-svg" 
        direction TB
        SvgPkg["icons-svg\n(package.json)"]:::package
    end

    subgraph "Package @element-plus/icons-vue" 
        direction TB
        VuePkg["icons-vue\n(package.json)"]:::package
        V_index["src/index.ts"]:::package
        V_global["src/global.ts"]:::package
        subgraph "Build Scripts" 
            direction TB
            BuildTS["build.ts"]:::build
            GenerateTS["generate.ts"]:::build
            PathsTS["paths.ts"]:::build
        end
    end

    subgraph "Playground App (Vue + Vite)" 
        direction TB
        PlaygroundApp["Playground\n(app)"]:::playground
        PG_pkg["package.json"]:::playground
        PG_indexhtml["index.html"]:::playground
        PG_vite["vite.config.ts"]:::playground
        PG_main["src/main.ts"]:::playground
        PG_App["src/App.vue"]:::playground
    end

    subgraph "CI/CD Pipelines (GitHub Actions)" 
        direction TB
        CI["GitHub Actions"]:::ci
        UT["unit-test.yml"]:::ci
        RL["release.yml"]:::ci
    end

    Registry["npm Registry"]:::registry
    Consumer["External Consumers"]:::consumer

    %% Relationships
    Root -->|"workspace includes"| SvgPkg
    Root -->|"workspace includes"| VuePkg
    Root -->|"workspace includes"| PlaygroundApp
    Root -->|"workspace includes"| CI

    SvgPkg -->|"dependency"| VuePkg
    VuePkg -->|"uses"| V_index
    VuePkg -->|"uses"| V_global
    VuePkg -->|"build uses"| BuildTS
    VuePkg -->|"build uses"| GenerateTS
    VuePkg -->|"build uses"| PathsTS

    CI -->|"build & test"| SvgPkg
    CI -->|"build & test"| VuePkg
    CI -->|"publish"| Registry

    Registry -->|"npm install"| PlaygroundApp
    Registry -->|"npm install"| Consumer
    PlaygroundApp -->|"imports"| VuePkg

    %% Click Events
    click Root "https://github.com/element-plus/element-plus-icons/blob/main/pnpm-workspace.yaml"
    click Lockfile "https://github.com/element-plus/element-plus-icons/blob/main/pnpm-lock.yaml"
    click TSConfig "https://github.com/element-plus/element-plus-icons/blob/main/tsconfig.json"
    click EditorConfig "https://github.com/element-plus/element-plus-icons/blob/main/.editorconfig"
    click ESLint "https://github.com/element-plus/element-plus-icons/blob/main/eslint.config.js"
    click GitIgnore "https://github.com/element-plus/element-plus-icons/blob/main/.gitignore"
    click Npmrc "https://github.com/element-plus/element-plus-icons/blob/main/.npmrc"
    click GAttr "https://github.com/element-plus/element-plus-icons/blob/main/.gitattributes"

    click SvgPkg "https://github.com/element-plus/element-plus-icons/tree/main/packages/svg/"
    click SvgPkg "https://github.com/element-plus/element-plus-icons/blob/main/packages/svg/package.json"

    click VuePkg "https://github.com/element-plus/element-plus-icons/tree/main/packages/vue/"
    click VuePkg "https://github.com/element-plus/element-plus-icons/blob/main/packages/vue/package.json"
    click V_index "https://github.com/element-plus/element-plus-icons/blob/main/packages/vue/src/index.ts"
    click V_global "https://github.com/element-plus/element-plus-icons/blob/main/packages/vue/src/global.ts"
    click BuildTS "https://github.com/element-plus/element-plus-icons/blob/main/packages/vue/build/build.ts"
    click GenerateTS "https://github.com/element-plus/element-plus-icons/blob/main/packages/vue/build/generate.ts"
    click PathsTS "https://github.com/element-plus/element-plus-icons/blob/main/packages/vue/build/paths.ts"

    click PlaygroundApp "https://github.com/element-plus/element-plus-icons/tree/main/playground/"
    click PG_pkg "https://github.com/element-plus/element-plus-icons/blob/main/playground/package.json"
    click PG_indexhtml "https://github.com/element-plus/element-plus-icons/blob/main/playground/index.html"
    click PG_vite "https://github.com/element-plus/element-plus-icons/blob/main/playground/vite.config.ts"
    click PG_main "https://github.com/element-plus/element-plus-icons/blob/main/playground/src/main.ts"
    click PG_App "https://github.com/element-plus/element-plus-icons/blob/main/playground/src/App.vue"

    click UT "https://github.com/element-plus/element-plus-icons/blob/main/.github/workflows/unit-test.yml"
    click RL "https://github.com/element-plus/element-plus-icons/blob/main/.github/workflows/release.yml"

    %% Styles
    classDef monorepo fill:#f2f2f2,stroke:#333,stroke-width:2px
    classDef package fill:#e0f7fa,stroke:#00796b,stroke-width:1px
    classDef build fill:#fff3e0,stroke:#fb8c00,stroke-width:1px
    classDef playground fill:#e8eaf6,stroke:#3949ab,stroke-width:1px
    classDef ci fill:#ede7f6,stroke:#5e35b1,stroke-width:1px
    classDef registry fill:#f3e5f5,stroke:#8e24aa,stroke-width:1px
    classDef consumer fill:#e1bee7,stroke:#6a1b9a,stroke-width:1px
    classDef config fill:#ffffff,stroke:#9e9e9e,stroke-width:1px,stroke-dasharray: 2 2
```
