Skip to content

Modernize toolchain: deps, vitest, tsc build + code-quality fixes#19

Open
JackDevAU wants to merge 6 commits into
mainfrom
jp/deps-vitest-cleanup
Open

Modernize toolchain: deps, vitest, tsc build + code-quality fixes#19
JackDevAU wants to merge 6 commits into
mainfrom
jp/deps-vitest-cleanup

Conversation

@JackDevAU
Copy link
Copy Markdown
Member

Summary

Toolchain modernization and code-quality pass. Branched off jp/update-ci,
so the diff against main also includes that branch's earlier CI commits
(0dedc26, 55ab60a) — this PR bundles everything for a single review.

The three commits added by this branch:

chore: upgrade deps, migrate to vitest, replace @tinacms/scripts with tsc

  • Upgrade all dependencies to latest (minor then major): TypeScript 6, vitest 4,
    vite 8. Pin @types/node to ^22 to match the Node target.
  • Migrate the test runner from jest to vitest — @tinacms/scripts 1.6.x changed
    its jest config export and switched to babel-jest, which can't parse TS.
    Adds vitest.config.ts, removes jest.config.js.
  • Replace the @tinacms/scripts build with plain tsc. The old build never
    bundled (deps were always external), so tsc produces an identical single-file
    ESM output. This drops a large transitive toolchain — and esbuild with it, so
    pnpm-workspace.yaml (which only existed to allow esbuild's build script) is
    removed.
  • tsconfig: moduleResolution node → bundler, explicit types: ["node"],
    target ES6 → ES2022 (native async/await, no downlevel helpers), drop
    emitDeclarationOnly.
  • Prune unused deps: isomorphic-fetch (Node 22 has native fetch) and
    @types/tape (suite.test.js is plain JS, excluded from tsconfig).

fix: correct _getMany key encoding and harden key lookups

  • _getMany looked up values by the raw key, but @upstash/redis hmget keys
    its result object by the encoded field names — so any key needing
    encodeURIComponent (unicode, spaces) silently returned undefined. Now looks
    up by the encoded key.
  • Guard _getMany and the iterator's value lookup with Object.hasOwn so a
    __proto__ key returns undefined instead of a prototype value.
  • _del key param typed Bufferstring (store is utf8-only).
  • Remove a redundant query[3] assignment; console.log(e)console.error(e).

test: add del/getMany/not-found coverage

  • Adds tests for del, getMany (incl. a unicode-key case that would have caught
    the encoding bug above), and the not-found error path. Coverage 71% → ~79%.

Test plan

  • pnpm build — emits dist/index.js + dist/index.d.ts, no downlevel helpers
  • pnpm types — clean
  • pnpm test (vitest) — 14 passed, 2 skipped
  • pnpm test:suite (tape conformance) — 3770/3772; the 2 failures are a
    pre-existing serverless-redis-http lexicographic-ordering issue, unrelated
  • CI green

🤖 Generated with Claude Code

JackDevAU and others added 5 commits May 11, 2026 15:48
… tsc

Modernizes the toolchain in one pass:

- Upgrade all dependencies to latest (minor then major): TypeScript 6,
  vitest 4, vite 8, @types/node pinned to ^22 to match the Node target.
- Migrate the test runner from jest to vitest. @tinacms/scripts 1.6.x
  changed its jest config export and switched to babel-jest, which could
  not parse TypeScript; rather than patch around it, drop jest entirely.
  Adds vitest.config.ts, removes jest.config.js.
- Replace the @tinacms/scripts build with plain `tsc`. The previous build
  never bundled (deps were always external), so tsc produces an identical
  single-file ESM output. This drops a large transitive toolchain, and
  with it esbuild, so pnpm-workspace.yaml (which existed solely to allow
  esbuild's build script) is no longer needed.
- tsconfig: moduleResolution node->bundler and explicit types:["node"]
  for TS 6; target ES6->ES2022 so tsc emits native async/await instead
  of downlevel helpers; drop emitDeclarationOnly so `build` emits JS too.
- Prune unused deps: isomorphic-fetch (Node 22 has native fetch) and
  @types/tape (suite.test.js is plain JS, excluded from tsconfig).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- _getMany looked up values with the raw key, but @upstash/redis hmget
  keys its result object by the field names passed in (the encoded
  keys). Any key needing encodeURIComponent (unicode, spaces, etc.)
  silently returned undefined. Look up by the encoded key.
- Guard _getMany and the iterator's value lookup with Object.hasOwn so
  a key like '__proto__' returns undefined instead of a prototype value.
- _del declared its key param as Buffer; the store only uses utf8, so
  it is always a string. Correct the type.
- Drop a redundant query[3] assignment in queryFromOptions that exactly
  duplicated the tuple initializer.
- console.log(e) -> console.error(e) in the catch blocks.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Coverage was 71% with no tests for del, getMany, or the not-found
error path. Adds three tests, including a getMany case with a unicode
key that exercises the encode/decode round-trip (and would have caught
the _getMany encoding bug). Coverage is now ~79%.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@JackDevAU
Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

Co-authored-by: JackDevAU <57518417+JackDevAU@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI commented May 15, 2026

@copilot resolve the merge conflicts in this pull request

Done in 8e31019. Two conflicts resolved:

  • .github/workflows/main.yml: adopted client-id from main (fixes the publish job — app-id was deprecated and rejected the non-numeric Client ID stored in BOT_APP_ID).
  • package.json: kept pnpm@11.1.2 (our newer version over main's 11.0.9).
  • pnpm-workspace.yaml: kept deleted (no longer needed after dropping @tinacms/scripts/esbuild).

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.

2 participants