Docs: fix stale localization, module and contributing docs

- localization.md: the label seeders are StorefrontTranslationsSeeder
  (and the checkout/validation ones), not a StorefrontLabels class or
  lunar:install; when each runs (storefront isn't seeded on boot);
  translations:pull; examples use the same slug in every locale.
- modules.md: core's JS/CSS is a real npm package (@boboko/core) with a
  Vite plugin, not files read from vendor/; bin/core-mode does the swap;
  open 0.x ranges instead of ^1.0; a real shop as the example app.
- CONTRIBUTE.md, README.md: seeding on boot corrected; 0.* range.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lexxandClaude Opus 5.5 committed 2026-11-06 18:50:42 +02:00
1 parent bfc1f92b2e
commit 79e7e9b4fd
4 files changed
+60 -75

No files matched your search

+25 -55
View File
@@ -42,10 +42,10 @@ boboko-core/ (this repo)
Stoic/
```
The e-shop app (`boboko-test`) consumes it as `vendor/boboko/core`:
A shop app (e.g. `3dealer`) consumes it as `vendor/boboko/core`:
```
boboko-test/
my-shop/
app/
Models/
Customer.php ← app-level model, extends Modules\Core\Customer\Models\Customer
@@ -75,7 +75,7 @@ Within a module, organise by concern rather than by type (`Auth/`, `Customer/`,
```json
"require": {
"boboko/core": "^1.0"
"boboko/core": "0.*"
},
"repositories": [
{
@@ -99,7 +99,12 @@ This is the **default** — a fresh `composer install` never depends on a local
]
```
This is a **manual, deliberate swap** of `composer.json` — not automated, since Composer has no clean built-in mechanism to merge an additional repository on top of the main list per-environment (`composer.local.json` is not auto-merged in Composer 2.x; `COMPOSER_REPOSITORIES` does not merge either — both were tested and ruled out). Swap it back to `vcs` before committing, so CI/prod builds never require `../boboko-core` to exist.
Don't swap it by hand: each shop's `bin/core-mode local` / `bin/core-mode repo` does it (and the
`package.json` side), restarts the stack, and turns on a pre-commit guard; see `CONTRIBUTE.md`.
It's a swap rather than an overlay because Composer has no clean built-in mechanism to merge an additional repository on top of the main list per-environment (`composer.local.json` is not auto-merged in Composer 2.x; `COMPOSER_REPOSITORIES` does not merge either — both were tested and ruled out). The committed state is always the `vcs` form, so CI/prod builds never require `../boboko-core` to exist.
Below 1.0, shops require core with an open range (`0.*` in Composer, `#semver:0.x` in npm), never
a caret: `^0.31.0` means `<0.32.0` and would silently refuse the next minor.
### Docker Compose: the local-core mount
@@ -124,58 +129,23 @@ Docker Compose merges `volumes:` lists additively across `-f` files, so the over
## Frontend Assets (JS/CSS)
A module's JS (Stimulus controllers) and CSS ship as plain source files under `resources/js/` and `resources/css/` — **there is no separate npm package per module.** A module is never `npm install`ed; its frontend assets are read directly by the consuming app's own Vite build, straight out of `vendor/boboko/<module>`.
A module's Stimulus controllers and CSS ship as a **real npm package** (`@boboko/core`),
installed into the consumer's `node_modules`: a symlink to `../boboko-core` in local mode
(`file:../boboko-core`), a real copy of the tagged release in repo mode
(`git+https://…#semver:0.x`). It's a package rather than files read out of `vendor/` so npm
installs core's own JS dependencies (`leaflet`, `@hotwired/stimulus`) transitively, the same way
Composer does for PHP.
This mirrors the PHP story above exactly: Composer already gives every environment one single, unconditional path — `vendor/boboko/<module>` — whether that resolves to a symlink into a sibling checkout (local path repo) or a real installed copy (tagged VCS release). A consumer's `vite.config.js` and JS entry point read from that same path, so there is nothing to toggle on the JS side — whatever Composer resolved is exactly what Vite sees, in both dev and prod, automatically.
- **One stable entry point:** consumers import only from the `@boboko/core` barrel
(`resources/js/index.js`, e.g. `import { registerCheckout, registerWishlist } from "@boboko/core"`),
never from a module's internal files, so the internal layout can change freely.
- **CSS:** `node_modules/@boboko/core/resources/css/…` in the consumer's Vite inputs and `@vite()`
(core's structural checkout CSS loads before the app's own, so the app's theming wins).
- **Vite:** the consumer adds the `boboko()` plugin from `@boboko/core/vite-plugin`. It owns the
settings the local-mode symlink needs (no stale pre-bundle, symlink-safe resolution, HMR on core
edits), so consumers don't copy them.
**Each module exposes one stable JS entry point** — `resources/js/index.js` — that re-exports whatever a consumer needs, e.g. `boboko-core`'s:
```js
// boboko-core/resources/js/index.js
export { registerCheckout } from './checkout/index.js'
```
A consuming app imports from that one file only, never from a path reaching into a module's internal folder structure directly:
```js
// consumer app's resources/js/app.js
import { registerCheckout } from "../../vendor/boboko/core/resources/js/index.js";
registerCheckout(application);
```
```php
{{-- consumer app's layout --}}
@vite(['vendor/boboko/core/resources/css/checkout.css', 'resources/css/app.css', 'resources/js/app.js'])
```
This keeps a module's internal file layout free to change without breaking every consumer's entry point — the same reasoning as PSR-4 namespaces for PHP, just for JS imports.
**A consuming app's `vite.config.js` needs one addition**, because `vendor/boboko/<module>` is a symlink in local path-repo dev (not a real directory Vite would otherwise watch through):
```js
export default defineConfig({
server: {
watch: {
// vendor/boboko/<module> is a symlink into ../boboko-<module> in
// local path-repo dev. Vite/chokidar don't follow symlinks for
// watched files by default, so edits to a module's source
// wouldn't otherwise trigger HMR. No-op against a real installed
// copy (tagged VCS release) in production.
followSymlinks: true,
},
},
});
```
Bare imports inside a module's own JS (e.g. `leaflet`, `@hotwired/stimulus`) resolve against the **consumer's** `node_modules` via Node's normal upward resolution walk from `vendor/boboko/<module>/resources/js/...` — no extra config needed, as long as `vendor/boboko/<module>` sits inside the consumer's own directory tree (true for both the symlink and real-copy case). The consumer's Vite Docker service (if any) needs the same bind mount the PHP containers already get, landing at the equivalent path relative to its own working directory:
```yaml
# consumer app's docker-compose.core-dev.yml
services:
vite:
volumes:
- ../boboko-core:/app/vendor/boboko/core # match /app to the vite service's actual workdir
```
Full details and the export map: `CONTRIBUTE.md`, "JS/CSS: a real npm package".
---
@@ -190,7 +160,7 @@ services:
"type": "library",
"version": "1.0.0",
"require": {
"boboko/core": "^1.0"
"boboko/core": "0.*"
},
"autoload": {
"psr-4": {