mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 03:20:46 +02:00
Restructure/frontend editor (#6404)
## 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]>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
48027ee9d6
commit
0a50e765b7
@@ -0,0 +1,195 @@
|
||||
import type { AppConfig } from "@app/contexts/AppConfigContext";
|
||||
|
||||
interface LicenseInfo {
|
||||
licenseType: string;
|
||||
enabled: boolean;
|
||||
maxUsers: number;
|
||||
hasKey: boolean;
|
||||
}
|
||||
|
||||
interface WauResponse {
|
||||
trackingSince: string;
|
||||
daysOnline: number;
|
||||
totalUniqueBrowsers: number;
|
||||
weeklyActiveUsers: number;
|
||||
}
|
||||
|
||||
interface AdminUsageResponse {
|
||||
totalUsers?: number;
|
||||
}
|
||||
|
||||
interface SimulationScenario {
|
||||
label: string;
|
||||
appConfig: AppConfig;
|
||||
wau?: WauResponse;
|
||||
adminUsage?: AdminUsageResponse;
|
||||
licenseInfo: LicenseInfo;
|
||||
}
|
||||
|
||||
const DEV_TESTING_MODE = false;
|
||||
const SIMULATION_INDEX = 0;
|
||||
|
||||
const FREE_LICENSE_INFO: LicenseInfo = {
|
||||
licenseType: "NORMAL",
|
||||
enabled: false,
|
||||
maxUsers: 5,
|
||||
hasKey: false,
|
||||
};
|
||||
|
||||
const BASE_NO_LOGIN_CONFIG: AppConfig = {
|
||||
enableAnalytics: true,
|
||||
appVersion: "2.11.0",
|
||||
serverCertificateEnabled: false,
|
||||
enableAlphaFunctionality: false,
|
||||
serverPort: 8080,
|
||||
premiumEnabled: false,
|
||||
runningProOrHigher: false,
|
||||
runningEE: false,
|
||||
enableLogin: false,
|
||||
activeSecurity: false,
|
||||
languages: [],
|
||||
contextPath: "/",
|
||||
license: "NORMAL",
|
||||
baseUrl: "http://localhost",
|
||||
enableEmailInvites: true,
|
||||
};
|
||||
|
||||
const BASE_LOGIN_CONFIG: AppConfig = {
|
||||
...BASE_NO_LOGIN_CONFIG,
|
||||
enableLogin: true,
|
||||
activeSecurity: true,
|
||||
};
|
||||
|
||||
const SIMULATION_SCENARIOS: SimulationScenario[] = [
|
||||
{
|
||||
label: "no-login-user-under-limit (no-license)",
|
||||
appConfig: {
|
||||
...BASE_NO_LOGIN_CONFIG,
|
||||
},
|
||||
wau: {
|
||||
trackingSince: "2025-11-18T23:20:12.520884200Z",
|
||||
daysOnline: 0,
|
||||
totalUniqueBrowsers: 3,
|
||||
weeklyActiveUsers: 3,
|
||||
},
|
||||
licenseInfo: { ...FREE_LICENSE_INFO },
|
||||
},
|
||||
{
|
||||
label: "no-login-admin-under-limit (no-license)",
|
||||
appConfig: {
|
||||
...BASE_NO_LOGIN_CONFIG,
|
||||
},
|
||||
wau: {
|
||||
trackingSince: "2025-10-01T00:00:00Z",
|
||||
daysOnline: 14,
|
||||
totalUniqueBrowsers: 4,
|
||||
weeklyActiveUsers: 4,
|
||||
},
|
||||
licenseInfo: { ...FREE_LICENSE_INFO },
|
||||
},
|
||||
{
|
||||
label: "no-login-user-over-limit (no-license)",
|
||||
appConfig: {
|
||||
...BASE_NO_LOGIN_CONFIG,
|
||||
},
|
||||
wau: {
|
||||
trackingSince: "2025-09-01T00:00:00Z",
|
||||
daysOnline: 30,
|
||||
totalUniqueBrowsers: 12,
|
||||
weeklyActiveUsers: 9,
|
||||
},
|
||||
licenseInfo: { ...FREE_LICENSE_INFO },
|
||||
},
|
||||
{
|
||||
label: "no-login-admin-over-limit (no-license)",
|
||||
appConfig: {
|
||||
...BASE_NO_LOGIN_CONFIG,
|
||||
},
|
||||
wau: {
|
||||
trackingSince: "2025-08-15T00:00:00Z",
|
||||
daysOnline: 45,
|
||||
totalUniqueBrowsers: 18,
|
||||
weeklyActiveUsers: 12,
|
||||
},
|
||||
licenseInfo: { ...FREE_LICENSE_INFO },
|
||||
},
|
||||
{
|
||||
label: "login-user-under-limit (no-license)",
|
||||
appConfig: {
|
||||
...BASE_LOGIN_CONFIG,
|
||||
isAdmin: false,
|
||||
},
|
||||
adminUsage: {
|
||||
totalUsers: 3,
|
||||
},
|
||||
licenseInfo: { ...FREE_LICENSE_INFO },
|
||||
},
|
||||
{
|
||||
label: "login-admin-under-limit (no-license)",
|
||||
appConfig: {
|
||||
...BASE_LOGIN_CONFIG,
|
||||
isAdmin: true,
|
||||
},
|
||||
adminUsage: {
|
||||
totalUsers: 4,
|
||||
},
|
||||
licenseInfo: { ...FREE_LICENSE_INFO },
|
||||
},
|
||||
{
|
||||
label: "login-user-over-limit (no-license)",
|
||||
appConfig: {
|
||||
...BASE_LOGIN_CONFIG,
|
||||
isAdmin: false,
|
||||
},
|
||||
adminUsage: {
|
||||
totalUsers: 12,
|
||||
},
|
||||
licenseInfo: { ...FREE_LICENSE_INFO },
|
||||
},
|
||||
{
|
||||
label: "login-admin-over-limit (no-license)",
|
||||
appConfig: {
|
||||
...BASE_LOGIN_CONFIG,
|
||||
isAdmin: true,
|
||||
},
|
||||
adminUsage: {
|
||||
totalUsers: 57,
|
||||
},
|
||||
licenseInfo: { ...FREE_LICENSE_INFO },
|
||||
},
|
||||
];
|
||||
|
||||
function getActiveScenario(): SimulationScenario | null {
|
||||
if (!DEV_TESTING_MODE) {
|
||||
return null;
|
||||
}
|
||||
const scenario = SIMULATION_SCENARIOS[SIMULATION_INDEX];
|
||||
if (!scenario) {
|
||||
console.warn(
|
||||
"[Simulation] SIMULATION_INDEX out of range, using live backend.",
|
||||
);
|
||||
return null;
|
||||
}
|
||||
console.warn(
|
||||
`[Simulation] Using scenario #${SIMULATION_INDEX} (${scenario.label}).`,
|
||||
);
|
||||
return scenario;
|
||||
}
|
||||
|
||||
export function getSimulatedAppConfig(): AppConfig | null {
|
||||
return getActiveScenario()?.appConfig ?? null;
|
||||
}
|
||||
|
||||
export function getSimulatedWauResponse(): WauResponse | null {
|
||||
return getActiveScenario()?.wau ?? null;
|
||||
}
|
||||
|
||||
export function getSimulatedAdminUsage(): AdminUsageResponse | null {
|
||||
return getActiveScenario()?.adminUsage ?? null;
|
||||
}
|
||||
|
||||
export function getSimulatedLicenseInfo(): LicenseInfo | null {
|
||||
return getActiveScenario()?.licenseInfo ?? null;
|
||||
}
|
||||
|
||||
export const DEV_TESTING_ENABLED = DEV_TESTING_MODE;
|
||||
Reference in New Issue
Block a user