Skip to content

Tags: singer0503/play-kit

Tags

v0.4.3

Toggle v0.4.3's commit message
fix(smash-egg): swing an upright gavel from right to left

v0.4.2

Toggle v0.4.2's commit message
fix(smash-egg): anchor hammer to egg artwork and release 0.4.2

v0.4.1

Toggle v0.4.1's commit message
fix(ci): pin trusted publish npm version

v0.4.0

Toggle v0.4.0's commit message
chore(release): @play-kit/games@0.4.0

CHANGELOG entry:把 0.4.0 的兩道 CI audit(check:readme + e2e:audit)
+ React 19 types upgrade + useGameScale return type 精準化整合說明。

Lib runtime 行為與 0.3.0 完全一致;本版專注於把現有承諾納入自動化驗證。

Verification:
- pnpm -r typecheck ✓
- pnpm lint ✓ 259 files
- pnpm -r test ✓ 509 tests
- pnpm check:docs ✓
- pnpm check:readme ✓ 17 rows
- pnpm check:ssr ✓ 17 games
- pnpm smoke:published ✓ 8/8
- pnpm e2e:audit ✓ 17/17 in 6.9s

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

v0.3.0

Toggle v0.3.0's commit message
feat: @play-kit/games@0.3.0 — sub-path imports + tree-shaking 解放

從 consumer DX 角度做完整 e2e review 後的大版本,整合 0.2.2 的 docs/types
fix(從未發布)+ 解決 #4 dts rollup + #5 tree-shaking 兩個結構性問題。

## 核心:tree-shaking 解放
實測(esbuild minify + gzip,external react):

  只用 LuckyWheel:    70.95 KB → 11.43 KB  (-84%)
  全 17 款 game:      76.21 KB → 79.90 KB  (持平)

multi-entry build 副作用:main barrel 寫法(既有 0.1/0.2 用戶)也精準
tree-shake,不改一行 import 升級即可受益。

## 新增 API:sub-path imports
17 款 game / core / i18n 各自有 sub-path:

  import { LuckyWheel } from '@play-kit/games/lucky-wheel';
  import { PlayKitProvider } from '@play-kit/games/i18n';
  import { useGameScale } from '@play-kit/games/core';

## Internal
- vite.config.ts: 1 entry → 19 entry, rollup 自動切 shared chunks
- package.json: exports map 加 19 條 sub-path(types/import/require 三條件)
- vite-plugin-dts: rollupTypes 改 false(每個 sub-path 自家 d.ts,IDE
  go-to-definition 跳到聚焦小檔,比單檔 924 行 rolled-up 體驗好)
- 移除 build script 的 `tsc --emitDeclarationOnly`(plugin 已負責 emit;
  雙跑會吐 152 個冗餘 d.ts —— 這就是為什麼 0.2.x 看起來 dts rollup 失效)

## CI: bundle size budget
smoke-published.mjs 從 6 → 8 檢查:
  #7  17 款 game + core + i18n sub-path import 全部可解析
  #8  bundle size 預算(only-LuckyWheel ≤ 6 KB gzip / 全 17 款 ≤ 30 KB
      gzip),超標 CI fail 直接擋

## 同梱(0.2.2 從未發布,整合進 0.3.0)
- @play-kit/games/styles.css 補 dist/styles.css.d.ts(strict TS 不再 TS2882)
- README events 對照表 17 款全面對齊 d.ts(之前 12/17 不準)
- README 加「測試環境(非 bundler runtime)」一節(Vitest/Jest CSS handling)

## Migration v0.2.x → v0.3.0
完全相容。可選:把 from '@play-kit/games' 改成 from '@play-kit/games/<id>'
表達意圖;不改也照樣 tree-shake。

## Verification
- typecheck / lint / 509 tests / check:docs / check:ssr 全綠
- smoke:published 8/8 pass(含 sub-path 解析 + bundle budget)
- 在乾淨 /tmp/pk-smoke 從本地 tarball install 跑 README quickstart 範例:
  strict TS 0 error,bundle 4.83 KB gzip

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

v0.2.1

Toggle v0.2.1's commit message
fix(build): @play-kit/games@0.2.1 — CJS bundle no longer requires .css

0.2.0 published artifact 在純 Node CJS 環境(Jest 預設、SSR 部分情境、
`node -e "require('@play-kit/games')"` smoke test)會 SyntaxError —
因為 dist/index.cjs 第一行 require('./index.css'),Node 沒有 CSS loader 把
CSS 規則當 JS 解析。

修法:
- 移除 vite-plugin-lib-inject-css(plugin 對 ESM/CJS 一視同仁地產
  import/require './index.css',CJS 路徑無解)
- src/index.ts 維持 import './styles.css' 作為 CSS 收集 trigger(vite
  library mode 在沒有 inject plugin 的情況下不會把 CSS import 寫進 JS bundle)
- assetFileNames rename 規則重新生效,CSS 輸出回到 dist/styles.css,
  exports 「./styles.css」也改回指向 dist/styles.css

驗證(從 npm pack 出 tarball、在 /tmp/pk-smoke 真實安裝測試):
- node CJS require:38 exports,17 款 game 全在
- node ESM dynamic import:同上
- require.resolve('@play-kit/games/styles.css') → 64.9 KB 真實檔
- typecheck / lint / test (509) / check:docs / check:ssr 全綠
- dist/index.cjs head 不再含 require('./index.css')
- dist/index.css → dist/styles.css (CSS bundle 大小 64.91 KB / gzip 10.19 KB 不變)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

v0.2.0

Toggle v0.2.0's commit message
chore(release): prep @play-kit/games 0.2.0 publish

修 publish 前置條件:
- 補 packages/games/README.md(缺檔會讓 npm 頁面只剩 title)
- 補 packages/games/LICENSE(package.json 標 MIT 但無檔)
- 修 ./styles.css export path:./dist/styles.css → ./dist/index.css(vite-plugin-lib-inject-css 實際輸出檔名)
- files 加上 LICENSE
- 根 CHANGELOG.md 改成指向 packages/games/CHANGELOG.md(Changesets 權威來源)

驗證:typecheck / lint / test (509) / check:docs / check:ssr 全綠;
npm pack --dry-run tarball 含 README.md (8.7kB) / LICENSE (1.1kB) / CHANGELOG.md (2.4kB) / dist/**

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>