54639d466a
The SvelteKit app under /frontend has fully superseded the legacy
vanilla-JS/CSS frontend in /static, which was only ever served by a
debug `cargo run` / `PROFILE=dev` and never shipped to production.
Remove it together with the whole subsystem that existed only to
support it (~54k lines).
Frontend & assets:
- Delete /static (js/, css/, *.html, sw.js, basemaps/, locales symlink).
- Relocate the brand/PWA assets (logo/, favicon.ico, manifest.webmanifest)
to frontend/static/ so they ship with the SPA. This also fixes the
favicon, which app.html referenced but was missing from the prod bundle.
- Migrate the Nextcloud login-flow redirects from /nextcloud-error.html
to the SvelteKit /nextcloud/error route.
Web layer:
- Simplify resolve_static_path: drop the PROFILE=dev branch; always prefer
the Vite static-dist/ build, fall back to the configured path.
- Resolve i18n locales from the served SPA dir with a frontend/static
fallback so `just dev` works without a prior build.
Build:
- Prune build.rs from 1262 to ~70 lines (git metadata only); the Rust asset
pipeline and the OXICLOUD_RUST_ASSETS rollback flag are gone.
- Drop the now-unused build-dependencies (oxc_*, lightningcss).
- Remove the COPY static lines from the Dockerfile (cacher + builder).
Tooling & docs:
- Delete biome.json, jsconfig.json, tools/check-*.py, identifier.sh.
- Remove the legacy front-* justfile recipes; repoint the design-system
scripts (locales, dead-tokens, brand-drift, token-docs) at the frontend,
and drop check-contrast/check-headings (coupled to the old token
taxonomy / multi-page HTML).
- Repoint docs/DESIGN-SYSTEM.md links; remove 5 superseded docs/plan/*.
Backend dead code:
- Remove the dead `folder_repo` field from FileBlobWriteRepository.
- Remove the deprecated GET /api/folders/{id}/listing endpoint
(superseded by /resources).
Verified: cargo clippy (all-features/all-targets) clean, cargo test
--workspace 448 passed, cargo fmt clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
62 lines
2.3 KiB
JavaScript
62 lines
2.3 KiB
JavaScript
#!/usr/bin/env node
|
|
// Locale completeness + placeholder-integrity check.
|
|
//
|
|
// Fails (exit 1) if any locale is missing keys present in en.json, has stray
|
|
// extra keys, or if a translated string's {placeholders} differ from the
|
|
// English source. Wire into CI / pre-commit alongside the other linters.
|
|
//
|
|
// node scripts/check-locales.mjs
|
|
import { readFileSync, readdirSync } from 'node:fs';
|
|
import { join, dirname } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const localesDir = join(
|
|
dirname(fileURLToPath(import.meta.url)),
|
|
'..',
|
|
'frontend',
|
|
'static',
|
|
'locales'
|
|
);
|
|
|
|
/** Flatten a nested translation object to dotted keys. */
|
|
function flat(obj, prefix = '', out = {}) {
|
|
for (const [k, v] of Object.entries(obj)) {
|
|
const key = prefix ? `${prefix}.${k}` : k;
|
|
if (v && typeof v === 'object' && !Array.isArray(v)) flat(v, key, out);
|
|
else out[key] = v;
|
|
}
|
|
return out;
|
|
}
|
|
|
|
const placeholders = (s) => (typeof s === 'string' ? (s.match(/\{[^}]+\}/g) || []).sort() : []);
|
|
|
|
const en = flat(JSON.parse(readFileSync(join(localesDir, 'en.json'), 'utf8')));
|
|
const enKeys = Object.keys(en);
|
|
let problems = 0;
|
|
|
|
for (const file of readdirSync(localesDir).filter((f) => f.endsWith('.json') && f !== 'en.json')) {
|
|
const loc = flat(JSON.parse(readFileSync(join(localesDir, file), 'utf8')));
|
|
const missing = enKeys.filter((k) => !(k in loc));
|
|
const extra = Object.keys(loc).filter((k) => !(k in en));
|
|
const badPh = enKeys.filter(
|
|
(k) => k in loc && placeholders(en[k]).join() !== placeholders(loc[k]).join()
|
|
);
|
|
if (missing.length || extra.length || badPh.length) {
|
|
problems++;
|
|
console.error(`\n${file}:`);
|
|
if (missing.length)
|
|
console.error(
|
|
` missing ${missing.length}: ${missing.slice(0, 8).join(', ')}${missing.length > 8 ? ' …' : ''}`
|
|
);
|
|
if (extra.length) console.error(` extra ${extra.length}: ${extra.slice(0, 8).join(', ')}`);
|
|
if (badPh.length)
|
|
console.error(` placeholder mismatch ${badPh.length}: ${badPh.slice(0, 8).join(', ')}`);
|
|
}
|
|
}
|
|
|
|
if (problems) {
|
|
console.error(`\n✖ ${problems} locale file(s) have issues.`);
|
|
process.exit(1);
|
|
}
|
|
console.log('✓ All locales complete and placeholder-consistent.');
|