mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-15 11:00:47 +02:00
## Move editor under `frontend/editor/`
Pure restructure: `frontend/` becomes the workspace, `frontend/editor/`
holds
the PDF editor. 1775 file renames + 40 wiring edits. No logic changes.
### Why
`frontend/` is currently the editor — its `src/`, `public/`,
`src-tauri/`,
config files all sit at the root. Promoting `frontend/` to a
workspace and putting the editor in a sibling folder leaves room for
future
apps to drop in alongside it, sharing one `package.json` /
`node_modules` /
lint config / Storybook.
### What moves
frontend/
├── editor/ ← NEW: everything editor-specific
│ ├── src/ ← was frontend/src/
│ ├── public/ ← was frontend/public/
│ ├── src-tauri/ ← was frontend/src-tauri/
│ ├── index.html, vite.config.ts, vitest.config.ts, playwright.config.ts
│ ├── tsconfig*.json, tailwind.config.js, postcss.config.js
│ ├── scripts/
│ ├── .env, .env.desktop, .env.saas
│ └── DeveloperGuide.md
├── package.json, package-lock.json, node_modules/ ← workspace install
├── eslint.config.mjs, .prettierrc, .prettierignore ← shared tooling
├── .gitignore
└── README.md
### Wiring edits (40 files)
- `.taskfiles/frontend.yml`, `desktop.yml`, `e2e.yml`
- `build.gradle`, `app/core/build.gradle`
- `eslint.config.mjs`, `frontend/package.json`, `.gitignore`,
`.prettierignore`
- `docker/frontend/Dockerfile`
- 8 `.github/workflows/*.yml`, plus `.github/dependabot.yml`,
`.github/config/.files.yaml`, `.github/labeler-config-srvaroa.yml`
- `scripts/translations/**`
- Docs: `AGENTS.md`, `CLAUDE.md`, `ADDING_TOOLS.md`,
`DeveloperGuide.md`,
`WINDOWS_SIGNING.md`, `devGuide/HowToAddNewLanguage.md`,
`frontend/README.md`,
`frontend/editor/DeveloperGuide.md`
Plus 3 renamed + edited: `editor/vite.config.ts` (env path +
node_modules
walk-up), `editor/scripts/setup-env.mts` (renamed from `.ts` for
`import.meta.url`), `editor/scripts/build-provisioner.mjs` (resolve
src-tauri
relative to script).
### Verification
| Check | Result |
|---|---|
| `task frontend:typecheck:all` (6 variants) | exit 0 |
| `task frontend:lint` (eslint + dpdm) | exit 0 |
| `task frontend:format:check` | exit 0 |
| `task frontend:test` | 657 tests pass, 50 files |
| `task frontend:build:{core,proprietary,saas,desktop,prototypes}` | all
green |
| `task desktop:build` | full Tauri pipeline →
`Stirling-PDF_2.11.0_x64_en-US.msi` |
| `playwright test --list --project=stubbed` | 172 tests discovered |
`task desktop:build` exercises the heaviest path — Rust + WiX + MSI
bundle
against the moved `editor/src-tauri/`. If anything in the restructure
was
wrong it wouldn't have built.
### Test plan
- [ ] `frontend-validation.yml` green
- [ ] `e2e-stubbed.yml` green
- [ ] `tauri-build.yml` green on at least one platform
- [ ] `check_toml.yml` runs on a translation-touching PR
---------
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
64 lines
2.4 KiB
TypeScript
64 lines
2.4 KiB
TypeScript
// Must be imported before React so the DOM-prototype patch is installed
|
|
// before React's commit phase runs. Prevents browser page translators
|
|
// (Edge / Google Translate / extensions) from crashing the app via
|
|
// parent-mismatch DOMExceptions. See the module for details.
|
|
import "@app/utils/patchDomForTranslators";
|
|
import "@mantine/core/styles.css";
|
|
import "@mantine/dates/styles.css";
|
|
import "../vite-env.d.ts"; // eslint-disable-line no-restricted-imports -- Outside app paths
|
|
import "@app/styles/index.css"; // Import global styles
|
|
import React from "react";
|
|
import ReactDOM from "react-dom/client";
|
|
import { ColorSchemeScript } from "@mantine/core";
|
|
import { BrowserRouter } from "react-router-dom";
|
|
import App from "@app/App";
|
|
import "@app/i18n"; // Initialize i18next
|
|
import posthog from "posthog-js";
|
|
import { PostHogProvider } from "@posthog/react";
|
|
import { BASE_PATH } from "@app/constants/app";
|
|
|
|
posthog.init(import.meta.env.VITE_PUBLIC_POSTHOG_KEY, {
|
|
api_host: import.meta.env.VITE_PUBLIC_POSTHOG_HOST,
|
|
defaults: "2025-05-24",
|
|
capture_exceptions: true, // This enables capturing exceptions using Error Tracking, set to false if you don't want this
|
|
debug: false,
|
|
opt_out_capturing_by_default: true, // Opt-out by default, controlled by cookie consent
|
|
persistence: "memory", // No cookies/localStorage written until user opts in
|
|
cross_subdomain_cookie: false,
|
|
});
|
|
|
|
function updatePosthogConsent() {
|
|
if (!posthog.__loaded) return;
|
|
const optIn =
|
|
(window.CookieConsent as any)?.acceptedService?.("posthog", "analytics") ||
|
|
false;
|
|
if (optIn) {
|
|
posthog.set_config({ persistence: "localStorage+cookie" });
|
|
posthog.opt_in_capturing();
|
|
} else {
|
|
posthog.opt_out_capturing();
|
|
posthog.set_config({ persistence: "memory" });
|
|
}
|
|
console.log("Updated PostHog consent: ", optIn ? "opted in" : "opted out");
|
|
}
|
|
|
|
window.addEventListener("cc:onConsent", updatePosthogConsent);
|
|
window.addEventListener("cc:onChange", updatePosthogConsent);
|
|
|
|
const container = document.getElementById("root");
|
|
if (!container) {
|
|
throw new Error("Root container missing in index.html");
|
|
}
|
|
|
|
const root = ReactDOM.createRoot(container); // Finds the root DOM element
|
|
root.render(
|
|
<React.StrictMode>
|
|
<ColorSchemeScript />
|
|
<PostHogProvider client={posthog}>
|
|
<BrowserRouter basename={BASE_PATH}>
|
|
<App />
|
|
</BrowserRouter>
|
|
</PostHogProvider>
|
|
</React.StrictMode>,
|
|
);
|