# インフラ構成図

## システム全体構成図

```mermaid
graph TB
    subgraph "開発者環境"
        DEV[開発者]
        LOCAL[ローカル開発環境<br/>Node.js v6+]
    end

    subgraph "GitHub"
        REPO[GitHub Repository<br/>jashkenas/coffeescript]
        ACTIONS[GitHub Actions<br/>CI/CD Pipeline]
        PAGES[GitHub Pages<br/>coffeescript.org]
        ISSUES[GitHub Issues<br/>バグ報告・機能要望]
    end

    subgraph "GitHub Actions Matrix Build"
        direction TB
        subgraph "OS Matrix"
            UBUNTU[ubuntu-latest]
            MACOS[macos-latest]
            WINDOWS[windows-latest]
        end
        subgraph "Node.js Matrix"
            NODE12[Node.js 12.x]
            NODE14[Node.js 14.x]
            NODE16[Node.js 16.x]
            NODE18[Node.js 18.x]
            NODE20[Node.js 20.x]
        end
    end

    subgraph "外部サービス"
        NPM[npm Registry<br/>パッケージ配布]
    end

    subgraph "エンドユーザー環境"
        USER[エンドユーザー]
        USER_ENV[ユーザー環境<br/>Node.js / Browser]
    end

    DEV --> LOCAL
    LOCAL --> |git push| REPO
    REPO --> |trigger| ACTIONS
    ACTIONS --> UBUNTU
    ACTIONS --> MACOS
    ACTIONS --> WINDOWS
    UBUNTU --> NODE12
    UBUNTU --> NODE14
    UBUNTU --> NODE16
    UBUNTU --> NODE18
    UBUNTU --> NODE20
    ACTIONS --> |deploy| PAGES
    ACTIONS --> |npm publish| NPM

    USER --> |npm install| NPM
    USER --> |documentation| PAGES
    USER --> |bug report| ISSUES
    NPM --> USER_ENV
```

## CI/CDパイプライン構成図

```mermaid
flowchart LR
    subgraph "Trigger"
        PUSH[Push Event]
        PR[Pull Request]
    end

    subgraph "Build Phase"
        CHECKOUT[Checkout Code]
        SETUP[Setup Node.js]
        INSTALL[npm ci]
        BUILD1[Build Compiler<br/>cake build:except-parser]
        BUILD2[Build Parser<br/>cake build:parser]
        BUILD3[Build Browser<br/>cake build:browser]
        DOC[Build Test Docs<br/>cake doc:test]
        DIFF[Git Diff Check]
    end

    subgraph "Test Phase"
        TEST1[Unit Tests<br/>cake test]
        TEST2[Browser Tests<br/>cake test:browser]
        TEST3[Browser Node Tests<br/>cake test:browser:node]
        TEST4[Integration Tests<br/>cake test:integrations]
    end

    PUSH --> CHECKOUT
    PR --> CHECKOUT
    CHECKOUT --> SETUP
    SETUP --> INSTALL
    INSTALL --> BUILD1
    BUILD1 --> BUILD2
    BUILD2 --> BUILD1
    BUILD1 --> BUILD3
    BUILD3 --> DOC
    DOC --> DIFF
    DIFF --> TEST1
    TEST1 --> TEST2
    TEST2 --> TEST3
    TEST3 --> TEST4
```

## ビルド成果物構成図

```mermaid
graph TB
    subgraph "ソースコード"
        SRC[src/*.coffee<br/>CoffeeScriptソース]
    end

    subgraph "ビルドプロセス"
        COFFEE[CoffeeScript Compiler]
        JISON[Jison Parser Generator]
        BABEL[Babel Transpiler]
        WEBPACK[Webpack Bundler]
    end

    subgraph "ビルド成果物"
        subgraph "Node.js向け"
            LIB[lib/coffeescript/*.js<br/>コンパイル済みモジュール]
        end
        subgraph "ブラウザ向け（レガシー）"
            LEGACY[lib/coffeescript-browser-compiler-legacy/<br/>UMD形式]
        end
        subgraph "ブラウザ向け（モダン）"
            MODERN[lib/coffeescript-browser-compiler-modern/<br/>ES Module形式]
        end
        subgraph "ドキュメント"
            DOCS[docs/v2/<br/>Webサイト・テスト]
        end
    end

    subgraph "配布先"
        NPM[npm Registry]
        PAGES[GitHub Pages]
    end

    SRC --> COFFEE
    SRC --> JISON
    COFFEE --> LIB
    JISON --> |parser.js| LIB
    LIB --> BABEL
    BABEL --> LEGACY
    BABEL --> MODERN
    LIB --> DOCS

    LIB --> NPM
    LEGACY --> NPM
    MODERN --> NPM
    DOCS --> PAGES
```

## 依存関係図

```mermaid
graph LR
    subgraph "本番依存関係"
        CS[coffeescript<br/>v2.7.0]
    end

    subgraph "開発依存関係"
        BABEL_CORE["@babel/core<br/>~7.17.9"]
        BABEL_PRESET["@babel/preset-env<br/>~7.16.11"]
        BABEL_MINIFY["babel-preset-minify<br/>~0.5.1"]
        JISON["jison<br/>~0.4.18"]
        WEBPACK["webpack<br/>~5.72.0"]
        PUPPETEER["puppeteer<br/>~13.6.0"]
        CODEMIRROR["codemirror<br/>~5.65.3"]
        DOCCO["docco<br/>~0.9.1"]
        HLJS["highlight.js<br/>~11.5.1"]
        MARKDOWN["markdown-it<br/>~13.0.0"]
        UNDERSCORE["underscore<br/>~1.13.3"]
    end

    CS --> BABEL_CORE
    CS --> BABEL_PRESET
    CS --> BABEL_MINIFY
    CS --> JISON
    CS --> WEBPACK
    CS --> PUPPETEER
    CS --> CODEMIRROR
    CS --> DOCCO
    CS --> HLJS
    CS --> MARKDOWN
    CS --> UNDERSCORE
```
