fitzroy 1.8.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -17
- package/dist/cli.js +4568 -4235
- package/dist/index.d.ts +177 -120
- package/dist/index.js +2076 -1744
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,15 +3,18 @@
|
|
|
3
3
|
[](https://github.com/jackemcpherson/fitzRoy-ts/actions/workflows/ci.yml)
|
|
4
4
|
[](https://www.npmjs.com/package/fitzroy)
|
|
5
5
|
|
|
6
|
-
TypeScript library and CLI for AFL data —
|
|
6
|
+
TypeScript library and CLI for AFL data — matches, stats, ladders, teams, players, and awards.
|
|
7
7
|
|
|
8
8
|
A port of the [fitzRoy R package](https://github.com/jimmyday12/fitzRoy).
|
|
9
9
|
|
|
10
10
|
## Data Sources
|
|
11
11
|
|
|
12
|
-
- **AFL API** — official AFL
|
|
13
|
-
- **FootyWire** — scraped match results
|
|
14
|
-
- **AFL Tables** — historical
|
|
12
|
+
- **AFL API** — official AFL data covering AFLM (2012+), AFLW (2017+), VFL and VFLW (2021+). Default for matches, stats, squads, lineups, ladders.
|
|
13
|
+
- **FootyWire** — scraped AFLM match results, fixtures, player stats, team stats, awards
|
|
14
|
+
- **AFL Tables** — AFLM historical results (1897+) and player stats (~1965+)
|
|
15
|
+
- **Squiggle** — AFLM match results and ladder
|
|
16
|
+
- **Fryzigg** — advanced AFLM and AFLW player stats
|
|
17
|
+
- **AFL Coaches** — AFLCA coaches votes
|
|
15
18
|
|
|
16
19
|
## Install
|
|
17
20
|
|
|
@@ -22,16 +25,25 @@ npm install fitzroy
|
|
|
22
25
|
## Library Usage
|
|
23
26
|
|
|
24
27
|
```typescript
|
|
25
|
-
import {
|
|
28
|
+
import { fetchMatches, fetchPlayerStats, fetchLadder, fetchAwards } from "fitzroy";
|
|
26
29
|
|
|
27
|
-
//
|
|
28
|
-
const matches = await
|
|
30
|
+
// Matches for a season
|
|
31
|
+
const matches = await fetchMatches({ source: "afl-api", season: 2025, competition: "AFLM" });
|
|
32
|
+
|
|
33
|
+
// Only completed matches (the old fetchMatchResults behaviour)
|
|
34
|
+
const completed = await fetchMatches({ source: "afl-api", season: 2025, status: "Complete" });
|
|
35
|
+
|
|
36
|
+
// Upcoming fixtures
|
|
37
|
+
const upcoming = await fetchMatches({ source: "afl-api", season: 2025, status: "Upcoming" });
|
|
29
38
|
|
|
30
39
|
// Player stats for a specific round
|
|
31
40
|
const stats = await fetchPlayerStats({ source: "afl-api", season: 2025, round: 1 });
|
|
32
41
|
|
|
33
42
|
// Ladder standings
|
|
34
43
|
const ladder = await fetchLadder({ source: "afl-api", season: 2025 });
|
|
44
|
+
|
|
45
|
+
// Coleman Medal leaderboard (computed from PlayerStats)
|
|
46
|
+
const coleman = await fetchAwards({ award: "coleman", season: 2025, limit: 10 });
|
|
35
47
|
```
|
|
36
48
|
|
|
37
49
|
All functions return `Result<T, Error>` — check `result.success` before accessing `result.data`.
|
|
@@ -42,24 +54,40 @@ All functions return `Result<T, Error>` — check `result.success` before access
|
|
|
42
54
|
# Install globally
|
|
43
55
|
npm install -g fitzroy
|
|
44
56
|
|
|
45
|
-
#
|
|
46
|
-
|
|
57
|
+
# Six top-level commands, all sharing a uniform "drill in by adding flags" UX:
|
|
58
|
+
|
|
59
|
+
# Matches (subsumes the old `matches` and `fixture` commands)
|
|
60
|
+
fitzroy match --season 2025 --round 1
|
|
61
|
+
fitzroy match --season 2025 --status Upcoming
|
|
47
62
|
|
|
48
|
-
# Player stats
|
|
49
|
-
fitzroy stats --season 2025 --round 1
|
|
63
|
+
# Player or team stats (subsumes the old `team-stats` command)
|
|
64
|
+
fitzroy stats --season 2025 --round 1 # per-player rows
|
|
65
|
+
fitzroy stats --season 2025 --by team # team aggregates
|
|
50
66
|
|
|
51
|
-
# Ladder
|
|
67
|
+
# Ladder standings
|
|
52
68
|
fitzroy ladder --season 2025
|
|
53
69
|
|
|
54
|
-
#
|
|
55
|
-
fitzroy
|
|
70
|
+
# Team identity (subsumes the old `teams`, `squad`, `lineup` commands)
|
|
71
|
+
fitzroy team # list all teams
|
|
72
|
+
fitzroy team --name Carlton -s 2025 # team's squad for season
|
|
73
|
+
fitzroy team -s 2025 -r 3 # all match-day lineups for round 3
|
|
74
|
+
|
|
75
|
+
# Player biography (replaces `player-details`)
|
|
76
|
+
fitzroy player --team Carlton -s 2025
|
|
77
|
+
|
|
78
|
+
# Awards (subsumes `coaches-votes`; adds Coleman, Brownlow, etc.)
|
|
79
|
+
fitzroy awards --type brownlow -s 2024
|
|
80
|
+
fitzroy awards --type coleman -s 2025 --limit 10
|
|
81
|
+
fitzroy awards --type coaches -s 2024 --round 3
|
|
56
82
|
|
|
57
83
|
# Output formats
|
|
58
|
-
fitzroy
|
|
59
|
-
fitzroy
|
|
60
|
-
fitzroy
|
|
84
|
+
fitzroy match --season 2025 --json # JSON (default when piped)
|
|
85
|
+
fitzroy match --season 2025 --csv # CSV with headers
|
|
86
|
+
fitzroy match --season 2025 --full # All columns in table view
|
|
61
87
|
```
|
|
62
88
|
|
|
89
|
+
Pass `--competition VFL` (or AFLW, VFLW) to any command to scope to that competition.
|
|
90
|
+
|
|
63
91
|
Run `fitzroy --help` for all commands and options.
|
|
64
92
|
|
|
65
93
|
## Contributing
|