# gristlabs/collect-js-deps architecture

> Architecture diagram of the GitHub repository gristlabs/collect-js-deps, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gristlabs/collect-js-deps
- Repository: https://github.com/gristlabs/collect-js-deps

## Overview

collect-js-deps is a small Node.js utility that collects the files Browserify discovers for an entry point. Its CLI configures Browserify and attaches the collector; dependency rows are then listed or written, with needed parent package.json files copied alongside output. Browserify transforms can provide compiled files, including TypeScript output. The runtime is concentrated in index.js; the graph omits tests and build tooling.

Main entry points: [`index.js`](https://github.com/gristlabs/collect-js-deps/blob/master/index.js) (Dependency collector)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("CLI user"))
node_cli["CLI entry<br/>[index.js]"]
node_browserify["Browserify"]
node_collector["Dependency collector<br/>[index.js]"]
node_manifest["Parent manifests<br/>[index.js]"]
node_outputs["List and files<br/>[index.js]"]
node_filesystem["Filesystem"]

node_user -->|"provides arguments"| node_cli
node_cli -->|"parses options"| node_browserify
node_cli -->|"attaches collector"| node_collector
node_browserify -->|"emits dependency rows"| node_collector
node_collector -->|"checks parent packages"| node_manifest
node_collector -->|"lists or writes sources"| node_outputs
node_manifest -->|"checks and copies manifests"| node_filesystem
node_outputs -->|"writes or copies files"| node_filesystem

click node_cli "https://github.com/gristlabs/collect-js-deps/blob/master/index.js"
click node_collector "https://github.com/gristlabs/collect-js-deps/blob/master/index.js"
click node_manifest "https://github.com/gristlabs/collect-js-deps/blob/master/index.js"
click node_outputs "https://github.com/gristlabs/collect-js-deps/blob/master/index.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_user,node_browserify toneBlue
class node_cli,node_collector,node_manifest,node_outputs toneTeal
class node_filesystem toneIndigo
```

## Components

### Other components

- **CLI user**
- [CLI entry](https://github.com/gristlabs/collect-js-deps/blob/master/index.js): `index.js`
- **Browserify**
- [Dependency collector](https://github.com/gristlabs/collect-js-deps/blob/master/index.js): `index.js`
- [Parent manifests](https://github.com/gristlabs/collect-js-deps/blob/master/index.js): `index.js`
- [List and files](https://github.com/gristlabs/collect-js-deps/blob/master/index.js): `index.js`
- **Filesystem**

## Connections

- CLI user → CLI entry: provides arguments (evidence: `README.md`)
- CLI entry → Browserify: parses options (evidence: `index.js`)
- CLI entry → Dependency collector: attaches collector (evidence: `index.js`)
- Browserify → Dependency collector: emits dependency rows (evidence: `index.js`)
- Dependency collector → Parent manifests: checks parent packages (evidence: `index.js`)
- Dependency collector → List and files: lists or writes sources (evidence: `index.js`)
- Parent manifests → Filesystem: checks and copies manifests (evidence: `index.js`)
- List and files → Filesystem: writes or copies files (evidence: `index.js`)
