Commit graph

4 commits

Author SHA1 Message Date
Uwe Schuster
b2b598c6c8 v0.3.1: ship compiled dist/ so npm git installs work without TS stripping
Consumers installing via 'git+http://.../webapp-scaffold.git#<tag>' hit
Node's ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING because .ts files
under node_modules can't be loaded by vite.config.ts loaders / node's
default loader.

Add tsconfig.json + 'prepare: tsc' (runs on git install). Emit .js + .d.ts
into dist/. package.json exports point at dist/; .ts remains in src/ for
direct-source consumers (e.g. monorepo setups). 'dist/' is gitignored —
it's a build artifact, populated at install time.

Version bump to 0.3.1 since this is a patch on the already-released
0.3.0 ABI (no API changes, just packaging).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 22:23:36 +02:00
Uwe Schuster
ed9863c037 v0.3.0: i18n system (locale × tone) with fallback chain
createI18n({ bundles, defaultLocale, defaultTone, initialLocale,
initialTone, onMiss }) → { t, locale, tone, setLocale, setTone,
subscribe, getSnapshot }

Resolution order:
    <cur-locale>-<cur-tone>
  → <cur-locale>
  → <default-locale>-<default-tone>
  → <default-locale>
  → raw key (onMiss logs first occurrence)

Typed keys via keyof on the caller-supplied Bundle generic. Tone
bundles are Partial<B> so overrides only need the strings that differ
from the locale bundle — the defaultLocale bundle is the only one
expected to be complete.

React bindings isolated in src/i18n-react.ts so the core ships without
a React peer dep. SSR-safe: constructor takes initial locale/tone
rather than reading from window.

Typecheck clean under strict tsc (ES2020/DOM).

Closes fewo-webapp#416

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 22:12:18 +02:00
Uwe Schuster
69aec0f86c v0.2.0: add createCoreFetch factory
Orval-mutator factory for derived projects. Baseline behaviour
(credentials, X-Requested-With, 204/JSON handling) baked in; four
hooks let consumers wire the app-specific concerns without forking:

  baseUrl      — Apache-proxy prefix (empty for root-hosted apps)
  syncTables   — table names that route mutations through a sync queue
  onEnqueue    — queue callback (returns true ⇒ skip network, 202 back)
  on401        — session-invalidation redirect
  on409        — conflict resolver (return value swallows the error)
  fetchImpl    — test injection

Typechecks clean with tsc --strict against ES2020/DOM lib. Exported as
'@uschuster/webapp-scaffold/core-fetch' so consumers import only what
they need.

Closes fewo-webapp#415

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 22:09:08 +02:00
Uwe Schuster
55968fbd73 v0.1.0: fetch/postprocess/inject scripts + vite config factories
Bootstraps the shared frontend build glue for webapp-template-derived
projects:

  bin/fetch-openapi.sh         — pull Swagger JSON from a running backend
  bin/postprocess-openapi.py   — fix oatpp 1.3 rough edges before orval
  bin/inject-hashed-filenames.py — rewrite HTML tags, config-driven
  src/vite-config.ts           — defineAdminConfig / defineGuestConfig
  templates/orval.config.template.ts — starting point for derived repos

Package name @uschuster/webapp-scaffold. Consumed as a devDependency
through the internal Forgejo npm registry; binaries exposed for use in
package.json scripts. createCoreFetch + i18n deferred to v0.2 / v0.3.

Closes fewo-webapp#414

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 22:06:58 +02:00