Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0641e5f1fd | ||
|
|
8f8cc573c6 | ||
|
|
79e7e9b4fd | ||
|
|
bfc1f92b2e | ||
|
|
32475b63bd | ||
|
|
533fd3a94f |
No files matched your search
+12
-38
@@ -1,41 +1,15 @@
|
|||||||
{
|
{
|
||||||
"permissions": {
|
"extraKnownMarketplaces": {
|
||||||
"allow": [
|
"re-skills": {
|
||||||
"Bash(find /home/konstantinos/Projects/RadicalElements/boboko-core/docs/scratch -iname \"*cart*\" 2>/dev/null; find /home/konstantinos/Projects/RadicalElements -iname \"*cart-feature*\" -o -iname \"*feature-survey*\" 2>/dev/null)",
|
"source": {
|
||||||
"Read(//home/konstantinos/Projects/RadicalElements/**)",
|
"source": "git",
|
||||||
"Bash(find /home/konstantinos/Projects/RadicalElements/3dealer -path \"*config/lunar/payments.php\" 2>/dev/null; find /home/konstantinos/Projects/RadicalElements -maxdepth 4 -iname \"*stripe*\" -type d 2>/dev/null)",
|
"url": "git@code.radical-elements.com:radical/re-skills.git"
|
||||||
"Bash(grep -n 'process\\(\\\\|->using\\\\|\\\\$data' /home/konstantinos/Projects/RadicalElements/boboko-core/vendor/filament/actions/src/CreateAction.php)",
|
},
|
||||||
"Bash(php -l src/Order/Commands/CloseExpiredReturnWindows.php)",
|
"autoUpdate": true
|
||||||
"Bash(php -l config/core.php)",
|
}
|
||||||
"Bash(./bin/dc-core.sh exec *)",
|
},
|
||||||
"Bash(php -l src/Shipping/Extensions/OrderViewExtension.php)",
|
"enabledPlugins": {
|
||||||
"Bash(php -l src/Cart/Filament/Resources/CartResource/Pages/ViewCart.php)",
|
"engineering@re-skills": true,
|
||||||
"Bash(./bin/dc-core.sh exec app php artisan tinker '--execute= *)",
|
"boboko@re-skills": true
|
||||||
"Bash(mkdir -p /home/konstantinos/Projects/RadicalElements/boboko-core/src/Cart/Http/Controllers)",
|
|
||||||
"Bash(rmdir /home/konstantinos/Projects/RadicalElements/boboko-core/src/Checkout/routes)",
|
|
||||||
"Bash(mkdir -p /home/konstantinos/Projects/RadicalElements/boboko-core/src/Checkout/routes)",
|
|
||||||
"Bash(php -l src/Cart/Http/Controllers/CartController.php)",
|
|
||||||
"Bash(php -l src/Checkout/Http/Controllers/CheckoutController.php)",
|
|
||||||
"Bash(php -l src/Providers/CheckoutModuleServiceProvider.php)",
|
|
||||||
"Bash(php -l src/Providers/CheckoutServiceProvider.php)",
|
|
||||||
"Bash(php -l src/Checkout/routes/checkout.php)",
|
|
||||||
"Bash(php -l config/checkout.php)",
|
|
||||||
"Bash(cp /home/konstantinos/Projects/RadicalElements/3dealer/resources/css/checkout.css /home/konstantinos/Projects/RadicalElements/boboko-core/resources/css/)",
|
|
||||||
"Bash(cp /home/konstantinos/Projects/RadicalElements/3dealer/resources/js/checkout/*.js /home/konstantinos/Projects/RadicalElements/boboko-core/resources/js/checkout/)",
|
|
||||||
"Bash(rm /home/konstantinos/Projects/RadicalElements/3dealer/app/Providers/CheckoutModuleServiceProvider.php)",
|
|
||||||
"Bash(rm -rf /home/konstantinos/Projects/RadicalElements/3dealer/app/Http/Controllers/Checkout)",
|
|
||||||
"Bash(rm /home/konstantinos/Projects/RadicalElements/3dealer/routes/checkout.php)",
|
|
||||||
"Bash(rm -rf /home/konstantinos/Projects/RadicalElements/3dealer/resources/js/checkout)",
|
|
||||||
"Bash(rm /home/konstantinos/Projects/RadicalElements/3dealer/resources/css/checkout.css)",
|
|
||||||
"Bash(composer dump-autoload *)",
|
|
||||||
"Bash(curl -s -o /tmp/checkout_test.html -w \"%{http_code}\\\\n\" http://localhost:8091/en/checkout)",
|
|
||||||
"Read(//tmp/**)",
|
|
||||||
"Bash(curl -s -o /tmp/home_test.html -w \"%{http_code}\\\\n\" http://localhost:8091/en/)",
|
|
||||||
"Bash(php -l bootstrap/providers.php)"
|
|
||||||
],
|
|
||||||
"additionalDirectories": [
|
|
||||||
"/home/konstantinos/Projects/RadicalElements/3dealer/bootstrap",
|
|
||||||
"/home/konstantinos/Projects/RadicalElements/3dealer/config"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,3 +12,5 @@ yarn-error.log
|
|||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
|
.claude/settings.local.json
|
||||||
+4
-2
@@ -38,7 +38,9 @@ bin/core-mode repo # back to tagged releases
|
|||||||
|
|
||||||
It swaps the `composer.json` / `package.json` wiring, runs `down` with the old mode's Compose wrapper and `up` with the new one, then waits until the entrypoints have re-resolved core. Running it for the mode you're already in skips the edits and just restarts the stack — in repo mode, that's how you pick up a newly pushed tag.
|
It swaps the `composer.json` / `package.json` wiring, runs `down` with the old mode's Compose wrapper and `up` with the new one, then waits until the entrypoints have re-resolved core. Running it for the mode you're already in skips the edits and just restarts the stack — in repo mode, that's how you pick up a newly pushed tag.
|
||||||
|
|
||||||
(`3dealer` has `bin/core-mode` and `bin/deploy`; they're app-agnostic, so other consumer apps can copy them as-is.)
|
**Pre-commit guard.** The first time you run `bin/core-mode local` or `repo`, it sets `git config core.hooksPath .githooks`. That turns on a pre-commit hook (`bin/check-core-mode`) that blocks any commit with local-mode `composer.json`, `package.json` or either lockfile staged. You can keep working in local mode and commit everything else: just leave those four files unstaged (`git restore --staged composer.json composer.lock package.json package-lock.json`). If you already use a custom `core.hooksPath`, `core-mode` leaves it alone and warns you. In that case, call `bin/check-core-mode` from your own hook.
|
||||||
|
|
||||||
|
(`3dealer` has `bin/core-mode`, `bin/check-core-mode`, `.githooks/` and `bin/deploy`; they're app-agnostic, so other consumer apps can copy them as-is.)
|
||||||
|
|
||||||
### Day to day in local mode
|
### Day to day in local mode
|
||||||
|
|
||||||
@@ -106,7 +108,7 @@ export default defineConfig({
|
|||||||
|
|
||||||
## Translations added in the UI
|
## Translations added in the UI
|
||||||
|
|
||||||
Default translation lines ship in core's seeders (`StorefrontTranslationsSeeder`, `CheckoutTranslationsSeeder`, `ValidationTranslationsSeeder`), which every app runs on boot and which only ever add missing keys. Lines added while building a storefront usually start in the Filament Language Lines UI instead. To move them into core:
|
Default translation lines ship in core's seeders (`StorefrontTranslationsSeeder`, `CheckoutTranslationsSeeder`, `ValidationTranslationsSeeder`), which only ever add missing keys. A shop's entrypoint runs the checkout and validation seeders on every boot; `StorefrontTranslationsSeeder` currently has to be run explicitly (see `docs/localization.md`, "Seeding"). Lines added while building a storefront usually start in the Filament Language Lines UI instead. To move them into core:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bin/dc-core.sh exec app php artisan boboko:translations:pull # local mode: writes into ../boboko-core
|
bin/dc-core.sh exec app php artisan boboko:translations:pull # local mode: writes into ../boboko-core
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ Add the repository to your project's `composer.json`:
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"boboko/core": "^1.0"
|
"boboko/core": "0.*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
+33
-18
@@ -1,6 +1,6 @@
|
|||||||
# Localization
|
# Localization
|
||||||
|
|
||||||
Storefront routes can be locale-prefixed (`/el/proionta`, `/en/products`) using a middleware
|
Storefront routes can be locale-prefixed (`/el/products`, `/en/products`) using a middleware
|
||||||
that reads directly from Lunar's `languages` table — the same table the Filament **Languages**
|
that reads directly from Lunar's `languages` table — the same table the Filament **Languages**
|
||||||
resource manages, so there's no separate locale config to keep in sync.
|
resource manages, so there's no separate locale config to keep in sync.
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ resource manages, so there's no separate locale config to keep in sync.
|
|||||||
|
|
||||||
## Why prefix every locale, including the default
|
## Why prefix every locale, including the default
|
||||||
|
|
||||||
Leaving the default locale bare at the root (`/proionta` for Greek, `/en/products` for English)
|
Leaving the default locale bare at the root (`/products` for Greek, `/en/products` for English)
|
||||||
creates ambiguity: is `/` the language-neutral homepage or specifically the Greek version? It
|
creates ambiguity: is `/` the language-neutral homepage or specifically the Greek version? It
|
||||||
also complicates `hreflang` (needs a self-referencing tag on the root plus a possibly-duplicate
|
also complicates `hreflang` (needs a self-referencing tag on the root plus a possibly-duplicate
|
||||||
`x-default`) and risks duplicate content if a bot or campaign link reaches the root without a
|
`x-default`) and risks duplicate content if a bot or campaign link reaches the root without a
|
||||||
@@ -17,6 +17,11 @@ language signal.
|
|||||||
Prefixing every locale avoids this: every URL unambiguously declares its language, `hreflang`
|
Prefixing every locale avoids this: every URL unambiguously declares its language, `hreflang`
|
||||||
tags are symmetrical, and adding a locale later requires no URL restructuring.
|
tags are symmetrical, and adding a locale later requires no URL restructuring.
|
||||||
|
|
||||||
|
|
||||||
|
**Slugs are the same in every locale** (`/el/products/…` and `/en/products/…`, never
|
||||||
|
`/el/proionta/…`). Only the visible content is translated. Boboko shops don't use per-locale
|
||||||
|
slugs.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Opt-in, not global
|
## Opt-in, not global
|
||||||
@@ -30,8 +35,8 @@ use Illuminate\Support\Facades\Route;
|
|||||||
|
|
||||||
Route::middleware('locale')->group(function () {
|
Route::middleware('locale')->group(function () {
|
||||||
Route::get('/{locale}', HomeController::class);
|
Route::get('/{locale}', HomeController::class);
|
||||||
Route::get('/{locale}/proionta', ProductIndexController::class);
|
Route::get('/{locale}/products', ProductIndexController::class);
|
||||||
Route::get('/{locale}/proionta/{slug}', ProductShowController::class);
|
Route::get('/{locale}/products/{slug}', ProductShowController::class);
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -198,21 +203,31 @@ registered.
|
|||||||
|
|
||||||
### Seeding
|
### Seeding
|
||||||
|
|
||||||
A starter set of common e-shop labels (`nav.*`, `cart.*`, `product.*`, `auth.*`, `search.*`,
|
The default labels for every shop (`nav.*`, `footer.*`, `cart.*`, `product.*`, `shop.*`,
|
||||||
`review.*`, `shop.*`, `pagination.*`, English + Greek) lives in
|
`search.*`, `auth.*`, `account.*`, `orders.*`, `contact.*`, `review.*`, `wishlist.*`,
|
||||||
`Modules\Core\Localization\Services\StorefrontLabels::all()` — kept as its own class, separate
|
`pagination.*`, English + Greek) live in
|
||||||
from the seeding logic, so the label list can be scanned/diffed without wading through the
|
`Modules\Core\Localization\Database\Seeders\StorefrontTranslationsSeeder::lines()`. Checkout and
|
||||||
seeding mechanics.
|
validation messages have their own seeders (`Modules\Core\Checkout\Database\Seeders\CheckoutTranslationsSeeder`,
|
||||||
|
`Modules\Core\Localization\Database\Seeders\ValidationTranslationsSeeder`).
|
||||||
|
|
||||||
`Modules\Core\Command\InstallLunarCommand` (overrides Lunar's own `lunar:install`) seeds them via
|
The seeders are **additive per key**: a key already in the database, including one an admin has
|
||||||
a **per-key upsert**, not an all-or-nothing "only seed if the group is empty" guard: a key already
|
since edited in the Filament **Language Lines** resource, is left untouched; only missing keys
|
||||||
present in the database — including one an admin has since edited via the Filament **Language
|
are created. That makes it safe to add keys to a seeder later and re-run it on an installed store,
|
||||||
Lines** resource — is left untouched; only keys missing entirely are created. This is what makes
|
without skipping the new keys or reverting an admin's edits. New lines go through
|
||||||
it safe to add new keys to `StorefrontLabels::all()` later and re-run `lunar:install` on an
|
`TranslationService::create()`, so the usual cache-invalidation and activity-log events fire.
|
||||||
already-installed store, without either silently skipping the new keys (the old guard's behavior)
|
|
||||||
or reverting an admin's edits back to the hardcoded default (what a naive `updateOrCreate` would
|
**When they run:** a shop's `docker/entrypoint.sh` runs the checkout and validation seeders on
|
||||||
do). New writes go through `TranslationService::create()`, so the usual cache-invalidation and
|
every boot. `StorefrontTranslationsSeeder` isn't run automatically (not by `lunar:install`, not on
|
||||||
activity-log events fire for them too.
|
boot), so run it explicitly after a core update that adds keys, or add it to the shop's
|
||||||
|
entrypoint:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php artisan db:seed --class="Modules\Core\Localization\Database\Seeders\StorefrontTranslationsSeeder"
|
||||||
|
```
|
||||||
|
|
||||||
|
**Lines added in the admin** while building a storefront are copied back into the seeders with
|
||||||
|
`php artisan boboko:translations:pull` (local mode; see `CONTRIBUTE.md`, "Translations added in
|
||||||
|
the UI"). A key that exists only in one shop's database shows as a raw key everywhere else.
|
||||||
|
|
||||||
### Admin UI
|
### Admin UI
|
||||||
|
|
||||||
|
|||||||
+25
-55
@@ -42,10 +42,10 @@ boboko-core/ (this repo)
|
|||||||
Stoic/
|
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/
|
app/
|
||||||
Models/
|
Models/
|
||||||
Customer.php ← app-level model, extends Modules\Core\Customer\Models\Customer
|
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
|
```json
|
||||||
"require": {
|
"require": {
|
||||||
"boboko/core": "^1.0"
|
"boboko/core": "0.*"
|
||||||
},
|
},
|
||||||
"repositories": [
|
"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
|
### 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)
|
## 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:
|
Full details and the export map: `CONTRIBUTE.md`, "JS/CSS: a real npm package".
|
||||||
|
|
||||||
```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
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -190,7 +160,7 @@ services:
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"require": {
|
"require": {
|
||||||
"boboko/core": "^1.0"
|
"boboko/core": "0.*"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|||||||
Reference in new issue
Block a user