mirror of
https://github.com/NotAShelf/nix-evaluator-stats.git
synced 2026-04-12 14:27:41 +00:00
treewide: adapt for monorepo layout; initial TUI work
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Id40b5f5ccb55a8a1ea2793192a38f0256a6a6964
This commit is contained in:
parent
e36b0d89da
commit
33ec901788
35 changed files with 1699 additions and 413 deletions
27
packages/core/README.md
Normal file
27
packages/core/README.md
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# @ns/core
|
||||
|
||||
Core types and parsing logic for Nix evaluator statistics. This package is
|
||||
framework-agnostic and can be used in any JavaScript/TypeScript environment.
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { calculateChange, parseStats, StatsData } from "@ns/core";
|
||||
|
||||
// Parse raw stats from Nix
|
||||
const raw = JSON.parse(statsJson);
|
||||
const stats: StatsData = parseStats(raw);
|
||||
|
||||
console.log(`CPU Time: ${stats.cpuTime}s`);
|
||||
console.log(`Expressions: ${stats.nrExprs}`);
|
||||
|
||||
// Compare two values
|
||||
const change = calculateChange(stats.nrThunks, previousStats.nrThunks);
|
||||
console.log(`Thunks changed by ${change.percent.toFixed(2)}%`);
|
||||
```
|
||||
|
||||
## Version Compatibility
|
||||
|
||||
The parser handles different Nix implementations (Nix, Lix, Snix, etc.) by
|
||||
checking for field existence in the raw JSON, since not all implementations
|
||||
expose the same statistics.
|
||||
Loading…
Add table
Add a link
Reference in a new issue