Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* text eol=lf

yarn.lock -diff
bun.lock -diff
package-lock.json -diff
32 changes: 29 additions & 3 deletions .github/actions/cached-deps/action.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,34 @@
name: Install Dependencies
description: Install dependencies from the frozen Yarn lockfile
name: Get & Cache Dependencies
description: Get dependencies via Bun and cache them
inputs:
caching:
description: Whether to cache dependencies or not
required: false
default: 'true'
outputs:
used-cache:
description: Whether the cache was used
value: ${{ steps.cache.outputs.cache-hit }}
runs:
using: composite
steps:
- name: Cache dependencies
if: inputs.caching == 'true'
id: cache
uses: actions/cache@v5
with:
path: node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
${{ runner.os }}-

- name: Install
run: yarn install --frozen-lockfile
if: steps.cache.outputs.cache-hit != 'true' || inputs.caching != 'true'
run: bun ci
shell: bash

- name: Postinstall
if: steps.cache.outputs.cache-hit == 'true' && inputs.caching == 'true'
run: bun run postinstall
shell: bash
12 changes: 6 additions & 6 deletions .github/actions/report-pr/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ description: Set code coverage report to PR
runs:
using: composite
steps:
- name: Find PR
id: finder
uses: jwalton/gh-find-current-pr@v1

- name: Code Coverage Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
Expand All @@ -17,12 +21,8 @@ runs:
thresholds: '60 80'

- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
uses: marocchino/sticky-pull-request-comment@v3
with:
number: ${{ steps.finder.outputs.pr }}
number: ${{ steps.finder.outputs.number }}
recreate: true
path: code-coverage-results.md

- name: Find PR
id: finder
uses: jwalton/gh-find-current-pr@v1
22 changes: 13 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,33 @@ jobs:

steps:
- name: 🗜️ Checkout
uses: actions/checkout@v6
uses: actions/checkout@v7

- name: 🗜️ Setup node version
uses: actions/setup-node@v6
uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: yarn
registry-url: 'https://registry.npmjs.org'

- name: 🗜️ Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14

- name: 🛠️ Install
uses: ./.github/actions/cached-deps

- name: 📦 Build
run: yarn build
run: bun run build

- name: 🧹 Run lint
run: yarn lint
run: bun run lint

- name: 🧪 Run tests
run: yarn test --coverage --run
run: bun run test --coverage --run

# - name: ⬆️ Upload coverage reports
# uses: codecov/codecov-action@v6
# uses: codecov/codecov-action@v7
# with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
# fail_ci_if_error: true
Expand All @@ -60,11 +64,11 @@ jobs:
# Publish to GitHub Package Registry
- name: 🛠️ Set up package for GPR
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'beta') == false
run: yarn gpr:setup
run: bun run gpr:setup

- name: 🛠️ Use GPR
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'beta') == false
uses: actions/setup-node@v6
uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
registry-url: https://npm.pkg.github.com/
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,30 @@ jobs:

steps:
- name: 🗜️ Checkout
uses: actions/checkout@v6
uses: actions/checkout@v7

- name: 🗜️ Setup node version
uses: actions/setup-node@v6
uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: yarn
registry-url: 'https://registry.npmjs.org'

- name: 🗜️ Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14

- name: 🛠️ Install
uses: ./.github/actions/cached-deps

- name: 📦 Build
run: yarn build
run: bun run build

- name: 🧹 Run lint
run: yarn lint
run: bun run lint

- name: 🧪 Run tests
run: yarn test --coverage --run
run: bun run test --coverage --run

- name: 🧪 Create coverage report
uses: davelosert/vitest-coverage-report-action@v2
Expand All @@ -42,7 +46,7 @@ jobs:
json-final-path: ./coverage/coverage-final.json

# - name: ⬆️ Upload coverage reports
# uses: codecov/codecov-action@v6
# uses: codecov/codecov-action@v7
# with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
# fail_ci_if_error: true
Expand Down
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npx --no-install commitlint --edit "$1"
bunx --no-install quick-commitlint "$1"
3 changes: 1 addition & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
npx --no-install lint-staged --relative
npm test
bunx --no-install lint-staged --relative
2 changes: 1 addition & 1 deletion .commitlintrc.json → .quick-commitlint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["@commitlint/config-conventional"],
"preset": "angular",
"rules": {
"type-enum": [2, "always", ["ci", "chore", "docs", "feat", "fix", "perf", "refactor", "revert", "style"]]
}
Expand Down
47 changes: 47 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Repository Guidelines

## Project overview

SoccerBot is a TypeScript library that scrapes football data from several public websites. The
public API is exported from `src/index.ts`; source-specific clients live in `src/clients`, shared
types live in `src/shared`, and general data-normalization helpers live in `src/helpers`.

## Development environment

- Use the Node.js version from `.nvmrc` (Node 24).
- Use Bun 1.3.14. Keep `bun.lock` in sync with `package.json`.
- Install dependencies with `bun ci` when the lockfile should not change.
- Do not edit generated files in `dist` or coverage output in `coverage`.

## Common commands

- `bun run build` compiles the ES2019 and ES5 distributions.
- `bun run lint` runs ESLint.
- `bun run test` runs the Vitest test suite.
- `bun run test --coverage --run` matches the CI coverage command.
- `bun run demo` runs `demo.ts`.

Before handing off a change, run the smallest relevant tests and then, when practical, run
`bun run lint`, `bun run test`, and `bun run build`.

## Code and test conventions

- Follow the existing TypeScript style: single quotes, semicolons, two-space indentation, and
explicit exported interfaces for public response shapes.
- Keep source-specific parsing inside that source's client directory. Put reusable normalization in
`src/helpers` or `src/clients/shared`.
- Preserve the response contract used by the existing clients: return structured data and surface
request or parsing failures consistently with neighboring implementations.
- Add or update a matching `*.spec.ts` file for behavioral changes.
- Scraper tests must use fixtures under `test/mocks`; do not make live network requests in tests.
- When an upstream page shape changes, keep fixture changes focused and include coverage for the
affected selector or fallback.
- Public API changes must be exported through the relevant index files and documented in
`README.md`.

## Repository hygiene

- Do not commit `dist`, `coverage`, or `node_modules`.
- Do not change the package version or generated changelog unless the task is a release.
- Preserve unrelated worktree changes.
- GitHub Actions should use the Node version from `.nvmrc` and install from the frozen Yarn lockfile.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

## 🛠️ Install

_Nodejs 12 or higher need to be installed first_
_Node.js >=24 and <26 must be installed first_

```terminal
npm install soccerbot
Expand All @@ -25,7 +25,7 @@ npm install soccerbot
or

```terminal
yarn add soccerbot
bun add soccerbot
```

## 🚀 Quick start
Expand Down
Loading