Skip to content
This repository was archived by the owner on Mar 5, 2026. It is now read-only.

eco.json is now an npm package - #40

Merged
JeffML merged 8 commits into
omuryanikoglu:masterfrom
JeffML:master
Dec 8, 2025
Merged

JeffML merged 8 commits into
omuryanikoglu:masterfrom
JeffML:master

Conversation

@JeffML

@JeffML JeffML commented Dec 8, 2025

Copy link
Copy Markdown
Collaborator

added a /methods folder with functions for reading eco.json data files. Package is @chess-openings/eco.json. Usage:

import { openingBook, findOpening, getFromTos } from "@chess-openings/eco.json";

// Load all openings
const openings = await openingBook();

// Look up an opening by FEN
const opening = findOpening(
  openings,
  "rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1"
);

console.log(opening?.name); // "King's Pawn Opening"
console.log(opening?.eco); // "B00"
console.log(opening?.moves); // "1. e4"

- Package structure with src/ and methods/ folders
- Type definitions for Opening, OpeningCollection, etc.
- Methods for fetching and querying opening data:
  - getLatestEcoJson() - Download ECO data from GitHub
  - openingBook() - Merged opening collection
  - findOpening() - Lookup by FEN with position fallback
  - getPositionBook() - Position-only FEN mapping
  - getFromToIndex() - Download transition index
  - getFromTos() - Get next/from openings with enrichment
- CI workflow for type checking and build verification
- Comprehensive copilot instructions for AI agents
- Build configuration with TypeScript 5.3, ES2022 target
- Update version to 0.1.0-beta.0
- Add NPM_README.md with API documentation
- Published to npm as @chess-openings/eco.json@beta
…Roots

- Add methods/queryOpenings.ts with 3 new query utilities
- getOpeningsByEco: Filter by ECO code (e.g., B12)
- getOpeningsByEcoCategory: Filter by category (A-E)
- getEcoRoots: Return only canonical ECO root variations
- Update exports and NPM_README.md documentation
- Bump version to 0.1.0-beta.1
- Published to npm
- Renamed NPM_README.md to README.md (comprehensive documentation)
- Removed original README.md (content now fully integrated)
- Updated package.json to remove NPM_README.md from files array
  (README.md is included by default in npm packages)

Single README now serves both GitHub and npm audiences with complete:
- API reference
- Data structure documentation
- Opening object schema and field descriptions
- Query and transition methods
- Source information and acknowledgements
- NPM version and downloads
- MIT license badge
- TypeScript and Node.js version badges
- Bundle size (bundlephobia)
- GitHub stars
Promote from beta to stable release. Package includes:
- 9 methods for consuming chess opening data
- Complete TypeScript support
- On-demand data loading from GitHub
- 12,000+ chess openings with ECO codes
- Opening transitions and query utilities
@JeffML
JeffML merged commit 448cadb into omuryanikoglu:master Dec 8, 2025
1 check failed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant