Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency chess.js to v1 #90

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

renovate[bot]
Copy link

@renovate renovate bot commented Jan 11, 2025

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
chess.js 0.12.0 -> 1.0.0 age adoption passing confidence

Release Notes

jhlywa/chess.js (chess.js)

v1.0.0

Compare Source

v1.0.0

A big thank you to all the contributors that helped make this release possible! This is a major version update and there are many new features and breaking changes. Please read below for more info.

Typescript

chess.js has been rewritten in TypeScript. Exported types are as follows:

  • Chess object
  • Move object
  • Piece
  • Color
  • Square
  • PieceSymbol
  • Move

New Methods

  • attackers(square, color) - returns a list of squares occupied by pieces of color that are attacking the given square
  • getCastlingRights(color) - returns { k: boolean, q: boolean } indicating castling rights for color
  • setCastlingRights(color, rights)
  • isAttacked(square, color) - returns true if square is attacked by color
  • isDrawByFiftyMoves()
  • moveNumber()
  • setHeader(key, value), removeHeader(key), getHeaders()
  • removeComment(), removeComments()

Breaking Changes

Exceptions instead of null

The following functions no longer return null when an error occurs. Instead, they now throw exceptions to provide the user with more detailed error information.

  • .load()
  • .loadPgn()
  • .move()
  • Chess() constructor
Function Names

The functions below have been converted to camel-case:

  • game_over -> isGameOver
  • in_check -> isCheck
  • in_checkmate -> isCheckmate
  • in_draw -> isDraw
  • is_stalemate -> isStalemate
  • in_threefold_repetition -> isThreefoldRepetition
  • insufficient_material -> isInsufficientMaterial
  • load_pgn -> loadPgn
  • set_comment -> setComment
  • get_comment -> getComment
  • get_comments -> getComments
  • delete_comment -> deleteComment
  • delete_comments -> deleteComments
  • validate_fen -> validateFen
Function Arguments and Return Values

The arguments and return values for the following functions have changed:

  • load_pgn(pgn, { sloppy: true }) becomes loadPgn(pgn) (strict defaults to false)
  • move('Nb7', { sloppy: true }) becomes moves('Nb7')
  • clear(true) should now be written as clear({ preserveHeader: true })
  • load(fen, true) should now be written as load(fen, { preserveHeader: true })
  • validateFen(fen) now returns { ok: boolean, error?: string }
Deprecations
  • The flags field in the Move object is deprecated. Use the new helper methods below to determine the move type:
    • .isCapture() - is the move a regular capture? NOTE: this is false for an en-passant
    • .isEnPassant() - is the move an en-passant capture?
    • .isBigPawn() - is the move a 2-rank pawn move?
    • .isPromotion() - is the move a pawn promotion?
    • .isKingsideCastle() - is the move a kingside castle?
    • .isQueensideCastle() - is the move a queenside castle?
  • The header function has been deprecated in favor of setHeader and getHeaders
  • The deleteComment and deleteComments functions have deprecated in favor of removeComment and removeComments

Improvements

Bug Fixes

v0.13.4

Compare Source

Bug Fixes

  • [PGN] Fix bug that omitted comments preceding the initial move of a setup position when black is the first to move.

v0.13.3

Compare Source

Bug Fixes

Changes

v0.13.2

Compare Source

Bug Fixes

v0.13.1

Compare Source

Bug Fixes

v0.13.0

Compare Source

Enhancements

v0.12.1

Compare Source

Bug Fixes

  • [PGN] Fix duplication of last move when loading PGN containing trailing comments without a game termination marker (@​jhlywa - 321a25e)
  • [PGN] Fix PGN export that included unnecessary move disambiguators (@​SyntaxBlitz - 1814427)

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants