https://github.com/tomer953/ngx-stats
https://github.com/tomer953/ngx-stats
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tomer953/ngx-stats
- Owner: tomer953
- Created: 2024-05-06T19:00:37.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-08T07:33:54.000Z (over 1 year ago)
- Last Synced: 2025-07-06T14:48:29.401Z (4 months ago)
- Language: JavaScript
- Size: 22.5 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- fucking-awesome-angular - ngx-stats - A CLI tool for Angular project analysis that quantifies modules, components, directives, pipes, and services, offering a clear structural overview to help developers better understand architectural choices and app organization. (Angular / CLI Tools)
- awesome-angular - ngx-stats - A CLI tool for Angular project analysis that quantifies modules, components, directives, pipes, and services, offering a clear structural overview to help developers better understand architectural choices and app organization. (Angular / CLI Tools)
README
# ngx-stats
## Overview
**ngx-stats** is a CLI tool that analyzes Angular projects. It counts the number of modules, components, directives, pipes, and services โ including distinctions between:
- Standalone vs. non-standalone declarations
- OnPush vs. Default change detection
This utility helps developers understand the structure and architectural patterns of their Angular applications.
---
## ๐ฆ Installation
Install globally:
```bash
npm i -g ngx-stats
````
---
## ๐ Usage
In any Angular project directory:
```bash
ngx-stats
```

---
### ๐ Analyze a Specific Path
```bash
ngx-stats --path path/to/angular/project
```
or shorthand:
```bash
ngx-stats -p ./apps/admin
```
---
### ๐งฎ Output Results in JSON
```bash
ngx-stats --json
```
```json
{
"modules": 0,
"services": 0,
"components": {
"total": 4,
"standalone": 4,
"notStandalone": 0,
"onPush": 2,
"default": 2
},
"directives": {
"total": 0,
"standalone": 0,
"notStandalone": 0
},
"pipes": {
"total": 0,
"standalone": 0,
"notStandalone": 0
}
}
```
---
### ๐ Legacy Mode (for Angular v14โv18)
Angular v19+ treats components/directives/pipes as **standalone by default**.
To use legacy detection logic (`standalone: true`), add:
```bash
ngx-stats --legacy
```
or:
```bash
ngx-stats -l
```
---
## ๐งผ Ignored Files and Folders
The following are **excluded by default**:
### ๐ Ignored directories:
* `node_modules`
* `dist`
* `build`
* `cache`
* `.nx`
* `.angular`
* Any directory that starts with a `.`
### ๐ Ignored files:
* Files ending in `.stories.ts`
* Files ending in `.spec.ts`
---
## ๐ Help
```bash
ngx-stats --help
```
---
## ๐ง CLI Options Summary
| Option | Alias | Description |
| ----------- | ----- | --------------------------------------------------------------------------- |
| `--path` | `-p` | Specify target directory to scan |
| `--json` | `-j` | Output result as JSON |
| `--legacy` | `-l` | Use legacy detection logic (Angular v14โv18: looks for `standalone: true`) |
| `--verbose` | `-v` | Print file paths of: NgModules, non-standalone declarations, and non-OnPush |
| `--help` | `-h` | Show usage info |