Every major the project had been sitting on, brought current. No user-facing
feature changes; the app should behave identically.
React 18 → 19 (+ types, @vitejs/plugin-react 6)
Tailwind 3 → 4
ESLint 9 → 10 (+ eslint-plugin-react-hooks 5 → 7)
Zustand 4 → 5
i18next 23 → 26, react-i18next 15 → 17
@testing-library/*, typescript-eslint 8.67, Vite/Vitest/tsx/knip patches
**React 19** needed exactly one source change: `useRef<T>(null)` is now typed
`RefObject<T | null>` rather than `RefObject<T>`. The old type quietly claimed a
ref was non-null before its element mounted; ScrollToTopButton now matches,
which makes its existing null check honest rather than defensive.
**Tailwind 4** moves configuration from `tailwind.config.ts` (deleted) into
CSS. The tokens live in an `@theme` block that maps Tailwind's names onto the
existing `:root` / `.light` variables, so the runtime theme toggle still owns
the values and keeps working untouched. `darkMode: "class"` becomes
`@custom-variant dark` — the app toggles a class on <html> rather than
following the OS, so the default prefers-color-scheme variant would be wrong.
Verified in the browser in both themes; a CSS migration fails visually, not at
build time.
**The lint upgrade earned its keep.** `react-hooks/set-state-in-effect` (new in
v7, React Compiler-aware) flagged seven sites. Four were real extra render
passes:
- use-online-status rewritten to `useSyncExternalStore`. It had been
re-reading `navigator.onLine` inside an effect to close the gap between
first render and the listeners attaching — subscribing properly removes the
gap instead of patching it.
- ShortcutHelpModal derives its filter from `open` instead of resetting state
in an effect, so a modal that is closed most of the time stops scheduling
work on unrelated parent updates.
- DraftIndicator and use-languages-ready now guard their setters.
Three remain as warnings, deliberately. They genuinely sync state FROM an
external source (i18next bundle readiness, a text mirror of a numeric store
field, a useMemo the compiler cannot preserve) and need a restructure rather
than a guard. Recorded in eslint.config.js with the reason — downgraded, not
silenced, and not a reason to hold back ESLint 10.
**lucide-react deliberately stays at 0.577.0.** 1.x removes every brand icon;
upstream dropped them for trademark reasons. Taking it would mean either a
generic globe beside a Facebook link or re-adding the marks ourselves and
inheriting the exposure lucide just shed. 0.577 already delivered the win —
main bundle 175 kB → 137 kB.
knip now ignores `tailwindcss`: after the migration its only reference is
`@import "tailwindcss"` in CSS, which knip does not follow.
Full gate green — typecheck, typecheck:all, lint, format:check,
validate:locales, knip, check:version, 692 tests, build — plus a browser check
of both themes with the editor and batch pages functional.
0.36.0 is reserved for the two new locales.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
112 lines
3.9 KiB
TypeScript
112 lines
3.9 KiB
TypeScript
/**
|
|
* Verify that every manifest carrying the app version agrees.
|
|
*
|
|
* A release bumps SIX places, and nothing but this script notices when one is
|
|
* missed. A stale `tauri.conf.json` ships an installer whose About screen and
|
|
* updater metadata disagree with the tag; a stale `Cargo.lock` self-entry makes
|
|
* the next `cargo build` rewrite the lockfile mid-release.
|
|
*
|
|
* Run via `npm run check:version`. Exits non-zero (and prints every mismatch,
|
|
* not just the first) so CI fails the PR rather than the release.
|
|
*/
|
|
import { readFileSync } from "fs";
|
|
import { resolve } from "path";
|
|
|
|
interface VersionSource {
|
|
/** Human-readable location, printed on mismatch. */
|
|
label: string;
|
|
/** Repo-relative path. */
|
|
file: string;
|
|
/** Pull the version out of the file's raw text. */
|
|
extract: (raw: string) => string | null;
|
|
}
|
|
|
|
/** Read `version` from a top-level JSON object. */
|
|
function jsonVersion(raw: string): string | null {
|
|
const parsed: unknown = JSON.parse(raw);
|
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
const version = (parsed as Record<string, unknown>).version;
|
|
return typeof version === "string" ? version : null;
|
|
}
|
|
|
|
const SOURCES: VersionSource[] = [
|
|
{
|
|
label: "package.json → version",
|
|
file: "package.json",
|
|
extract: jsonVersion,
|
|
},
|
|
{
|
|
label: "package-lock.json → version",
|
|
file: "package-lock.json",
|
|
extract: jsonVersion,
|
|
},
|
|
{
|
|
label: 'package-lock.json → packages[""].version',
|
|
file: "package-lock.json",
|
|
extract: (raw) => {
|
|
const parsed: unknown = JSON.parse(raw);
|
|
if (typeof parsed !== "object" || parsed === null) return null;
|
|
const packages = (parsed as Record<string, unknown>).packages;
|
|
if (typeof packages !== "object" || packages === null) return null;
|
|
const root = (packages as Record<string, unknown>)[""];
|
|
if (typeof root !== "object" || root === null) return null;
|
|
const version = (root as Record<string, unknown>).version;
|
|
return typeof version === "string" ? version : null;
|
|
},
|
|
},
|
|
{
|
|
label: "src-tauri/tauri.conf.json → version",
|
|
file: "src-tauri/tauri.conf.json",
|
|
extract: jsonVersion,
|
|
},
|
|
{
|
|
label: "src-tauri/Cargo.toml → [package] version",
|
|
file: "src-tauri/Cargo.toml",
|
|
// Anchor on the [package] table so a dependency's `version = "…"` in the
|
|
// same file can never be picked up instead.
|
|
extract: (raw) => /^\[package\][\s\S]*?^version\s*=\s*"([^"]+)"/m.exec(raw)?.[1] ?? null,
|
|
},
|
|
{
|
|
label: "src-tauri/Cargo.lock → yt-desc-gen entry",
|
|
file: "src-tauri/Cargo.lock",
|
|
extract: (raw) => /^name = "yt-desc-gen"\r?\nversion = "([^"]+)"/m.exec(raw)?.[1] ?? null,
|
|
},
|
|
];
|
|
|
|
function main(): void {
|
|
const found: { label: string; version: string | null }[] = SOURCES.map((source) => {
|
|
let raw: string;
|
|
try {
|
|
raw = readFileSync(resolve(source.file), "utf8");
|
|
} catch {
|
|
return { label: source.label, version: null };
|
|
}
|
|
try {
|
|
return { label: source.label, version: source.extract(raw) };
|
|
} catch {
|
|
return { label: source.label, version: null };
|
|
}
|
|
});
|
|
|
|
const missing = found.filter((entry) => entry.version === null);
|
|
const versions = [...new Set(found.map((entry) => entry.version).filter(Boolean))];
|
|
|
|
if (missing.length === 0 && versions.length === 1) {
|
|
console.log(`✓ All ${found.length} manifests agree on version ${versions[0]}`);
|
|
return;
|
|
}
|
|
|
|
console.error("✗ Version manifests are out of sync.\n");
|
|
for (const entry of found) {
|
|
const mark = entry.version === null ? "?" : entry.version === versions[0] ? " " : "!";
|
|
console.error(` ${mark} ${entry.version ?? "<not found>"} ${entry.label}`);
|
|
}
|
|
console.error(
|
|
"\nBump every manifest to the same version before tagging. `npm version --no-git-tag-version <v>`",
|
|
);
|
|
console.error("covers package.json + package-lock.json; the three Rust/Tauri files are manual.");
|
|
process.exit(1);
|
|
}
|
|
|
|
main();
|