diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ff80563..327f2b6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -35,7 +35,10 @@ jobs:
with:
node-version-file: .node-version
cache: npm
- - run: npm ci
+ # No dependency lifecycle scripts, in every workflow. The only packages
+ # that have one (esbuild, workerd, fsevents) take their native binary
+ # from optionalDependencies; the script only double-checks it.
+ - run: npm ci --ignore-scripts
# `tsc` must be TypeScript 7 (@typescript/native). The `typescript` alias
# (@typescript/typescript6, the API typescript-eslint loads) pulls in
# TypeScript 6 as @typescript/old, which ships a `tsc` too — npm links the
@@ -100,4 +103,4 @@ jobs:
# Validates wrangler.jsonc and bundles the Worker exactly as Workers
# Builds will — without deploying anything.
- name: Dry-run the Cloudflare deploy
- run: npx wrangler deploy --dry-run --outdir .wrangler/dry-run
+ run: npm run cf:check
diff --git a/.github/workflows/release-android.yml b/.github/workflows/release-android.yml
index 9687a1d..2baa78f 100644
--- a/.github/workflows/release-android.yml
+++ b/.github/workflows/release-android.yml
@@ -29,7 +29,7 @@ jobs:
# Release artifacts are built from a clean install: a cache written
# by any other workflow must not be able to feed into them.
package-manager-cache: false
- - run: npm ci
+ - run: npm ci --ignore-scripts
- run: npm run typecheck
- run: npm run test:run
- run: npm run check:version
@@ -79,8 +79,7 @@ jobs:
toolchain: stable
targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android
- - run: npm ci
-
+ - run: npm ci --ignore-scripts
- name: Install Tauri CLI
run: cargo install tauri-cli --version "^2" --locked
diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml
index 580d13e..c0903ef 100644
--- a/.github/workflows/release-desktop.yml
+++ b/.github/workflows/release-desktop.yml
@@ -33,7 +33,7 @@ jobs:
# Release artifacts are built from a clean install: a cache written
# by any other workflow must not be able to feed into them.
package-manager-cache: false
- - run: npm ci
+ - run: npm ci --ignore-scripts
- run: npm run typecheck
- run: npm run test:run
- run: npm run check:version
@@ -114,7 +114,7 @@ jobs:
libayatana-appindicator3-dev \
librsvg2-dev \
patchelf
- - run: npm ci
+ - run: npm ci --ignore-scripts
- uses: tauri-apps/tauri-action@1deb371b0cd8bd54025b384f1cd735e725c4060f # v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index 2f2a85d..397f6dd 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -52,7 +52,7 @@ jobs:
with:
node-version-file: .node-version
cache: npm
- - run: npm ci
+ - run: npm ci --ignore-scripts
- run: npm run build
- name: rustfmt
working-directory: src-tauri
diff --git a/build-plugins/legal-docs.ts b/build-plugins/legal-docs.ts
index a2d7a32..6f3b08f 100644
--- a/build-plugins/legal-docs.ts
+++ b/build-plugins/legal-docs.ts
@@ -79,17 +79,24 @@ export function rewriteHref(href: string, fromFile: string): string {
* hyphen, which also rules out any markup ending up in an attribute.
*/
function slugify(text: string): string {
- return text
- .toLowerCase()
- .replace(/[^\p{L}\p{N}]+/gu, "-")
- .replace(/^-+|-+$/g, "");
+ return (
+ text
+ .toLowerCase()
+ .replace(/[^\p{L}\p{N}]+/gu, "-")
+ // The line above leaves at most one hyphen in a row.
+ .replace(/^-|-$/g, "")
+ );
}
function stripInlineMarkdown(text: string): string {
- return text
- .replace(/[`*_~]/g, "")
- .replace(/\[([^\]]+)\]\([^)]*\)/g, "$1")
- .trim();
+ return (
+ text
+ .replace(/[`*_~]/g, "")
+ // Neither part may contain `[`, so a failed match is never re-scanned
+ // from a later `[` inside it (linear even on unbalanced brackets).
+ .replace(/\[([^[\]]+)\]\([^)[]*\)/g, "$1")
+ .trim()
+ );
}
export function renderMarkdown(source: string, fromFile: string): { title: string; html: string } {
diff --git a/scripts/lib/copyright.ts b/scripts/lib/copyright.ts
index 34d39bd..22598f6 100644
--- a/scripts/lib/copyright.ts
+++ b/scripts/lib/copyright.ts
@@ -58,10 +58,10 @@ function readRepoFile(file: string): string {
/** The year HEAD was committed, or this UTC year when git is unavailable. */
export function headCommitYear(): number {
try {
- const iso = execFileSync("git", ["log", "-1", "--format=%cI"], {
- cwd: ROOT,
- encoding: "utf8",
- });
+ const options = { cwd: ROOT, encoding: "utf8" } as const;
+ // A dev/CI script: `git` is whichever one the developer's PATH or the CI
+ // image provides, by design — there is no fixed install path to pin.
+ const iso = execFileSync("git", ["log", "-1", "--format=%cI"], options); // NOSONAR
const year = Number(iso.trim().slice(0, 4));
if (Number.isInteger(year) && year >= 2000) return year;
} catch {
diff --git a/scripts/lib/third-party.ts b/scripts/lib/third-party.ts
index e61f52c..ae3c0e8 100644
--- a/scripts/lib/third-party.ts
+++ b/scripts/lib/third-party.ts
@@ -38,8 +38,9 @@ const ALLOWED = new Set([
/** SPDX expression → allowed? `OR` needs one side, `AND` needs both. */
export function licenseAllowed(expression: string): boolean {
const expr = expression.trim().replace(/^\((.*)\)$/, "$1");
- if (/\sOR\s/i.test(expr)) return expr.split(/\s+OR\s+/i).some(licenseAllowed);
- if (/\sAND\s/i.test(expr)) return expr.split(/\s+AND\s+/i).every(licenseAllowed);
+ // Split on the bare operator; each part is trimmed by the recursive call.
+ if (/\sOR\s/i.test(expr)) return expr.split(/\sOR\s/i).some(licenseAllowed);
+ if (/\sAND\s/i.test(expr)) return expr.split(/\sAND\s/i).every(licenseAllowed);
return ALLOWED.has(expr);
}
@@ -110,7 +111,7 @@ export function directCrates(toml: string): string[] {
const name = inDependencies ? /^([A-Za-z0-9_-]+)\s*=/.exec(line)?.[1] : undefined;
if (name) names.add(name);
}
- return [...names].sort();
+ return [...names].sort(compareCodeUnits);
}
/**
diff --git a/src-tauri/gen/android/app/src/main/AndroidManifest.xml b/src-tauri/gen/android/app/src/main/AndroidManifest.xml
index efe7781..2930909 100644
--- a/src-tauri/gen/android/app/src/main/AndroidManifest.xml
+++ b/src-tauri/gen/android/app/src/main/AndroidManifest.xml
@@ -5,7 +5,11 @@
+
{
+ // fall back to the browser console. (A try/catch could not catch
+ // that: the import rejects asynchronously.)
+ //
+ // Dynamic import dodges a circular dep with files that themselves
+ // import ErrorBoundary, e.g. when the boundary is mounted in
+ // main.tsx before the store has registered.
+ void import("@utils/logger")
+ .then(({ logger }) => {
logger.error(
"errorBoundary",
`[${this.props.label ?? "app"}] ${error.message}`,
info.componentStack ?? error.stack ?? "",
);
+ })
+ .catch(() => {
+ console.error("ErrorBoundary caught:", error, info);
});
- } catch {
- console.error("ErrorBoundary caught:", error, info);
- }
this.props.onError?.(error, info);
}
diff --git a/src/components/ui/Modal.tsx b/src/components/ui/Modal.tsx
index fdcc927..0094aa1 100644
--- a/src/components/ui/Modal.tsx
+++ b/src/components/ui/Modal.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode } from "react";
+import type { ReactNode, RefObject } from "react";
import { useTranslation } from "react-i18next";
import { Dialog, VisuallyHidden } from "radix-ui";
import { X } from "lucide-react";
@@ -15,6 +15,12 @@ interface ModalProps {
/** Max width: sm 24rem · md 32rem (default) · lg 42rem · xl 56rem. */
size?: "sm" | "md" | "lg" | "xl";
className?: string;
+ /**
+ * Where focus lands when the dialog opens. Without it, Radix focuses the
+ * first focusable element (the close button). Use this instead of an
+ * `autoFocus` attribute on the target.
+ */
+ initialFocusRef?: RefObject;
}
const SIZES = { sm: "max-w-sm", md: "max-w-lg", lg: "max-w-2xl", xl: "max-w-4xl" } as const;
@@ -34,6 +40,7 @@ export function Modal({
footer,
size = "md",
className,
+ initialFocusRef,
}: ModalProps) {
const { t } = useTranslation("ui");
return (
@@ -41,6 +48,14 @@ export function Modal({
{
+ event.preventDefault();
+ initialFocusRef.current?.focus();
+ }
+ : undefined
+ }
className={clsx(
"bg-surface-1 border-border shadow-pop animate-pop-in rounded-panel fixed top-1/2 left-1/2 z-50 flex max-h-[min(88dvh,52rem)] w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col border",
"focus:outline-none",
diff --git a/src/components/ui/ShortcutHelpModal.tsx b/src/components/ui/ShortcutHelpModal.tsx
index 4e92882..938f537 100644
--- a/src/components/ui/ShortcutHelpModal.tsx
+++ b/src/components/ui/ShortcutHelpModal.tsx
@@ -1,4 +1,4 @@
-import { useMemo, useState } from "react";
+import { useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { Search } from "lucide-react";
import { Modal } from "./Modal";
@@ -24,6 +24,9 @@ const SHORTCUTS = [
export function ShortcutHelpModal({ open, onClose }: ShortcutHelpModalProps) {
const { t } = useTranslation("ui");
const [query, setQuery] = useState("");
+ // The search box gets focus when the modal opens (through Radix, not an
+ // `autoFocus` attribute).
+ const searchRef = useRef(null);
// A closed modal has no filter. Deriving this rather than resetting `query`
// in an effect means a re-open always starts fresh without an extra render
@@ -41,18 +44,24 @@ export function ShortcutHelpModal({ open, onClose }: ShortcutHelpModalProps) {
}, [activeQuery, t]);
return (
-
+