# zhenbinjing/i-cut architecture

> Architecture diagram of the GitHub repository zhenbinjing/i-cut, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zhenbinjing/i-cut
- Repository: https://github.com/zhenbinjing/i-cut

## Overview

##### Project type and purpose
- i‑Cut is a front‑end mono‑repo showcasing three related but distinct pipelines:
- A Sass/CSS framework (FlexGrid, OpenColor) with static demos
- A Gulp‑driven static site build (rev folder, PWA support)
- A Webpack/Vue single‑page app (v‑dist folder)
- It also includes CI via Travis, unit & E2E tests, and code coverage.

##### File structure
- Top‑level files: build configs (.babelrc, eslint, gulpfile.js, webpack/rollup/karma configs)
- src/: Sass source, static templates, PWA fragments → built by Gulp into rev/
- rev/: revisioned static site output (cache‑busted assets, manifest, service worker)
- v‑src/: Vue SPA source (App.vue, components, router, Vuex, main.js, index.html)
- v‑dist/: Webpack production build of SPA (hashed JS/CSS, manifest, service worker, Workbox)
- test/:
- test/es5 & test/es6 – unit tests via Karma
- test/e2e – end‑to‑end scripts and specs

##### Pull insights from README
- Personal tech‑stack demo integrating Sass, Gulp automation, Webpack/Vue SPA, CI (Travis), codecov.

a. Main components
1. Developer Workstation (source repos + build configs)
2. Build Pipelines
- Gulp tasks: Sass → CSS, asset rev, PWA injection → rev/
- Webpack: dev server for v‑src; prod bundler (with Rollup plugin) → v‑dist/
3. Artifacts
- rev/ – static site with versioned assets + service worker
- v‑dist/ – Vue SPA bundles + PWA files
4. Testing & CI
- Unit (Karma) & E2E tests
- Travis CI orchestrating lint → build → test → codecov → deploy
5. Hosting
- Static file host (GitHub Pages, Netlify, custom) serving rev/ and v‑dist/

b. Relationships & data flow
- Code changes → Gulp builds static → Webpack builds SPA → outputs → tests run → CI uploads coverage → deploy
- Both pipelines generate PWA assets (manifest, service worker) via Workbox or custom scripts
- Vuex & Router operate entirely in‑browser within the SPA bundle

c. Architectural patterns
- Monorepo with parallel front‑end pipelines
- Build‑time asset revisioning (cache busting)
- Progressive Web App integration
- Separation of concerns: style framework vs static demo vs dynamic SPA

d. Key technologies
- Node.js, Gulp, Webpack, Rollup, Babel
- Sass (FlexGrid, OpenColor)
- Vue.js, Vue Router, Vuex
- Karma, custom E2E scripts
- Travis CI, Codecov
- Workbox for service worker

## Diagram (Mermaid)

```mermaid
graph TB
    %% Source & Configs
    subgraph "Source & Configs"
        direction TB
        SassSrc["Sass & Static Templates"]:::source
        DemoAssets["Demo HTML/CSS/JS"]:::source
        PWAFragments["PWA Fragments & Templates"]:::source
        SPA_Source["Vue SPA Source"]:::source
        BuildConfigs["Build Configs"]:::source
        CI_Config["CI & Coverage Configs"]:::source
    end

    %% Build Pipelines
    subgraph "Build Pipelines"
        direction TB
        Gulp["Gulp Pipeline"]:::build
        Webpack["Webpack Pipeline"]:::build
    end

    %% Artifacts
    subgraph "Artifacts"
        direction TB
        Rev["rev/ (Static Site)"]:::artifact
        VDist["v-dist/ (Vue SPA)"]:::artifact
    end

    %% Testing & CI
    subgraph "Testing & CI"
        direction TB
        Karma["Unit Tests (Karma)"]:::test
        E2E["E2E Tests"]:::test
        RollupCov["Rollup Coverage"]:::test
        Travis["Travis CI"]:::ci
    end

    %% Hosting
    Hosting["Static File Host"]:::hosting

    %% Connections
    SassSrc -->|"sass build"| Gulp
    DemoAssets -->|"assets pipeline"| Gulp
    PWAFragments -->|"inject PWA"| Gulp
    Gulp -->|"build static"| Rev

    SPA_Source -->|"webpack build"| Webpack
    Webpack -->|"bundle SPA"| VDist

    Travis -->|"run build"| Gulp
    Travis -->|"run build"| Webpack
    Travis -->|"run tests"| Karma
    Travis -->|"run tests"| E2E
    Travis -->|"coverage"| RollupCov
    Travis -->|"deploy"| Hosting

    Rev -->|"serve"| Hosting
    VDist -->|"serve"| Hosting

    %% Click Events
    click SassSrc "https://github.com/zhenbinjing/i-cut/tree/master/src/static/sass/"
    click DemoAssets "https://github.com/zhenbinjing/i-cut/tree/master/assets/"
    click PWAFragments "https://github.com/zhenbinjing/i-cut/tree/master/src/static/pwa/"
    click SPA_Source "https://github.com/zhenbinjing/i-cut/tree/master/v-src/"
    click BuildConfigs "https://github.com/zhenbinjing/i-cut/blob/master/gulpfile.js"
    click BuildConfigs "https://github.com/zhenbinjing/i-cut/blob/master/build/build.js"
    click BuildConfigs "https://github.com/zhenbinjing/i-cut/blob/master/build/config.js"
    click BuildConfigs "https://github.com/zhenbinjing/i-cut/blob/master/build/webpack.config.dev.js"
    click BuildConfigs "https://github.com/zhenbinjing/i-cut/blob/master/build/webpack.config.prod.js"
    click CI_Config "https://github.com/zhenbinjing/i-cut/blob/master/.travis.yml"
    click CI_Config "https://github.com/zhenbinjing/i-cut/blob/master/axios.json"
    click Rev "https://github.com/zhenbinjing/i-cut/tree/master/rev/"
    click VDist "https://github.com/zhenbinjing/i-cut/tree/master/v-dist/"
    click Karma "https://github.com/zhenbinjing/i-cut/tree/master/test/es5/"
    click Karma "https://github.com/zhenbinjing/i-cut/tree/master/test/es6/"
    click Karma "https://github.com/zhenbinjing/i-cut/blob/master/build/karma.config.js"
    click E2E "https://github.com/zhenbinjing/i-cut/tree/master/test/e2e/"
    click RollupCov "https://github.com/zhenbinjing/i-cut/blob/master/build/rollup.config.js"

    %% Styles
    classDef source fill:#cce5ff,stroke:#0366d6,color:#0366d6
    classDef build fill:#d4edda,stroke:#28a745,color:#155724
    classDef artifact fill:#fff3cd,stroke:#e08e0b,color:#856404
    classDef test fill:#e2e3f3,stroke:#6f42c1,color:#383d7e
    classDef ci fill:#e2e3f3,stroke:#6f42c1,color:#383d7e
    classDef hosting fill:#d1ecf1,stroke:#17a2b8,color:#0c5460
```
