Merge pull request #258 from poli0981/ci/qodana

ci(qodana): add Qodana for TypeScript and Rust
This commit is contained in:
poli0981 authored and GitHub committed 2026-11-17 10:46:27 +07:00
commit 731e194a70
25 files changed
+356 -123

No files matched your search

+3 -3
View File
@@ -3,9 +3,9 @@ name: Notify CI Failures
on:
workflow_run:
# Match the exact `name:` of each watched workflow (ci.yml, security.yml,
# compliance.yml, rust.yml). Renaming one silently breaks this filter —
# keep them in sync.
workflows: ["CI", "Security", "Compliance", "Rust"]
# compliance.yml, rust.yml, qodana.yml). Renaming one silently breaks
# this filter — keep them in sync.
workflows: ["CI", "Security", "Compliance", "Rust", "Qodana"]
types: [completed]
# REQUIRED: declare permissions matching the reusable workflow's needs.
+137
View File
@@ -0,0 +1,137 @@
name: Qodana
# JetBrains Qodana static analysis, one linter per Qodana Cloud project:
#
# typescript - qodana-js (native mode) the repository project yt-ts-js, secret QODANA_TOKEN_TS_JS, qodana.yaml
# rust - qodana-rust (Docker, EAP) src-tauri/ project yt-rust, secret QODANA_TOKEN_RUST, src-tauri/qodana.yaml
#
# Every run analyses the whole project (`pr-mode: false`), so a pull request
# and `main` report the same way, and each qodana.yaml holds a quality gate of
# zero problems. Results: Qodana Cloud, check annotations on the run, and the
# qodana-report-* artifacts (SARIF and logs). Not a required check.
#
# Both linters need an Ultimate licence; the account runs the Qodana Ultimate
# trial. When the licence lapses, both jobs fail at the licence check: renew
# it, or delete this file and the two qodana.yaml files.
#
# PRs from forks and from Dependabot get no repository secrets: the `tokens`
# job sees that, and the analysis is skipped there, not failed — main is
# analysed once they merge. The token reaches the scan step only: npm
# packages are installed in a step that never sees it.
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions: {}
concurrency:
group: qodana-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
tokens:
name: Qodana tokens
runs-on: ubuntu-latest
timeout-minutes: 5
permissions: {}
outputs:
ts-js: ${{ steps.check.outputs.ts-js }}
rust: ${{ steps.check.outputs.rust }}
steps:
- name: Check which Qodana tokens this run has
id: check
env:
HAS_TS_JS: ${{ secrets.QODANA_TOKEN_TS_JS != '' }}
HAS_RUST: ${{ secrets.QODANA_TOKEN_RUST != '' }}
run: |
echo "ts-js=$HAS_TS_JS" >> "$GITHUB_OUTPUT"
echo "rust=$HAS_RUST" >> "$GITHUB_OUTPUT"
if [ "$HAS_TS_JS" != true ] || [ "$HAS_RUST" != true ]; then
echo "::notice::No Qodana token in this run (a Dependabot or fork pull request): that analysis is skipped."
fi
typescript:
name: TypeScript / JavaScript
needs: tokens
if: needs.tokens.outputs.ts-js == 'true'
runs-on: ubuntu-latest
timeout-minutes: 40
permissions:
contents: read
checks: write # the action's annotations
steps:
# The pull request's own head commit, not the merge GitHub makes, so
# the report names a commit that exists; full history for its VCS data.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .node-version
cache: npm
# The linter resolves imports and types from node_modules. No lifecycle
# scripts, as in every workflow (ci.yml says why).
- run: npm ci --ignore-scripts
# Native mode: the linter runs on this runner's Node 26 and node_modules
# instead of the older Node the Qodana image ships.
- name: Qodana scan
uses: JetBrains/qodana-action@3e8d76ff0e0241618abd808682f426afe84bab3f # v2026.2.2
with:
args: --linter qodana-js --within-docker false
pr-mode: false
post-pr-comment: false
upload-result: true
artifact-name: qodana-report-typescript
primary-cache-key: qodana-2026.2-js-${{ github.ref }}-${{ github.sha }}
# A prefix, so pull requests can restore the cache saved on main.
additional-cache-key: qodana-2026.2-js-
cache-default-branch-only: true
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_TS_JS }}
rust:
name: Rust (Early Access)
needs: tokens
if: needs.tokens.outputs.rust == 'true'
runs-on: ubuntu-latest
timeout-minutes: 45
permissions:
contents: read
checks: write # the action's annotations
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
persist-credentials: false
# tauri::generate_context!() refuses to expand without the frontend
# directory (frontendDist, ../dist): an empty page stands in for the web
# build, which the analysis does not need. The icons are committed.
- name: Stand-in for the web build
run: |
mkdir -p dist
echo '<!doctype html><title>stand-in</title>' > dist/index.html
# qodana-rust ships only as a Docker image. It runs as root so that the
# bootstrap in src-tauri/qodana.yaml can install the C toolchain and the
# libraries Tauri links against — without them `cargo check` fails and
# the linter loads no Cargo package. The crates go to the cached Qodana
# directory. --repository-root keeps ../dist and the git data visible.
- name: Qodana scan
uses: JetBrains/qodana-action@3e8d76ff0e0241618abd808682f426afe84bab3f # v2026.2.2
with:
args: --project-dir src-tauri --repository-root . --linter qodana-rust -u root -e CARGO_HOME=/data/cache/cargo
pr-mode: false
post-pr-comment: false
upload-result: true
artifact-name: qodana-report-rust
primary-cache-key: qodana-2026.2-rust-${{ github.ref }}-${{ github.sha }}
# A prefix, so pull requests can restore the cache saved on main.
additional-cache-key: qodana-2026.2-rust-
cache-default-branch-only: true
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_RUST }}
+14 -13
View File
@@ -11,19 +11,19 @@
## Tech Stack
| Layer | Technology |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| UI | React 19, TypeScript 7 (strict), Radix primitives (`radix-ui`), Motion (LazyMotion), cmdk, sonner, lucide-react + simple-icons |
| Build | Vite 8 (Rolldown); config imports need `.ts` extensions; Node 26 (`.node-version`) |
| Type checking | TypeScript 7 `tsc` (`@typescript/native`); `typescript` is an npm alias for `@typescript/typescript6`, the 6.0 API typescript-eslint loads |
| Styling | Tailwind CSS 4, CSS-first `@theme` tokens in `src/styles/globals.css` |
| State | Zustand 5 + `persist` (localStorage) — the only store on every platform |
| Routing | React Router 7 — `BrowserRouter` on the web, `HashRouter` in Tauri |
| i18n | i18next + react-i18next, 8 locales (en, vi, ja, es, ko, zh, pt-BR, id); `en` bundled, others lazy |
| Desktop / Android | Tauri 2 (Rust) — see `src-tauri/` |
| Web hosting | Cloudflare Workers (`worker/`, `wrangler.jsonc`), Turnstile, Web Analytics |
| Tests | Vitest (node environment; Worker tests included) |
| Quality | ESLint, Prettier, knip, coverage thresholds, bundle budget, licence allow-list, copyright years, REUSE, actionlint/zizmor, cargo fmt/clippy/deny, SonarCloud (CI-based) |
| Layer | Technology |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| UI | React 19, TypeScript 7 (strict), Radix primitives (`radix-ui`), Motion (LazyMotion), cmdk, sonner, lucide-react + simple-icons |
| Build | Vite 8 (Rolldown); config imports need `.ts` extensions; Node 26 (`.node-version`) |
| Type checking | TypeScript 7 `tsc` (`@typescript/native`); `typescript` is an npm alias for `@typescript/typescript6`, the 6.0 API typescript-eslint loads |
| Styling | Tailwind CSS 4, CSS-first `@theme` tokens in `src/styles/globals.css` |
| State | Zustand 5 + `persist` (localStorage) — the only store on every platform |
| Routing | React Router 7 — `BrowserRouter` on the web, `HashRouter` in Tauri |
| i18n | i18next + react-i18next, 8 locales (en, vi, ja, es, ko, zh, pt-BR, id); `en` bundled, others lazy |
| Desktop / Android | Tauri 2 (Rust) — see `src-tauri/` |
| Web hosting | Cloudflare Workers (`worker/`, `wrangler.jsonc`), Turnstile, Web Analytics |
| Tests | Vitest (node environment; Worker tests included) |
| Quality | ESLint, Prettier, knip, coverage thresholds, bundle budget, licence allow-list, copyright years, REUSE, actionlint/zizmor, cargo fmt/clippy/deny, SonarCloud (CI-based), Qodana (JS + Rust) |
## Project Structure
@@ -184,5 +184,6 @@ npm run generate:brand # favicon, PWA icons, link-preview card from assets/
- UI changes follow the accessibility checklist in `ACCESSIBILITY.md` (#for-contributors): keyboard, names via `Field` / `IconButton`, announced errors, tokens only, reduced motion, 24 px targets. Generated text gets `lang` (the output language); pages name themselves with `useDocumentTitle`, which `RouteAnnouncer` reads out. Update ACCESSIBILITY.md (+ `docs/i18n/vi/`) when what it promises changes.
- Never commit `note.txt`, `warning.txt` or `__pycache__/`; never put real secrets in files (`.dev.vars` holds Cloudflare's public Turnstile test keys only).
- SonarCloud (project `poli0981_youtube-generator`) is CI-based: the `sonarcloud` job in `ci.yml` scans every PR from this repository and every push to `main`, with the coverage from `check`; settings in `sonar-project.properties`; Automatic Analysis is off. Keep it at 0 open issues and the quality gate (Sonar way: A ratings, reviewed hotspots, ≤ 3 % duplication, ≥ 80 % coverage on new code) green — the job fails with the gate. Coverage covers what `coverage.include` in `vitest.config.ts` lists (the logic layers); everything else is in `sonar.coverage.exclusions`, because a file missing from the LCOV report counts as 0 % — a new source folder goes into one list or the other. The version passed to the scanner starts each release's new-code period. Fork and Dependabot PRs skip the scan (no `SONAR_TOKEN`). Check a PR with `https://sonarcloud.io/api/issues/search?componentKeys=poli0981_youtube-generator&pullRequest=<n>&resolved=false` and its gate with `https://sonarcloud.io/api/qualitygates/project_status?projectKey=poli0981_youtube-generator&pullRequest=<n>`. Workflows install with `npm ci --ignore-scripts` and call local binaries (`npm run …`), never `npx` for a package that isn't installed.
- Qodana (`.github/workflows/qodana.yml`) runs on every PR and push to `main`: job `typescript` is Qodana for JS in native mode (`qodana.yaml`, Cloud project `yt-ts-js`, secret `QODANA_TOKEN_TS_JS`), job `rust` is Qodana for Rust, Early Access, in Docker on `src-tauri/` (`src-tauri/qodana.yaml`, project `yt-rust`, secret `QODANA_TOKEN_RUST`). Both gate on zero problems: fix a finding, or exclude it in the `qodana.yaml` with a comment saying why. Both skip without their token (Dependabot and fork PRs). It needs an Ultimate licence (currently the trial): when it lapses both jobs fail at the licence check.
- TypeScript bumps may be manual: `@typescript/native` (`npm:typescript@^7`) and `typescript` (`npm:@typescript/typescript6@^6`) are npm aliases Dependabot may not follow. Stop the dev server before `npm ci` on Windows — it locks native modules (EPERM).
- The Cloudflare dashboard, publishing releases and repository settings are the maintainer's; ask before touching them.
+1 -1
View File
@@ -39,7 +39,7 @@ Use the templates in `.github/ISSUE_TEMPLATE/`:
- Branch from `main` (`feat/…`, `fix/…`, `docs/…`) and open the PR against `main`. Every merge to `main` deploys the web app, so `main` stays releasable.
- Commit format and **PR title**: `type(scope): message` — e.g. `feat(engine): add Spanish template support`. Types: `feat`, `fix`, `refactor`, `docs`, `test`, `ci`, `chore`. CI checks the PR title.
- Required checks: `check`, `dependency-review`, `workflow-lint`, `reuse`, `pr-title`. When `src-tauri/` changes, the Rust workflow's `lint-and-test` and `cargo-deny` run too, and GitHub's CodeQL code scanning runs on every PR. SonarCloud analyses PRs opened from this repository — its quality gate wants A ratings, reviewed security hotspots, at most 3 % duplication and at least 80 % test coverage on new code in the layers Vitest measures (PRs from forks get no secrets and skip it; the maintainer's merge runs it on `main`). Commits on `main` are signed.
- Required checks: `check`, `dependency-review`, `workflow-lint`, `reuse`, `pr-title`. When `src-tauri/` changes, the Rust workflow's `lint-and-test` and `cargo-deny` run too, and GitHub's CodeQL code scanning runs on every PR. SonarCloud analyses PRs opened from this repository — its quality gate wants A ratings, reviewed security hotspots, at most 3 % duplication and at least 80 % test coverage on new code in the layers Vitest measures (PRs from forks get no secrets and skip it; the maintainer's merge runs it on `main`). JetBrains Qodana does the same for TypeScript and for the Rust shell, and fails on any problem it finds. Commits on `main` are signed.
- PR titles start with a lower-case letter after the colon (`feat(editor): add …`, not `feat(editor): Add …`).
- One logical change per PR. Don't bundle unrelated refactors.
- All locale files must stay in lock-step — see the i18n section below.
+1
View File
@@ -87,6 +87,7 @@ The dev server is the app alone: no Turnstile gate and no analytics. To run the
- PR titles use the commit format `type(scope): message`; CI checks them.
- Every PR runs the `check` job (below), `dependency-review`, `workflow-lint`, `reuse` and `pr-title`; the Rust jobs `lint-and-test` and `cargo-deny` run when `src-tauri/` changes.
- After `check`, the `sonarcloud` job sends the code and the coverage report to [SonarCloud](https://sonarcloud.io/project/overview?id=poli0981_youtube-generator) (settings in `sonar-project.properties`) and fails when its quality gate does: new code needs A ratings, reviewed security hotspots, at most 3 % duplication and at least 80 % coverage. PRs from forks and from Dependabot skip it — they get no `SONAR_TOKEN` — and `main` is analysed after every merge.
- The `Qodana` workflow runs JetBrains [Qodana](https://www.jetbrains.com/qodana/) on every PR and every push to `main`: Qodana for JS on the repository (`qodana.yaml`) and Qodana for Rust on `src-tauri/` (`src-tauri/qodana.yaml`). Both fail on any problem. Like SonarCloud, it skips PRs from forks and from Dependabot, which get no Qodana token. It is not a required check.
Full rules: [CONTRIBUTING.md](../CONTRIBUTING.md).
+3 -1
View File
@@ -595,6 +595,7 @@ An unknown version is read as 0: every migration step is idempotent, so running
| `security.yml` (Security) | PRs, pushes on `main`, weekly, manual | `dependency-review` (PRs: fails on a newly added high/critical advisory), `workflow-lint` (actionlint + zizmor, `.github/zizmor.yml`), `scorecard` (OpenSSF Scorecard, informational; not on PRs) |
| `compliance.yml` (Compliance) | PRs, pushes on `main` | `reuse` (REUSE licensing via `REUSE.toml`), `pr-title` (Conventional-Commit PR titles with a lower-case subject) |
| `rust.yml` (Rust) | Changes under `src-tauri/`, weekly, manual | `lint-and-test` (`cargo fmt --all -- --check`, `cargo clippy --all-targets --locked -- -D warnings`, `cargo test --locked`, after `npm run build` because `generate_context!` embeds `dist/`), `cargo-deny` (`check advisories licenses sources`, `src-tauri/deny.toml`) |
| `qodana.yml` (Qodana) | PRs to and pushes on `main`, manual | `typescript` — Qodana for JS in native mode (`qodana.yaml`); `rust` — Qodana for Rust, Early Access, in Docker (`src-tauri/qodana.yaml`); both skip without their token (Dependabot and fork PRs) |
| `release-desktop.yml`, `release-android.yml` | `v*` tags, manual with a `tag` input | `verify`, then the builds — see [PACKAGING.md](PACKAGING.md) |
| `announce-release.yml` | Release published, manual | Links the release to an Announcements discussion and posts to Discord |
| `notify-ci-failure.yml`, `notify-release-pipeline.yml` | `workflow_run` | Discord notifications through the maintainer's shared workflows |
@@ -642,7 +643,8 @@ Then `sonarcloud` (after `check` succeeds):
- **Copyright years** (`scripts/lib/copyright.ts`, v1.1.0): NOTICE, REUSE.toml and `bundle.copyright` in `tauri.conf.json` must state `copyrightYears(<year of HEAD's commit>)` from `src/config/brand.ts` — "2026", then "2026-2027" from the first commit of 2027. The commit year rather than the clock keeps old commits green; `npm run update:copyright` rewrites the three files. The `/legal` pages' footer uses the same helper at build time.
- **Wrangler dry run** validates `wrangler.jsonc` and bundles the Worker exactly as Workers Builds will, without deploying.
- **SonarCloud** (CI-based; Automatic Analysis is off in the project's settings): `sonar-project.properties` makes the whole repository main code except the tests (`tests/**` and any `src/**/*.test.ts(x)`, analysed as tests) and the binary files (icons, the Gradle wrapper's jar), imports `coverage/lcov.info` and excludes from coverage everything Vitest does not measure (see [Testing Strategy](#6-testing-strategy)). The scan waits for the quality gate — Sonar way: A security, reliability and maintainability ratings, every security hotspot reviewed, ≤ 3 % duplication and ≥ 80 % coverage on new code — and fails the job when it fails. New code is "since the previous version": the job reads `package.json`'s version into `sonar.projectVersion`, so every release starts a new period. The scan runs in a job of its own so that `SONAR_TOKEN` never shares a job with npm packages. PRs from forks and from Dependabot get no repository secrets and skip it; the condition checks the PR author, not `github.actor` (zizmor's `bot-conditions`).
- Every workflow declares least-privilege `permissions`, checks out with `persist-credentials: false`, and pins actions by commit SHA (Dependabot keeps the SHAs and version comments current). The exceptions are the actionlint Docker image (pinned by version tag) and the maintainer's own `poli0981/.github` reusable workflows (tracked at `main`, allowed in `.github/zizmor.yml`). CI, Security, Compliance and Rust cancel superseded runs through a `concurrency` group, except on `main`, where each commit's result is a record the release process reads back.
- **Qodana** (v1.6.0; JetBrains, Ultimate licence — the account runs the trial): `qodana.yml` runs Qodana for JS in native mode, on the runner's Node 26 and `node_modules` (`qodana.yaml`), and Qodana for Rust (Early Access, Docker only) on `src-tauri/` (`src-tauri/qodana.yaml`: its `bootstrap` installs the packages `rust.yml` installs, and a stand-in `dist/index.html` lets `generate_context!` expand). Both use the `qodana.recommended` profile and a quality gate of zero problems; every exclusion in a `qodana.yaml` says why. Every run analyses the whole project (`pr-mode: false`). Results go to Qodana Cloud (projects `yt-ts-js` and `yt-rust`), the run's annotations and the `qodana-report-*` artifacts — no PR comment. A `tokens` job checks for `QODANA_TOKEN_TS_JS` and `QODANA_TOKEN_RUST`, which Dependabot and fork PRs don't get, so the analysis is skipped there; the token reaches only the scan step, never the `npm ci` one. Not a required check. When the licence lapses, both jobs fail at the licence check.
- Every workflow declares least-privilege `permissions`, checks out with `persist-credentials: false`, and pins actions by commit SHA (Dependabot keeps the SHAs and version comments current). The exceptions are the actionlint Docker image (pinned by version tag) and the maintainer's own `poli0981/.github` reusable workflows (tracked at `main`, allowed in `.github/zizmor.yml`). CI, Security, Compliance, Rust and Qodana cancel superseded runs through a `concurrency` group, except on `main`, where each commit's result is a record the release process reads back.
**Web deployment is not a GitHub workflow.** Cloudflare Workers Builds builds and deploys the Worker and `dist/` on every push to `main` (preview versions for other branches). The old `deploy-web.yml` (GitHub Pages) is gone; `pages-migration.yml` only serves the moving notice, which hands visitors the data their browser saved on the old address as a `_format: 2` backup file. See [HOSTING.md](HOSTING.md).
+1
View File
@@ -89,6 +89,7 @@ Dev server chỉ chạy riêng app: không có cổng Turnstile, không có anal
- Tiêu đề PR theo định dạng commit `type(scope): message`; CI có kiểm tra.
- Mỗi PR đều chạy job `check` (xem bên dưới), `dependency-review`, `workflow-lint`, `reuse` và `pr-title`; hai job Rust `lint-and-test` và `cargo-deny` chạy khi có thay đổi trong `src-tauri/`.
- Sau `check`, job `sonarcloud` gửi mã nguồn và báo cáo coverage lên [SonarCloud](https://sonarcloud.io/project/overview?id=poli0981_youtube-generator) (cấu hình trong `sonar-project.properties`) và fail khi quality gate fail: code mới phải đạt hạng A, mọi security hotspot đã được review, trùng lặp tối đa 3 % và coverage tối thiểu 80 %. PR từ fork và từ Dependabot bỏ qua job này — chúng không có `SONAR_TOKEN` — còn `main` được phân tích sau mỗi lần merge.
- Workflow `Qodana` chạy JetBrains [Qodana](https://www.jetbrains.com/qodana/) trên mọi PR và mọi lần push vào `main`: Qodana for JS cho cả repo (`qodana.yaml`) và Qodana for Rust cho `src-tauri/` (`src-tauri/qodana.yaml`). Cả hai fail khi có bất kỳ lỗi nào. Giống SonarCloud, PR từ fork và từ Dependabot bỏ qua phân tích vì không có token Qodana. Đây không phải check bắt buộc.
Quy định đầy đủ: [CONTRIBUTING.md](../../../CONTRIBUTING.md).
+2 -1
View File
@@ -2,6 +2,7 @@
// first paint, so a light-theme user never sees the dark default flash. A
// separate file rather than an inline <script> so the Content-Security-Policy
// needs no exception.
/* global document, localStorage */
(function () {
var root = document.documentElement;
var theme = "dark";
@@ -14,7 +15,7 @@
// Unhealed raw storage, so only a real `true` counts.
if (state && state.hideScrollbars === true) hideScrollbars = true;
if (state && typeof state.appLanguage === "string") lang = state.appLanguage;
} catch (e) {
} catch {
/* storage blocked or corrupt: keep the defaults */
}
root.classList.toggle("dark", theme === "dark");
+59
View File
@@ -0,0 +1,59 @@
# Qodana for JavaScript / TypeScript: the web app (src/), the Worker, the
# build plugins, scripts, tests and workflows. Run by
# .github/workflows/qodana.yml (job `typescript`, native mode), reported to
# the Qodana Cloud project yt-ts-js (secret QODANA_TOKEN_TS_JS).
version: "1.0"
linter: qodana-js
profile:
name: qodana.recommended
# The quality gate: any problem fails the job.
failureConditions:
severityThresholds:
any: 0
exclude:
- name: All
paths:
# The Tauri shell is the Rust project (src-tauri/qodana.yaml).
- src-tauri
# Build output, caches and reports.
- dist
- coverage
- node_modules
- .wrangler
# The GitHub Pages moving notice, removed on 2026-11-29 (issue #177).
- migration-page
# `${{ secrets.DISCORD_RELEASE_PIPELINE_WEBHOOK }}` is a reference to a
# repository secret, not a secret: the "discord-client-secret" rule only
# sees the word.
- name: HardcodedPasswords
paths:
- .github/workflows/notify-release-pipeline.yml
# `\]` and `\}` outside a character class stay escaped: they read as the
# literal brackets they are, and the patterns stay valid if they ever get
# the `u` or `v` flag, where a lone `]` or `}` is a syntax error. ESLint's
# no-useless-escape accepts them too.
- name: RegExpRedundantEscape
# `@i18n/index` is the form tsconfig.json's `@i18n/*` path resolves. The
# bare `@i18n` this suggests resolves only through Vite's alias, so tsc
# would no longer find the module.
- name: ES6PreferShortImport
# The three react-hooks warnings eslint.config.js documents (state synced
# from i18next, from a store number, and a useMemo the React Compiler
# can't keep): each needs a restructure, and the config keeps them as
# warnings on purpose. ESLint runs in CI's `check` job as well.
- name: Eslint
paths:
- src/hooks/use-languages-ready.ts
- src/components/editor/PlaytestEditor.tsx
- src/components/editor/StoreLinkEditor.tsx
# The legacy draft fields `spoilerWarning`, `matureWarning` and
# `endingsShown` are `@deprecated` so new code doesn't use them; these
# files carry them on purpose, to read and migrate drafts, presets and
# templates saved by older versions.
- name: JSDeprecatedSymbols
paths:
- src/config/defaults.ts
- src/store/editor-store.ts
- src/hooks/use-current-generator-input.ts
- src/engine/description-builder.ts
- src/utils/library-apply.ts
+32
View File
@@ -0,0 +1,32 @@
# Qodana for Rust (Early Access): the Tauri 2 shell of the desktop and
# Android apps. Run by .github/workflows/qodana.yml (job `rust`, Docker),
# reported to the Qodana Cloud project yt-rust (secret QODANA_TOKEN_RUST).
version: "1.0"
linter: qodana-rust
profile:
name: qodana.recommended
# The quality gate: any problem fails the job.
failureConditions:
severityThresholds:
any: 0
# The linter evaluates build scripts and expands macros with `cargo check`,
# and its image has neither a C toolchain nor the libraries Tauri links
# against (the same packages rust.yml installs). Needs root in the container:
# the workflow passes `-u root`.
bootstrap: |
apt-get update -qq
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends build-essential pkg-config libssl-dev libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
exclude:
- name: All
paths:
# Cargo's build output, and the Android project `tauri android init`
# generated (Kotlin and Gradle, not Rust).
- target
- gen
# tauri::generate_handler! needs each command's module path
# (`storage::backup_list`): the #[tauri::command] macro puts a hidden
# helper next to the function, and the handler finds it through that
# path. Without the prefix the crate no longer compiles.
- name: RsUnnecessaryQualifications
paths:
- src/lib.rs
+14 -18
View File
@@ -17,6 +17,17 @@ use tauri::{
mod file_dialog;
mod storage;
/// Bring the main window back: show it, restore it if minimized and focus
/// it. Used by a second launch, the tray menu's "Show" and a tray click.
#[cfg(desktop)]
fn show_main_window<R: tauri::Runtime>(app: &tauri::AppHandle<R>) {
if let Some(window) = app.get_webview_window("main") {
let _ = window.show();
let _ = window.unminimize();
let _ = window.set_focus();
}
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
// Plugins and commands shared by every platform (desktop + Android).
@@ -62,11 +73,7 @@ pub fn run() {
// in the *first* (already-running) instance when a second launch is
// attempted: we surface its window instead of letting the second boot.
.plugin(tauri_plugin_single_instance::init(|app, _argv, _cwd| {
if let Some(window) = app.get_webview_window("main") {
let _ = window.show();
let _ = window.unminimize();
let _ = window.set_focus();
}
show_main_window(app);
}))
.setup(move |app| {
let show = MenuItem::with_id(app, "show", "Show YTDescGen", true, None::<&str>)?;
@@ -83,13 +90,7 @@ pub fn run() {
.tooltip("YTDescGen — YouTube Description Generator")
.menu(&menu)
.on_menu_event(move |app, event| match event.id.as_ref() {
"show" => {
if let Some(window) = app.get_webview_window("main") {
let _ = window.show();
let _ = window.unminimize();
let _ = window.set_focus();
}
}
"show" => show_main_window(app),
"quit" => {
quitting_menu.store(true, Ordering::SeqCst);
app.exit(0);
@@ -103,12 +104,7 @@ pub fn run() {
..
} = event
{
let app = tray.app_handle();
if let Some(window) = app.get_webview_window("main") {
let _ = window.show();
let _ = window.unminimize();
let _ = window.set_focus();
}
show_main_window(tray.app_handle());
}
})
.build(app)?;
+2 -2
View File
@@ -1,4 +1,4 @@
import { useId, useState, type FormEvent } from "react";
import { useId, useState, type SubmitEvent } from "react";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
import { Modal } from "@components/ui/Modal";
@@ -35,7 +35,7 @@ function PresetSaveFormBody({ onClose, editPreset }: PresetSaveFormProps) {
);
const [fromEditor, setFromEditor] = useState(false);
const save = (e: FormEvent) => {
const save = (e: SubmitEvent) => {
e.preventDefault();
const fields = presetFieldsFromEditor(editorDataOf(useEditorStore.getState()));
const name = gameName.trim() || fields.gameName.trim() || t("presets.unnamed");
+2 -2
View File
@@ -1,4 +1,4 @@
import { useId, useState, type FormEvent } from "react";
import { useId, useState, type SubmitEvent } from "react";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
import { Modal } from "@components/ui/Modal";
@@ -38,7 +38,7 @@ function ProfileSaveFormBody({ onClose, editProfile }: ProfileSaveFormProps) {
);
const [fromEditor, setFromEditor] = useState(false);
const save = (e: FormEvent) => {
const save = (e: SubmitEvent) => {
e.preventDefault();
const fields = profileFieldsFromEditor(editorDataOf(useEditorStore.getState()));
const finalName = name.trim() || fields.channelName.trim() || t("profiles.unnamed");
@@ -1,4 +1,4 @@
import { useId, useState, type FormEvent } from "react";
import { useId, useState, type SubmitEvent } from "react";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
import { Modal } from "@components/ui/Modal";
@@ -32,7 +32,7 @@ function TemplateSaveFormBody({ onClose, editTemplate }: TemplateSaveFormProps)
const [name, setName] = useState(editTemplate?.name ?? "");
const [fromEditor, setFromEditor] = useState(false);
const save = (e: FormEvent) => {
const save = (e: SubmitEvent) => {
e.preventDefault();
const snapshot = structuredClone(editorDataOf(useEditorStore.getState()));
const finalName = name.trim() || snapshot.gameName.trim() || t("templates.unnamed");
+2 -2
View File
@@ -29,7 +29,8 @@ interface AccordionProps {
export function Accordion({
id,
title,
icon,
// Capitalised so JSX reads it as a component, not an HTML tag.
icon: Icon,
summary,
badge,
open,
@@ -37,7 +38,6 @@ export function Accordion({
children,
}: AccordionProps) {
const panelId = `section-${id}-panel`;
const Icon = icon;
return (
<section
id={`section-${id}`}
+14 -14
View File
@@ -46,7 +46,7 @@ export const PLATFORMS: readonly PlatformConfig[] = [
// /app/, /sub/ (package) or /bundle/ + <digits>, optionally followed by
// /<slug>; or the s.team/a/<digits> short link.
urlPattern:
/^https:\/\/(?:store\.steampowered\.com\/(?:app|sub|bundle)\/\d+(?:\/[^\s]*)?|s\.team\/a\/\d+\/?)$/i,
/^https:\/\/(?:store\.steampowered\.com\/(?:app|sub|bundle)\/\d+(?:\/\S*)?|s\.team\/a\/\d+\/?)$/i,
normalize: normalizeSteamUrl,
},
{
@@ -54,14 +54,14 @@ export const PLATFORMS: readonly PlatformConfig[] = [
tagName: "Epic Games",
label: "Epic Games Store",
urlPrefix: "https://store.epicgames.com/",
urlPattern: /^https:\/\/(?:store\.epicgames\.com|www\.epicgames\.com\/store)\/[^\s]+$/i,
urlPattern: /^https:\/\/(?:store\.epicgames\.com|www\.epicgames\.com\/store)\/\S+$/i,
},
{
id: "ps",
tagName: "PlayStation",
label: "PlayStation Store",
urlPrefix: "https://store.playstation.com/",
urlPattern: /^https:\/\/store\.playstation\.com\/[^\s]+$/i,
urlPattern: /^https:\/\/store\.playstation\.com\/\S+$/i,
},
{
id: "xbox",
@@ -70,7 +70,7 @@ export const PLATFORMS: readonly PlatformConfig[] = [
urlPrefix: "https://www.xbox.com/games/",
// xbox.com (with or without www) and the Microsoft Store web pages.
urlPattern:
/^https:\/\/(?:(?:www\.)?xbox\.com|apps\.microsoft\.com|www\.microsoft\.com\/[a-z-]*\/?store)\/[^\s]*$/i,
/^https:\/\/(?:(?:www\.)?xbox\.com|apps\.microsoft\.com|www\.microsoft\.com\/[a-z-]*\/?store)\/\S*$/i,
},
{
id: "nintendo",
@@ -80,14 +80,14 @@ export const PLATFORMS: readonly PlatformConfig[] = [
// Every regional site: nintendo.com/us/…, nintendo.co.uk, nintendo.de,
// store.nintendo.co.uk, nintendo.co.jp …
urlPattern:
/^https:\/\/(?:[a-z0-9-]+\.)*nintendo\.(?:com|co\.[a-z]{2}|com\.[a-z]{2}|[a-z]{2})\/[^\s]+$/i,
/^https:\/\/(?:[a-z0-9-]+\.)*nintendo\.(?:com|co\.[a-z]{2}|com\.[a-z]{2}|[a-z]{2})\/\S+$/i,
},
{
id: "gog",
tagName: "GOG",
label: "GOG",
urlPrefix: "https://www.gog.com/game/",
urlPattern: /^https:\/\/(?:www\.)?gog\.com\/[^\s]+$/i,
urlPattern: /^https:\/\/(?:www\.)?gog\.com\/\S+$/i,
},
{
id: "itchio",
@@ -103,7 +103,7 @@ export const PLATFORMS: readonly PlatformConfig[] = [
tagName: "Humble Bundle",
label: "Humble Bundle",
urlPrefix: "https://www.humblebundle.com/store/",
urlPattern: /^https:\/\/(?:www\.)?humblebundle\.com\/[^\s]+$/i,
urlPattern: /^https:\/\/(?:www\.)?humblebundle\.com\/\S+$/i,
},
{
id: "amazon",
@@ -111,21 +111,21 @@ export const PLATFORMS: readonly PlatformConfig[] = [
label: "Amazon Luna",
urlPrefix: "https://luna.amazon.com/game/",
// Luna's own site, or the game's page on any Amazon storefront.
urlPattern: /^https:\/\/(?:luna\.amazon\.com|(?:www\.)?amazon\.[a-z.]{2,6})\/[^\s]+$/i,
urlPattern: /^https:\/\/(?:luna\.amazon\.com|(?:www\.)?amazon\.[a-z.]{2,6})\/\S+$/i,
},
{
id: "ea",
tagName: "EA app",
label: "EA app",
urlPrefix: "https://www.ea.com/games/",
urlPattern: /^https:\/\/(?:www\.)?ea\.com\/[^\s]+$/i,
urlPattern: /^https:\/\/(?:www\.)?ea\.com\/\S+$/i,
},
{
id: "ubisoft",
tagName: "Ubisoft Connect",
label: "Ubisoft Store",
urlPrefix: "https://store.ubisoft.com/",
urlPattern: /^https:\/\/(?:store\.ubisoft\.com|(?:www\.)?ubisoft\.com)\/[^\s]+$/i,
urlPattern: /^https:\/\/(?:store\.ubisoft\.com|(?:www\.)?ubisoft\.com)\/\S+$/i,
},
{
id: "battlenet",
@@ -133,7 +133,7 @@ export const PLATFORMS: readonly PlatformConfig[] = [
label: "Battle.net",
urlPrefix: "https://shop.battle.net/",
// shop.battle.net and its regional hosts (us.shop.battle.net …).
urlPattern: /^https:\/\/(?:[a-z0-9-]+\.)*battle\.net\/[^\s]+$/i,
urlPattern: /^https:\/\/(?:[a-z0-9-]+\.)*battle\.net\/\S+$/i,
},
{
id: "googleplay",
@@ -151,7 +151,7 @@ export const PLATFORMS: readonly PlatformConfig[] = [
tagName: "iOS",
label: "App Store",
urlPrefix: "https://apps.apple.com/app/",
urlPattern: /^https:\/\/apps\.apple\.com\/[^\s]+$/i,
urlPattern: /^https:\/\/apps\.apple\.com\/\S+$/i,
},
{
id: "meta",
@@ -159,7 +159,7 @@ export const PLATFORMS: readonly PlatformConfig[] = [
label: "Meta Quest Store",
urlPrefix: "https://www.meta.com/experiences/",
// meta.com, and oculus.com links that still circulate.
urlPattern: /^https:\/\/(?:www\.)?(?:meta|oculus)\.com\/[^\s]+$/i,
urlPattern: /^https:\/\/(?:www\.)?(?:meta|oculus)\.com\/\S+$/i,
},
{
// Catch-all for indie / niche releases distributed only from a
@@ -170,6 +170,6 @@ export const PLATFORMS: readonly PlatformConfig[] = [
id: "publisher",
label: "Publisher / Developer site",
urlPrefix: "https://",
urlPattern: /^https:\/\/[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+(?:\/[^\s]*)?$/i,
urlPattern: /^https:\/\/[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+(?:\/\S*)?$/i,
},
] as const;
+4 -4
View File
@@ -36,14 +36,14 @@ export const PLAYTEST_PLATFORMS: readonly PlaytestPlatformConfig[] = [
id: "steam",
label: "Steam Playtest",
urlPrefix: "https://store.steampowered.com/app/",
urlPattern: /^https:\/\/store\.steampowered\.com\/app\/\d+(?:\/[^\s]*)?$/i,
urlPattern: /^https:\/\/store\.steampowered\.com\/app\/\d+(?:\/\S*)?$/i,
maxInvites: 100,
},
{
id: "epic",
label: "Epic Games Store",
urlPrefix: "https://store.epicgames.com/",
urlPattern: /^https:\/\/store\.epicgames\.com\/[^\s]+$/i,
urlPattern: /^https:\/\/store\.epicgames\.com\/\S+$/i,
maxInvites: 100,
},
{
@@ -57,7 +57,7 @@ export const PLAYTEST_PLATFORMS: readonly PlaytestPlatformConfig[] = [
id: "discord",
label: "Discord / Community",
urlPrefix: "https://discord.gg/",
urlPattern: /^https:\/\/(?:discord\.gg|discord\.com\/invite)\/[^\s]+$/i,
urlPattern: /^https:\/\/(?:discord\.gg|discord\.com\/invite)\/\S+$/i,
maxInvites: 100,
},
{
@@ -66,7 +66,7 @@ export const PLAYTEST_PLATFORMS: readonly PlaytestPlatformConfig[] = [
id: "other",
label: "Other / Signup form",
urlPrefix: "https://",
urlPattern: /^https:\/\/[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+(?:\/[^\s]*)?$/i,
urlPattern: /^https:\/\/[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+(?:\/\S*)?$/i,
maxInvites: 100,
},
] as const;
+1 -1
View File
@@ -694,7 +694,7 @@ export interface GeneratorInput {
* Video-style era opt-in (v0.22.0). When set to a non-empty era id,
* the renderer emits a single "Edited in {era} style using {editor}"
* credit at the end of the Video Settings section. Combines with
* {@link rig.video_editor}. Renders even when
* the rig's `video_editor`. Renders even when
* {@link skipGraphicsSettings} is true.
*/
videoStyleEra?: string;
+3 -1
View File
@@ -23,7 +23,9 @@ export const SUPPORTED_LANGUAGES = [
nativeName: string;
}[];
i18n
// `void`: nothing waits on init. `en` is bundled, so the first render already
// has its strings, and every other language loads on demand.
void i18n
.use(initReactI18next)
.use(
// Vite statically analyses this template literal and emits one async
+6 -14
View File
@@ -11,6 +11,7 @@ import { extractData, useSettingsStore } from "@store/settings-store";
import { editorDataOf, useEditorStore, type EditorData } from "@store/editor-store";
import type { SettingsData } from "@store/settings-heal";
import { generateId } from "@utils/uuid";
import { stableJson } from "@utils/stable-json";
import { PLATFORMS } from "@config/platforms";
import type { ParsedFile } from "./detect";
import { SECTIONS, isListSection, type ListSection, type Section } from "./format";
@@ -78,22 +79,13 @@ export function readCurrentData(): CurrentData {
};
}
/** JSON with sorted keys, so equal data compares equal whatever its key order. */
function stable(value: unknown): string {
return JSON.stringify(value, (_key, v: unknown) =>
v && typeof v === "object" && !Array.isArray(v)
? Object.fromEntries(
Object.entries(v as Record<string, unknown>).sort(([a], [b]) => (a < b ? -1 : 1)),
)
: v,
);
}
const BOOKKEEPING = new Set(["id", "createdAt", "updatedAt"]);
/** The part of an item that matters when comparing: no id, no timestamps. */
function content(item: object): string {
return stable(Object.fromEntries(Object.entries(item).filter(([key]) => !BOOKKEEPING.has(key))));
return stableJson(
Object.fromEntries(Object.entries(item).filter(([key]) => !BOOKKEEPING.has(key))),
);
}
function changedAt(item: { createdAt: string; updatedAt?: string }): number {
@@ -191,13 +183,13 @@ export function planRestore(
if (clean.settings) {
plan.settings = {
incoming: clean.settings,
status: stable(clean.settings) === stable(current.settings) ? "same" : "changed",
status: stableJson(clean.settings) === stableJson(current.settings) ? "same" : "changed",
};
}
if (clean.draft) {
plan.draft = {
incoming: clean.draft,
status: stable(clean.draft) === stable(current.draft) ? "same" : "changed",
status: stableJson(clean.draft) === stableJson(current.draft) ? "same" : "changed",
};
}
return plan;
+4 -14
View File
@@ -7,6 +7,7 @@ import {
type EditorData,
} from "@store/editor-store";
import { useSettingsStore } from "@store/settings-store";
import { stableJson } from "@utils/stable-json";
import type { Profile } from "@store/profile-store";
import type { GamePreset } from "@store/preset-store";
import type { EditorTemplate } from "@store/template-store";
@@ -89,17 +90,6 @@ function isBlank(value: unknown): boolean {
return false;
}
/** JSON with sorted keys, so equal maps compare equal whatever their order. */
function stable(value: unknown): string {
return JSON.stringify(value, (_key, v: unknown) =>
v && typeof v === "object" && !Array.isArray(v)
? Object.fromEntries(
Object.entries(v as Record<string, unknown>).sort(([a], [b]) => (a < b ? -1 : 1)),
)
: v,
);
}
/**
* Fields a patch would overwrite that hold something else in the editor
* right now — what "Replace N filled fields?" counts. Empty fields and
@@ -113,8 +103,8 @@ export function overwrittenFields(editor: EditorData, patch: Partial<EditorData>
.filter(
([key, value]) =>
!isBlank(now[key]) &&
stable(now[key]) !== stable(blank[key]) &&
stable(now[key]) !== stable(value),
stableJson(now[key]) !== stableJson(blank[key]) &&
stableJson(now[key]) !== stableJson(value),
)
.map(([key]) => key);
}
@@ -127,7 +117,7 @@ export function overwrittenFields(editor: EditorData, patch: Partial<EditorData>
export function changedSince(editor: EditorData, patch: Partial<EditorData>): string[] {
const now = editor as unknown as Record<string, unknown>;
return Object.entries(patch)
.filter(([key, value]) => stable(now[key] ?? "") !== stable(value ?? ""))
.filter(([key, value]) => stableJson(now[key] ?? "") !== stableJson(value ?? ""))
.map(([key]) => key);
}
+15
View File
@@ -0,0 +1,15 @@
/**
* JSON with every object's keys sorted, so equal data compares equal
* whatever order its keys were written in. Arrays keep their order.
* Used to compare library items (restore) and editor fields (applying a
* profile, preset or template).
*/
export function stableJson(value: unknown): string {
return JSON.stringify(value, (_key, v: unknown) =>
v && typeof v === "object" && !Array.isArray(v)
? Object.fromEntries(
Object.entries(v as Record<string, unknown>).sort(([a], [b]) => (a < b ? -1 : 1)),
)
: v,
);
}
+17
View File
@@ -0,0 +1,17 @@
import { describe, expect, it } from "vitest";
import { stableJson } from "@utils/stable-json";
describe("stableJson", () => {
it("gives equal objects the same JSON whatever their key order", () => {
expect(stableJson({ b: 1, a: { d: [2, 1], c: null } })).toBe(
stableJson({ a: { c: null, d: [2, 1] }, b: 1 }),
);
expect(stableJson({ b: 1, a: 2 })).toBe('{"a":2,"b":1}');
});
it("keeps array order and tells different data apart", () => {
expect(stableJson([2, 1])).not.toBe(stableJson([1, 2]));
expect(stableJson({ a: 1 })).not.toBe(stableJson({ a: "1" }));
expect(stableJson("text")).toBe('"text"');
});
});
+14 -13
View File
@@ -6,6 +6,19 @@ import { cloudflareWebAnalytics, securityTxt } from "./build-plugins/web-only.ts
const isTauri = !!process.env.TAURI_ENV_PLATFORM;
/** Import aliases — the same as tsconfig.json's `paths`. vitest.config.ts reuses them. */
export const alias = {
"@": path.resolve(import.meta.dirname, "./src"),
"@config": path.resolve(import.meta.dirname, "./src/config"),
"@engine": path.resolve(import.meta.dirname, "./src/engine"),
"@store": path.resolve(import.meta.dirname, "./src/store"),
"@hooks": path.resolve(import.meta.dirname, "./src/hooks"),
"@components": path.resolve(import.meta.dirname, "./src/components"),
"@pages": path.resolve(import.meta.dirname, "./src/pages"),
"@utils": path.resolve(import.meta.dirname, "./src/utils"),
"@i18n": path.resolve(import.meta.dirname, "./src/i18n"),
};
export default defineConfig({
plugins: [
react(),
@@ -19,19 +32,7 @@ export default defineConfig({
// wrangler.jsonc) and the Tauri build from its own asset protocol. The old
// GitHub Pages sub-path `/youtube-generator/` is gone as of v1.0.0.
base: "/",
resolve: {
alias: {
"@": path.resolve(import.meta.dirname, "./src"),
"@config": path.resolve(import.meta.dirname, "./src/config"),
"@engine": path.resolve(import.meta.dirname, "./src/engine"),
"@store": path.resolve(import.meta.dirname, "./src/store"),
"@hooks": path.resolve(import.meta.dirname, "./src/hooks"),
"@components": path.resolve(import.meta.dirname, "./src/components"),
"@pages": path.resolve(import.meta.dirname, "./src/pages"),
"@utils": path.resolve(import.meta.dirname, "./src/utils"),
"@i18n": path.resolve(import.meta.dirname, "./src/i18n"),
},
},
resolve: { alias },
server: {
// `tauri dev` loads this server while cargo rewrites files under
// src-tauri/target, and watching those crashed Vite on Windows (EBUSY on
+3 -17
View File
@@ -1,23 +1,9 @@
import { defineConfig } from "vitest/config";
// `import.meta.dirname` rather than `__dirname`: Vite 8's native config
// loader (planned to become the default) does not provide the CJS global,
// and warns on every run until this changes.
import path from "path";
// The app's import aliases, defined once in vite.config.ts.
import { alias } from "./vite.config.ts";
export default defineConfig({
resolve: {
alias: {
"@": path.resolve(import.meta.dirname, "./src"),
"@config": path.resolve(import.meta.dirname, "./src/config"),
"@engine": path.resolve(import.meta.dirname, "./src/engine"),
"@store": path.resolve(import.meta.dirname, "./src/store"),
"@hooks": path.resolve(import.meta.dirname, "./src/hooks"),
"@components": path.resolve(import.meta.dirname, "./src/components"),
"@pages": path.resolve(import.meta.dirname, "./src/pages"),
"@utils": path.resolve(import.meta.dirname, "./src/utils"),
"@i18n": path.resolve(import.meta.dirname, "./src/i18n"),
},
},
resolve: { alias },
test: {
globals: true,
// Node 25+ defines a global `localStorage` that is `undefined` unless