campus-stats 0.4.2 → 0.5.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/CHANGELOG.md +29 -0
- package/LICENSE +1 -1
- package/README.md +8 -7
- package/dist/cli.js +4 -4
- package/dist/client.js +3 -3
- package/dist/data-bundle.d.ts +8 -7
- package/dist/data-bundle.js +12 -11
- package/dist/http.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.5.0
|
|
6
|
+
|
|
7
|
+
- **CI / data host:** GitLab → **GitHub Actions**
|
|
8
|
+
- `ci.yml` (test), `publish.yml` (npmjs on `v*` tags), `refresh-data.yml`
|
|
9
|
+
(daily fantasy sync → Release `data-latest`)
|
|
10
|
+
- Removed `.gitlab-ci.yml` and GitLab Package Registry mirror docs
|
|
11
|
+
- **Breaking (public API):** removed export `GITLAB_PROJECT_ID`;
|
|
12
|
+
`dataBundleUrl()` / `dataBundleMetaUrl()` now point at
|
|
13
|
+
`https://github.com/Minacava/campus-stats/releases/download/data-latest/…`
|
|
14
|
+
- Docs (`cron.md`, `npm.md`, README) updated for GitHub
|
|
15
|
+
|
|
16
|
+
## 0.4.5
|
|
17
|
+
|
|
18
|
+
- Drop Vercel / `campus-docs` links from npm metadata and README
|
|
19
|
+
- `homepage` → https://github.com/Minacava/campus-stats#readme
|
|
20
|
+
(docs live only in this repo’s README)
|
|
21
|
+
|
|
22
|
+
## 0.4.4
|
|
23
|
+
|
|
24
|
+
- npm `repository` / `bugs` → https://github.com/Minacava/campus-stats
|
|
25
|
+
(`homepage` stays on the public docs site)
|
|
26
|
+
|
|
27
|
+
## 0.4.3
|
|
28
|
+
|
|
29
|
+
- npm `homepage` and `repository` both point at
|
|
30
|
+
https://campus-tawny-mu.vercel.app/ (no GitLab repo link on the package page)
|
|
31
|
+
|
|
3
32
|
## 0.4.2
|
|
4
33
|
|
|
5
34
|
- `homepage` → https://campus-tawny-mu.vercel.app/
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -25,8 +25,8 @@ npx campus matches --competition "Liga F" --team "Barcelona"
|
|
|
25
25
|
|
|
26
26
|
The CLI binaries are `campus` and `campus-stats` (same entrypoint).
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
Documentation lives in this README.
|
|
29
|
+
Source: https://github.com/Minacava/campus-stats
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
@@ -63,8 +63,9 @@ return Response.json({ clubs, nations, matches, squad, points });
|
|
|
63
63
|
|
|
64
64
|
## Keep data fresh (cron)
|
|
65
65
|
|
|
66
|
-
1.
|
|
67
|
-
|
|
66
|
+
1. GitHub Actions schedule on `main` (e.g. `0 6 * * *`) runs
|
|
67
|
+
**Refresh fantasy data** and publishes the `data-latest` release
|
|
68
|
+
(`cache.json`).
|
|
68
69
|
2. Apps call `CampusClient.fromBundle()` or `npx campus pull`.
|
|
69
70
|
|
|
70
71
|
Details: [`docs/cron.md`](./docs/cron.md).
|
|
@@ -117,10 +118,10 @@ Injuries are **not** in these open feeds yet — the API is ready, the list is e
|
|
|
117
118
|
|
|
118
119
|
---
|
|
119
120
|
|
|
120
|
-
## Docs
|
|
121
|
+
## Docs & source
|
|
121
122
|
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
All public docs are in this README on GitHub:
|
|
124
|
+
https://github.com/Minacava/campus-stats
|
|
124
125
|
|
|
125
126
|
---
|
|
126
127
|
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { cachePath, emptyCache, mergeSyncResult } from "./cache.js";
|
|
3
|
-
import { dataBundleUrl
|
|
3
|
+
import { dataBundleUrl } from "./data-bundle.js";
|
|
4
4
|
import { readStore, resolveDbPath, resolveStoreMode, runMigrate, writeCacheToStore, writeSyncToStore, } from "./db/store-api.js";
|
|
5
5
|
import { FANTASY_PLAYER_STATS_LIMIT, listWomenCompetitions, syncFantasyBundle, updateCachedCompetitions, } from "./fantasy.js";
|
|
6
6
|
import { CampusClient } from "./client.js";
|
|
@@ -55,7 +55,7 @@ Options:
|
|
|
55
55
|
--json Force JSON cache (default)
|
|
56
56
|
--help Show this help
|
|
57
57
|
|
|
58
|
-
Periodic refresh: see docs/cron.md (
|
|
58
|
+
Periodic refresh: see docs/cron.md (GitHub Actions schedule + campus pull).
|
|
59
59
|
`);
|
|
60
60
|
process.exit(1);
|
|
61
61
|
}
|
|
@@ -173,12 +173,12 @@ async function cmdUpdate(args) {
|
|
|
173
173
|
printSyncSummary("statsbomb", result, cache);
|
|
174
174
|
}
|
|
175
175
|
async function cmdPull(args) {
|
|
176
|
-
const url = getFlag(args, "--url") ?? dataBundleUrl(
|
|
176
|
+
const url = getFlag(args, "--url") ?? dataBundleUrl();
|
|
177
177
|
console.error(`Pulling data bundle from ${url}…`);
|
|
178
178
|
const res = await fetch(url);
|
|
179
179
|
if (!res.ok) {
|
|
180
180
|
throw new Error(`Failed to pull data bundle (${res.status}). ` +
|
|
181
|
-
`Ensure the
|
|
181
|
+
`Ensure the GitHub Actions cron has published the data-latest release (see docs/cron.md).`);
|
|
182
182
|
}
|
|
183
183
|
const remote = (await res.json());
|
|
184
184
|
const incoming = {
|
package/dist/client.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* helpers against an in-memory cache loaded via `fromBundle` / `fromCache`.
|
|
5
5
|
*/
|
|
6
6
|
import { emptyCache, loadCache, mergeSyncResult, saveCache, cachePath, } from "./cache.js";
|
|
7
|
-
import { dataBundleUrl
|
|
7
|
+
import { dataBundleUrl } from "./data-bundle.js";
|
|
8
8
|
import { syncFantasyBundle, updateCachedCompetitions, } from "./fantasy.js";
|
|
9
9
|
import { listInjuries, INJURIES_AVAILABLE, INJURIES_STATUS_MESSAGE } from "./injuries.js";
|
|
10
10
|
import { DEFAULT_FANTASY_RULES, scoreFantasyPoints, } from "./scoring.js";
|
|
@@ -28,11 +28,11 @@ export class CampusClient {
|
|
|
28
28
|
}
|
|
29
29
|
/** Download the cron-published bundle and optionally merge with local cache. */
|
|
30
30
|
static async fromBundle(options = {}) {
|
|
31
|
-
const url = options.url ?? dataBundleUrl(
|
|
31
|
+
const url = options.url ?? dataBundleUrl();
|
|
32
32
|
const res = await fetch(url);
|
|
33
33
|
if (!res.ok) {
|
|
34
34
|
throw new Error(`Failed to load data bundle (${res.status}) from ${url}. ` +
|
|
35
|
-
"Publish via
|
|
35
|
+
"Publish via GitHub Actions schedule (docs/cron.md) or call syncFantasy() once.");
|
|
36
36
|
}
|
|
37
37
|
const remote = (await res.json());
|
|
38
38
|
const incoming = {
|
package/dist/data-bundle.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Published women's fantasy data bundle (refreshed by
|
|
3
|
-
*
|
|
2
|
+
* Published women's fantasy data bundle (refreshed by GitHub Actions cron).
|
|
3
|
+
* Served as assets on the rolling Release tag `data-latest`.
|
|
4
4
|
*/
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
5
|
+
export declare const DATA_BUNDLE_OWNER = "Minacava";
|
|
6
|
+
export declare const DATA_BUNDLE_REPO = "campus-stats";
|
|
7
|
+
export declare const DATA_BUNDLE_RELEASE_TAG = "data-latest";
|
|
8
8
|
export declare const DATA_BUNDLE_FILE = "cache.json";
|
|
9
|
+
export declare const DATA_BUNDLE_META_FILE = "meta.json";
|
|
9
10
|
/** Absolute URL of the periodically refreshed cache snapshot. */
|
|
10
|
-
export declare function dataBundleUrl(
|
|
11
|
-
export declare function dataBundleMetaUrl(
|
|
11
|
+
export declare function dataBundleUrl(tag?: string): string;
|
|
12
|
+
export declare function dataBundleMetaUrl(tag?: string): string;
|
package/dist/data-bundle.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Published women's fantasy data bundle (refreshed by
|
|
3
|
-
*
|
|
2
|
+
* Published women's fantasy data bundle (refreshed by GitHub Actions cron).
|
|
3
|
+
* Served as assets on the rolling Release tag `data-latest`.
|
|
4
4
|
*/
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
7
|
-
export const
|
|
5
|
+
export const DATA_BUNDLE_OWNER = "Minacava";
|
|
6
|
+
export const DATA_BUNDLE_REPO = "campus-stats";
|
|
7
|
+
export const DATA_BUNDLE_RELEASE_TAG = "data-latest";
|
|
8
8
|
export const DATA_BUNDLE_FILE = "cache.json";
|
|
9
|
+
export const DATA_BUNDLE_META_FILE = "meta.json";
|
|
9
10
|
/** Absolute URL of the periodically refreshed cache snapshot. */
|
|
10
|
-
export function dataBundleUrl(
|
|
11
|
-
return (`https://
|
|
12
|
-
|
|
11
|
+
export function dataBundleUrl(tag = DATA_BUNDLE_RELEASE_TAG) {
|
|
12
|
+
return (`https://github.com/${DATA_BUNDLE_OWNER}/${DATA_BUNDLE_REPO}` +
|
|
13
|
+
`/releases/download/${tag}/${DATA_BUNDLE_FILE}`);
|
|
13
14
|
}
|
|
14
|
-
export function dataBundleMetaUrl(
|
|
15
|
-
return (`https://
|
|
16
|
-
|
|
15
|
+
export function dataBundleMetaUrl(tag = DATA_BUNDLE_RELEASE_TAG) {
|
|
16
|
+
return (`https://github.com/${DATA_BUNDLE_OWNER}/${DATA_BUNDLE_REPO}` +
|
|
17
|
+
`/releases/download/${tag}/${DATA_BUNDLE_META_FILE}`);
|
|
17
18
|
}
|
package/dist/http.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Polite HTTP helper for HTML sources (FBref, etc.).
|
|
3
3
|
* Sequential requests share a minimum delay; failed GETs retry with backoff.
|
|
4
4
|
*/
|
|
5
|
-
const DEFAULT_UA = "campus/0.0.1 (women's football research; +https://
|
|
5
|
+
const DEFAULT_UA = "campus/0.0.1 (women's football research; +https://github.com/Minacava/campus-stats)";
|
|
6
6
|
function defaultSleep(ms) {
|
|
7
7
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
8
8
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { emptyCache, cachePath, loadCache, saveCache, mergeSyncResult, DEFAULT_C
|
|
|
8
8
|
export { SqliteStore, SCHEMA_SQL } from "./db/sqlite-store.js";
|
|
9
9
|
export { FANTASY_PLAYER_STATS_LIMIT, listWomenCompetitions, syncFantasyBundle, updateCachedCompetitions, competitionIsInternational, } from "./fantasy.js";
|
|
10
10
|
export type { FantasySyncOptions } from "./fantasy.js";
|
|
11
|
-
export {
|
|
11
|
+
export { DATA_BUNDLE_OWNER, DATA_BUNDLE_REPO, DATA_BUNDLE_RELEASE_TAG, DATA_BUNDLE_FILE, DATA_BUNDLE_META_FILE, dataBundleUrl, dataBundleMetaUrl, } from "./data-bundle.js";
|
|
12
12
|
export { CampusClient } from "./client.js";
|
|
13
13
|
export type { SquadMember } from "./client.js";
|
|
14
14
|
export { DEFAULT_FANTASY_RULES, scorePlayerMatchStats, scoreFantasyPoints, } from "./scoring.js";
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { FbrefSource, listFbrefPilotNames } from "./sources/fbref.js";
|
|
|
3
3
|
export { emptyCache, cachePath, loadCache, saveCache, mergeSyncResult, DEFAULT_CACHE_DIR, DEFAULT_CACHE_FILE, } from "./cache.js";
|
|
4
4
|
export { SqliteStore, SCHEMA_SQL } from "./db/sqlite-store.js";
|
|
5
5
|
export { FANTASY_PLAYER_STATS_LIMIT, listWomenCompetitions, syncFantasyBundle, updateCachedCompetitions, competitionIsInternational, } from "./fantasy.js";
|
|
6
|
-
export {
|
|
6
|
+
export { DATA_BUNDLE_OWNER, DATA_BUNDLE_REPO, DATA_BUNDLE_RELEASE_TAG, DATA_BUNDLE_FILE, DATA_BUNDLE_META_FILE, dataBundleUrl, dataBundleMetaUrl, } from "./data-bundle.js";
|
|
7
7
|
export { CampusClient } from "./client.js";
|
|
8
8
|
export { DEFAULT_FANTASY_RULES, scorePlayerMatchStats, scoreFantasyPoints, } from "./scoring.js";
|
|
9
9
|
export { INJURIES_AVAILABLE, INJURIES_STATUS_MESSAGE, listInjuries, } from "./injuries.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "campus-stats",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Campus — installable women's football data layer for apps (clubs, national teams, matches, fantasy points)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
],
|
|
43
43
|
"repository": {
|
|
44
44
|
"type": "git",
|
|
45
|
-
"url": "git+https://
|
|
45
|
+
"url": "git+https://github.com/Minacava/campus-stats.git"
|
|
46
46
|
},
|
|
47
|
-
"homepage": "https://campus-
|
|
47
|
+
"homepage": "https://github.com/Minacava/campus-stats#readme",
|
|
48
48
|
"bugs": {
|
|
49
|
-
"url": "https://
|
|
49
|
+
"url": "https://github.com/Minacava/campus-stats/issues"
|
|
50
50
|
},
|
|
51
51
|
"license": "MIT",
|
|
52
52
|
"devDependencies": {
|