Modernize toolchain: deps, vitest, tsc build + code-quality fixes#19
Open
JackDevAU wants to merge 6 commits into
Open
Modernize toolchain: deps, vitest, tsc build + code-quality fixes#19JackDevAU wants to merge 6 commits into
JackDevAU wants to merge 6 commits into
Conversation
… 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>
Member
Author
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: JackDevAU <57518417+JackDevAU@users.noreply.github.com>
Done in 8e31019. Two conflicts resolved:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Toolchain modernization and code-quality pass. Branched off
jp/update-ci,so the diff against
mainalso 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 tscvite 8. Pin
@types/nodeto^22to match the Node target.@tinacms/scripts1.6.x changedits jest config export and switched to babel-jest, which can't parse TS.
Adds
vitest.config.ts, removesjest.config.js.@tinacms/scriptsbuild with plaintsc. The old build neverbundled (deps were always external), so
tscproduces an identical single-fileESM output. This drops a large transitive toolchain — and
esbuildwith it, sopnpm-workspace.yaml(which only existed to allow esbuild's build script) isremoved.
tsconfig:moduleResolutionnode → bundler, explicittypes: ["node"],targetES6 → ES2022 (nativeasync/await, no downlevel helpers), dropemitDeclarationOnly.isomorphic-fetch(Node 22 has nativefetch) and@types/tape(suite.test.jsis plain JS, excluded from tsconfig).fix: correct _getMany key encoding and harden key lookups_getManylooked up values by the raw key, but@upstash/redishmgetkeysits result object by the encoded field names — so any key needing
encodeURIComponent(unicode, spaces) silently returnedundefined. Now looksup by the encoded key.
_getManyand the iterator's value lookup withObject.hasOwnso a__proto__key returnsundefinedinstead of a prototype value._delkey param typedBuffer→string(store is utf8-only).query[3]assignment;console.log(e)→console.error(e).test: add del/getMany/not-found coveragedel,getMany(incl. a unicode-key case that would have caughtthe encoding bug above), and the not-found error path. Coverage 71% → ~79%.
Test plan
pnpm build— emitsdist/index.js+dist/index.d.ts, no downlevel helperspnpm types— cleanpnpm test(vitest) — 14 passed, 2 skippedpnpm test:suite(tape conformance) — 3770/3772; the 2 failures are apre-existing serverless-redis-http lexicographic-ordering issue, unrelated
🤖 Generated with Claude Code