Skip to content

Expand the unreleased changelog entry - #19

Merged
laat merged 1 commit into
masterfrom
claude/repo-modernize-harden-qjh99r
Sep 5, 2026
Merged

laat merged 1 commit into
masterfrom
claude/repo-modernize-harden-qjh99r

Conversation

@laat

@laat laat commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Summary

The Unreleased entry written in #16 and #17 listed what changed in the repository but not what a user of <chess-board> will notice. This rewrites it into four groups and fills the gaps.

Behaviour changes for users of the element (new section)

  • The stricter input validation inherited from fen-chess-board@4, with the version 3 behaviour each case replaces, verified by running both versions side by side:
    • fen = ... throws on more than eight ranks, a rank longer than eight squares, or the digits 0/9; the board is left unchanged. v3 silently truncated or dropped such input.
    • piece(), put(), clear(), move() throw Invalid square outside a1–h8. v3 crashed with a TypeError or corrupted the board.
    • put() throws Invalid piece for anything that is not a single non-FEN-syntax character. v3 accepted "QQ" and produced unparseable FEN.
  • move(square, square) is now a no-op instead of clearing the piece.
  • Malformed FEN in text content: console.warn and keep the current position (already listed, moved here).
  • The published bundle now targets Vite 8's baseline-widely-available browsers (roughly Chrome/Edge 107, Firefox 104, Safari 16) and uses Object.hasOwn; 2.0 targeted Chrome 87 / Firefox 78 / Safari 14.

Fixed / Changed: the double-registration guard, dropped test declarations, SVG template caching, border-spacing replacing deprecated attributes, plus the previously unlisted shipped sourcemap, ./package.json export and derived Rank type.

Development: toolchain, stricter tsconfig, pnpm policies (and the removed esbuild allow-list), test coverage, CI hardening, zizmor, Dependabot scope and why the library's deps are excluded, staged release flow, preview deploys, backfilled 2.0.2/2.0.3 entries.

The readme Methods section now states the square and piece validation in one sentence, since it documents the API these rules apply to.

Suggested version: 2.1.0

  • Nothing in the intended API changed: same attributes, properties, methods and exported types.
  • The new throws only affect inputs that were never valid and previously produced a corrupt board or a TypeError. Under semver that is a bug fix, not a breaking change, although anyone feeding untrusted FEN to the fen setter without a try/catch will now see exceptions instead of garbage.
  • There are additive changes (sourcemap, ./package.json export, double-import safety), which is what makes this a minor rather than a patch.
  • The one argument for 3.0.0 is the raised browser baseline from Vite 8's default target. 2.0.0 already declared "modern browsers only" and Chrome 107 / Safari 16 are from late 2022, so I would not cut a major for it. If you treat browser support as part of the public contract, make it 3.0.0 and this changelog entry already states the change.

Recommendation: release as 2.1.0. Rename the Unreleased heading to 2.1.0 / <date> when tagging.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ChaqSMq3tG8bvWgpJBmdGC


Generated by Claude Code

Group the entry into behaviour changes, fixes, changes and development, and
spell out what consumers of the element will notice: the stricter input
validation inherited from fen-chess-board 4 (with the version 3 behaviour
each case replaces), the same-square move fix, the raised browser baseline
from Vite 8, the shipped sourcemap and package.json export. The readme
Methods section now states the square and piece validation too.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ChaqSMq3tG8bvWgpJBmdGC
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

@laat
laat marked this pull request as ready for review September 5, 2026 19:24
@laat
laat merged commit ee3ab23 into master Sep 5, 2026
6 checks passed
@laat
laat deleted the claude/repo-modernize-harden-qjh99r branch September 5, 2026 19:24
laat added a commit that referenced this pull request Sep 5, 2026
## Summary

The package is one TypeScript file with one ESM import; nothing in it
needs a bundler. Since 2.0.0 the published `dist/chess-board.js` has
nevertheless been a Vite library bundle with `fen-chess-board` inlined
and identifiers mangled. This PR publishes what `tsc` emits instead.

- `pnpm build` is now `tsc -p tsconfig.build.json`. Output: readable
ES2022 `dist/chess-board.js`, `chess-board.d.ts`, plus `.js.map` and
`.d.ts.map`. `src/chess-board.ts` ships in the package (tests excluded)
so both maps resolve and go-to-definition lands in the TypeScript
source.
- `fen-chess-board` moves from a bundled devDependency to `dependencies`
(`^4.0.0`). Consumers' lockfiles now pin and audit it like any other
dependency.
- `vite.config.ts` loses `build.lib`; Vite only serves/builds the demo
site and runs the tests.
- Readme gets a "Without a bundler" section showing a self-hosted import
map for the dependency. No CDN is recommended.
- Changelog: new **Breaking** section for this change; the
browser-support bullet now describes ES2022 as written (roughly
Chrome/Edge 94, Firefox 93, Safari 15.4) rather than Vite's down-level
target.

## What breaks

Loading `dist/chess-board.js` directly from a `<script type="module">`
tag with no bundler and no import map stops working, because the file
now contains `import FENBoard from "fen-chess-board"`. Bundlers are
unaffected, and buildless pages work again with an import map pointing
`fen-chess-board` at a self-hosted copy. The demo site goes through Vite
and is unaffected.

## Verification

- `pnpm typecheck`, `pnpm test` (27 passing), `pnpm build`, `pnpm
build:pages` green; `pnpm install --frozen-lockfile` passes with the
updated lockfile.
- Packed the tarball and installed it into a scratch project with npm:
`fen-chess-board` is pulled in as a dependency, `import "chess-board"`
resolves through `exports`, and under happy-dom the element renders the
start position and reports `piece("e1") === "K"`.
- Tarball contents: `dist/` (4 files), `src/chess-board.ts`, `license`,
`package.json`, `readme.md`. No test files, no `packageManager` field.

## Suggested version: 3.0.0

This supersedes the 2.1.0 recommendation from #19. The bare `<script>`
tag case is a real, if niche, way people used the 2.x file, and it
breaks; under semver that is a major. It also gives a clean line for the
stricter input validation and the ES2022 baseline already listed in the
Unreleased entry, so all of the "you may notice this" changes land in
one major instead of being argued into a minor. Rename the `Unreleased`
heading to `3.0.0 / <date>` when tagging.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01ChaqSMq3tG8bvWgpJBmdGC

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant