From 1dab4923e43b41c066b8ad7e47a5780ed8145dc8 Mon Sep 17 00:00:00 2001 From: Konstantinos Arvanitakis Date: Mon, 28 Sep 2026 08:42:31 +0300 Subject: [PATCH] Feat: Correctly extracting boboko/core's js --- Dockerfile | 14 ++++-- composer.json | 4 +- composer.lock | 70 +++++++++++++++------------ docker-compose.core-dev.yml | 4 ++ docker/entrypoint-vite.sh | 26 ++++++++++ package-lock.json | 16 ++++++ package.json | 5 ++ resources/js/app.js | 7 +-- resources/views/layouts/app.blade.php | 2 +- vite.config.js | 8 ++- 10 files changed, 114 insertions(+), 42 deletions(-) create mode 100644 docker/entrypoint-vite.sh diff --git a/Dockerfile b/Dockerfile index 54d20ef..2788cd8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,11 +10,19 @@ RUN composer install \ --optimize-autoloader \ --ignore-platform-reqs -# ── Stage 2a: Vite dev (node_modules only, no build) ───────────────────────── +# ── Stage 2a: Vite dev (node_modules only, no build) ────────────────────────── FROM node:22-alpine AS vite-dev +# git: needed for npm to install @boboko/core's git+https tagged-VCS form (see +# package.json's _dependencies and docker/entrypoint-vite.sh). No build-time +# `npm install` here — package.json's boboko/core path-repo form (../boboko-core) +# isn't visible in the build context, only once bind-mounted at container start, +# and entrypoint-vite.sh already runs npm install on every boot, so this would be +# redundant even if it could work. +RUN apk add --no-cache git WORKDIR /app -COPY package*.json ./ -RUN npm ci --ignore-scripts +COPY docker/entrypoint-vite.sh /entrypoint-vite.sh +RUN chmod +x /entrypoint-vite.sh +ENTRYPOINT ["/entrypoint-vite.sh"] # ── Stage 2b: Node / Vite build ────────────────────────────────────────────── FROM node:22-alpine AS node-build diff --git a/composer.json b/composer.json index 032ebb5..5b812cc 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "Tests\\": "tests/" } }, - "_repositories": [ + "repositories": [ { "type": "path", "url": "../boboko-core", @@ -41,7 +41,7 @@ } } ], - "repositories": [ + "_repositories": [ { "type": "vcs", "url": "https://code.radical-elements.com/boboko/core.git" diff --git a/composer.lock b/composer.lock index 026a065..93b311b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a89bc3e4e93372ee52664163d56f783b", + "content-hash": "ba9c83a482613f3bd1f9a2b82ab91f66", "packages": [ { "name": "anourvalar/eloquent-serialize", @@ -515,11 +515,11 @@ }, { "name": "boboko/core", - "version": "0.22.0", - "source": { - "type": "git", - "url": "https://code.radical-elements.com/boboko/core.git", - "reference": "985f53efa2d34849f35c8e0f4129f861be762e76" + "version": "0.23.0", + "dist": { + "type": "path", + "url": "../boboko-core", + "reference": "68d5c2df0573279531a82c18bf3b17132c9fc761" }, "require": { "laravel/framework": "^12.0", @@ -552,6 +552,7 @@ "Modules\\Core\\Providers\\AuthServiceProvider", "Modules\\Core\\Providers\\CustomerServiceProvider", "Modules\\Core\\Providers\\CheckoutServiceProvider", + "Modules\\Core\\Providers\\CheckoutModuleServiceProvider", "Modules\\Core\\Providers\\PaymentServiceProvider", "Modules\\Core\\Providers\\LocalizationServiceProvider", "Modules\\Core\\Providers\\CatalogServiceProvider", @@ -570,7 +571,10 @@ } }, "description": "Core module — authentication and shared panel behaviour", - "time": "2026-09-25T12:58:41+00:00" + "transport-options": { + "symlink": true, + "relative": true + } }, { "name": "brick/math", @@ -2289,16 +2293,16 @@ }, { "name": "google/protobuf", - "version": "v5.36.1", + "version": "v5.36.2", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "d64d16befba8632967f604b9644c0bb8f64cfbc3" + "reference": "020bc8e831611869ac387ddd38fbbadd78d15195" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/d64d16befba8632967f604b9644c0bb8f64cfbc3", - "reference": "d64d16befba8632967f604b9644c0bb8f64cfbc3", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/020bc8e831611869ac387ddd38fbbadd78d15195", + "reference": "020bc8e831611869ac387ddd38fbbadd78d15195", "shasum": "" }, "require": { @@ -2327,9 +2331,9 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v5.36.1" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v5.36.2" }, - "time": "2026-08-31T22:07:31+00:00" + "time": "2026-09-17T15:56:42+00:00" }, { "name": "graham-campbell/result-type", @@ -2870,16 +2874,16 @@ }, { "name": "jacobjoergensen/laravel-paper", - "version": "1.16.0", + "version": "1.18.0", "source": { "type": "git", "url": "https://github.com/JacobJoergensen/laravel-paper.git", - "reference": "3bcdc1d929ace91e138b268d2394830d559e3695" + "reference": "fd68cb14448245185953f673c0e1504c6c4f71cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JacobJoergensen/laravel-paper/zipball/3bcdc1d929ace91e138b268d2394830d559e3695", - "reference": "3bcdc1d929ace91e138b268d2394830d559e3695", + "url": "https://api.github.com/repos/JacobJoergensen/laravel-paper/zipball/fd68cb14448245185953f673c0e1504c6c4f71cf", + "reference": "fd68cb14448245185953f673c0e1504c6c4f71cf", "shasum": "" }, "require": { @@ -2887,7 +2891,8 @@ "illuminate/filesystem": "^12.0|^13.0", "illuminate/support": "^12.0|^13.0", "php": "^8.4", - "spatie/yaml-front-matter": "^2.0" + "spatie/yaml-front-matter": "^2.0", + "symfony/yaml": "^7.0|^8.0" }, "require-dev": { "laravel/pint": "^1.29", @@ -2921,6 +2926,7 @@ } ], "description": "A flat-file Eloquent driver for modern Laravel.", + "homepage": "https://laravel-paper.com", "keywords": [ "cms", "content", @@ -2932,9 +2938,9 @@ ], "support": { "issues": "https://github.com/JacobJoergensen/laravel-paper/issues", - "source": "https://github.com/JacobJoergensen/laravel-paper/tree/1.16.0" + "source": "https://github.com/JacobJoergensen/laravel-paper/tree/1.18.0" }, - "time": "2026-08-25T18:56:34+00:00" + "time": "2026-09-25T00:16:02+00:00" }, { "name": "kirschbaum-development/eloquent-power-joins", @@ -6032,16 +6038,16 @@ }, { "name": "open-telemetry/opentelemetry-auto-laravel", - "version": "1.8.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/contrib-auto-laravel.git", - "reference": "f0a750eeb0a69012d81c84010a4c7a7b61926e00" + "reference": "fd81cb8e18af4b5405fb67c84622833886fa51da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/contrib-auto-laravel/zipball/f0a750eeb0a69012d81c84010a4c7a7b61926e00", - "reference": "f0a750eeb0a69012d81c84010a4c7a7b61926e00", + "url": "https://api.github.com/repos/opentelemetry-php/contrib-auto-laravel/zipball/fd81cb8e18af4b5405fb67c84622833886fa51da", + "reference": "fd81cb8e18af4b5405fb67c84622833886fa51da", "shasum": "" }, "require": { @@ -6058,7 +6064,7 @@ "nunomaduro/collision": "*", "open-telemetry/sdk": "^1.8", "orchestra/testbench": ">=7.41.3", - "phan/phan": "^5.0", + "phan/phan": "^6.0", "php-http/mock-client": "*", "phpstan/phpstan": "^1.1", "phpstan/phpstan-phpunit": "^1.0", @@ -6095,9 +6101,9 @@ "tracing" ], "support": { - "source": "https://github.com/opentelemetry-php/contrib-auto-laravel/tree/1.8.0" + "source": "https://github.com/opentelemetry-php/contrib-auto-laravel/tree/1.9.1" }, - "time": "2026-07-09T20:34:43+00:00" + "time": "2026-09-17T05:26:08+00:00" }, { "name": "open-telemetry/sdk", @@ -6201,16 +6207,16 @@ }, { "name": "open-telemetry/sem-conv", - "version": "1.38.0", + "version": "1.44.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sem-conv.git", - "reference": "e613bc640a407def4991b8a936a9b27edd9a3240" + "reference": "c94bc7ebacef039cda4f4c9270807dcc58b4e3af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/e613bc640a407def4991b8a936a9b27edd9a3240", - "reference": "e613bc640a407def4991b8a936a9b27edd9a3240", + "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/c94bc7ebacef039cda4f4c9270807dcc58b4e3af", + "reference": "c94bc7ebacef039cda4f4c9270807dcc58b4e3af", "shasum": "" }, "require": { @@ -6254,7 +6260,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2026-01-21T04:14:03+00:00" + "time": "2026-09-09T22:06:17+00:00" }, { "name": "openspout/openspout", diff --git a/docker-compose.core-dev.yml b/docker-compose.core-dev.yml index 8eb19db..c14cf1a 100644 --- a/docker-compose.core-dev.yml +++ b/docker-compose.core-dev.yml @@ -10,3 +10,7 @@ services: scheduler: volumes: - ../boboko-core:/var/www/boboko-core + + vite: + volumes: + - ../boboko-core:/boboko-core diff --git a/docker/entrypoint-vite.sh b/docker/entrypoint-vite.sh new file mode 100644 index 0000000..ee87148 --- /dev/null +++ b/docker/entrypoint-vite.sh @@ -0,0 +1,26 @@ +#!/bin/sh +set -e + +# Mirrors entrypoint.sh's Composer block: node_modules is a named/anonymous +# volume, not the bind-mounted host directory, so this container needs its +# own live install on every boot rather than relying on whatever was baked in +# at image-build time. +echo "[entrypoint-vite] Installing npm dependencies..." +npm install + +# Re-resolve @boboko/core specifically on every boot, whether it's a local +# path-repo checkout (file:../boboko-core, needs docker-compose.core-dev.yml's +# ../boboko-core:/boboko-core mount) or a tagged VCS install +# (git+https://...#vX.Y.Z) — the same manual toggle composer.json's +# repositories/_repositories block uses for the PHP side of this same +# package. A plain `npm install` above only installs what package-lock.json +# already pins; it won't notice a new commit on the path-repo checkout or a +# re-pushed tag. `npm update` re-resolves that one package against whatever +# package.json currently says and rewrites package-lock.json to pin it — +# exactly like `composer update boboko/* --with-all-dependencies` rewrites +# composer.lock, which is committed so prod picks up the resolved version via +# `npm install` alone (no `npm update` in prod's build). +echo "[entrypoint-vite] Re-resolving @boboko/core..." +npm update @boboko/core + +exec "$@" diff --git a/package-lock.json b/package-lock.json index 5f554c4..ced8741 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "packages": { "": { "dependencies": { + "@boboko/core": "file:../boboko-core", "@hotwired/stimulus": "^3.2.2", "@hotwired/turbo": "^8.0.23", "axios": "^1.15.2", @@ -18,6 +19,21 @@ "vite": "^8.0.0" } }, + "../boboko-core": { + "name": "@boboko/core", + "version": "0.23.0", + "dependencies": { + "@hotwired/stimulus": "^3.2.2", + "leaflet": "^1.9.4" + }, + "peerDependencies": { + "vite": "^8.0.0" + } + }, + "node_modules/@boboko/core": { + "resolved": "../boboko-core", + "link": true + }, "node_modules/@emnapi/core": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.1.tgz", diff --git a/package.json b/package.json index d3d0beb..8c36732 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,14 @@ "vite": "^8.0.0" }, "dependencies": { + "@boboko/core": "file:../boboko-core", "@hotwired/stimulus": "^3.2.2", "@hotwired/turbo": "^8.0.23", "axios": "^1.15.2", "leaflet": "^1.9.4" + }, + "_comment_boboko_core": "Mirrors composer.json's repositories/_repositories toggle: swap @boboko/core above with the line in _dependencies below (and back) by hand to switch between the local path-repo checkout and a tagged VCS install. The #semver:0.x range mirrors composer.json's own \"boboko/core\": \"0.*\" constraint exactly — note ^0.23.0 would NOT be equivalent here, since npm's caret locks the minor version too below 1.0.0 (>=0.23.0 <0.24.0). 0.x matches any 0.y.z tag, same as Composer's 0.*. npm reads the repo's git tags, filters to valid semver ones, and resolves the best match, so `npm update @boboko/core` alone picks up a newly pushed tag within range, no manual edit here per release. See docker/entrypoint-vite.sh and CONTRIBUTE.md.", + "_dependencies": { + "@boboko/core": "git+https://code.radical-elements.com/boboko/core.git#semver:0.x" } } diff --git a/resources/js/app.js b/resources/js/app.js index 82841fb..20084e2 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -10,13 +10,14 @@ window.Turbo.session.drive = false; import { Application } from "@hotwired/stimulus"; import { registerControllers } from "./stimulus/index"; -import { registerCheckout } from "./checkout"; +import { registerCheckout } from "@boboko/core"; const application = Application.start(); application.debug = false; registerControllers(application); -// Portable cart + checkout module (destined for boboko-core). Owns its own -// bbk-* Stimulus controllers; this is the only wiring line it needs here. +// Portable cart + checkout module, installed as a real npm dependency (see +// package.json). Owns its own bbk-* Stimulus controllers; this is the only +// wiring line it needs here. registerCheckout(application); diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index d693de0..8d26cc9 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -37,7 +37,7 @@ - @vite(['resources/css/checkout.css', 'resources/css/app.css', 'resources/js/app.js']) + @vite(['node_modules/@boboko/core/resources/css/checkout.css', 'resources/css/app.css', 'resources/js/app.js']) @auth('staff') @php($stoicToken = \App\Services\Stoic::token(auth('staff')->user()->email)) diff --git a/vite.config.js b/vite.config.js index 9274b7e..aa0e1aa 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,6 +1,7 @@ import { defineConfig } from "vite"; import laravel from "laravel-vite-plugin"; import tailwindcss from "@tailwindcss/vite"; +import { boboko } from "@boboko/core/vite-plugin"; export default defineConfig({ build: { @@ -14,13 +15,18 @@ export default defineConfig({ // checkout.css first: it's the portable cart/checkout module's // structural base (@layer bbk-checkout) and must load before // app.css so the host's own .bbk-* theming always wins. - "resources/css/checkout.css", + // Sourced from the @boboko/core npm package (a local + // `file:../boboko-core` dependency — see package.json and + // boboko()'s own comments in @boboko/core/vite-plugin for why + // this needs no further config here). + "node_modules/@boboko/core/resources/css/checkout.css", "resources/css/app.css", "resources/js/app.js", ], refresh: true, }), tailwindcss(), + boboko(), ], server: { host: "0.0.0.0",