chore(build): frontends become one npm workspace; images build from client-services/
Platform-v2 step 2.1 (APPS_PLATFORM D-15):
- root package.json with workspaces (packages/*, waiter_pwa, manager_dashboard)
and empty @xenia/{ui,i18n,api,access} skeletons (filled in 2.3-2.5)
- one root package-lock.json generated from the two old app locks, so every
dependency keeps its exact version (a fresh resolve moved the Capacitor and
Capgo native plugins and broke UI-bundle updates); apps keep nested trees
- waiter/manager Dockerfiles build with context client-services/ (npm ci per
workspace), root .dockerignore replaces the per-app ones; manager on node 22
- Vite dedupes react/react-dom so source-imported packages share the app's React
- waiter eslint ignores build outputs and the Android project
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
# Build context for the frontend images is client-services/ (APPS_PLATFORM D-15).
|
||||||
|
# Only the workspace root, packages/ and the app folders are needed.
|
||||||
|
.git
|
||||||
|
.env
|
||||||
|
*.env
|
||||||
|
**/node_modules
|
||||||
|
**/dist
|
||||||
|
**/dist-native
|
||||||
|
**/dev-dist
|
||||||
|
data
|
||||||
|
certs
|
||||||
|
docs
|
||||||
|
tests
|
||||||
|
tools
|
||||||
|
local_backend
|
||||||
|
nginx-proxy
|
||||||
|
install.sh
|
||||||
|
logo.png
|
||||||
|
waiter_pwa/android
|
||||||
|
waiter_pwa/releases
|
||||||
|
waiter_pwa/tests
|
||||||
@@ -11,7 +11,8 @@ services:
|
|||||||
|
|
||||||
waiter_pwa:
|
waiter_pwa:
|
||||||
build:
|
build:
|
||||||
context: ./waiter_pwa
|
context: . # npm workspace root (packages/ are shared)
|
||||||
|
dockerfile: waiter_pwa/Dockerfile
|
||||||
args:
|
args:
|
||||||
APP_VERSION: ${VERSION:-dev}
|
APP_VERSION: ${VERSION:-dev}
|
||||||
image: ${REGISTRY}/pos-waiter:${VERSION:-latest}
|
image: ${REGISTRY}/pos-waiter:${VERSION:-latest}
|
||||||
@@ -20,7 +21,8 @@ services:
|
|||||||
|
|
||||||
manager_dashboard:
|
manager_dashboard:
|
||||||
build:
|
build:
|
||||||
context: ./manager_dashboard
|
context: .
|
||||||
|
dockerfile: manager_dashboard/Dockerfile
|
||||||
image: ${REGISTRY}/pos-manager:${VERSION:-latest}
|
image: ${REGISTRY}/pos-manager:${VERSION:-latest}
|
||||||
ports:
|
ports:
|
||||||
- "5174:80"
|
- "5174:80"
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ The manager calls the API **same-origin, with relative paths**. The waiter app r
|
|||||||
| `nginx-proxy/nginx.conf` | Proxy config used in dev / by hand |
|
| `nginx-proxy/nginx.conf` | Proxy config used in dev / by hand |
|
||||||
| `install.sh` | Site installer. **Writes its own copy of the proxy config.** |
|
| `install.sh` | Site installer. **Writes its own copy of the proxy config.** |
|
||||||
| `docker-compose.yml` / `docker-compose.dev.yml` | Prod (pull images) / dev override (build + expose ports) |
|
| `docker-compose.yml` / `docker-compose.dev.yml` | Prod (pull images) / dev override (build + expose ports) |
|
||||||
|
| `package.json`, `package-lock.json`, `packages/` | **npm workspace** for the frontends (D-15): `waiter_pwa`, `manager_dashboard` and the shared `packages/{ui,i18n,api,access}` (imported from source, no build step). One lockfile at this root; the apps have none of their own. |
|
||||||
|
| `.dockerignore` | The frontend images build with **`client-services/` as context** (`-f waiter_pwa/Dockerfile .`), so this file decides what Docker sees. The backend still builds from `local_backend/`. |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -93,6 +95,9 @@ Staff UIs are used by Greek staff and must render Greek correctly, including on
|
|||||||
## Common commands
|
## Common commands
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
|
# Once, and after any dependency change: install every frontend from the workspace root
|
||||||
|
npm install # in client-services/, never inside an app folder
|
||||||
|
|
||||||
# Dev: backend with reload
|
# Dev: backend with reload
|
||||||
cd local_backend; uvicorn main:app --reload --port 8000
|
cd local_backend; uvicorn main:app --reload --port 8000
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
dist
|
|
||||||
.env
|
|
||||||
@@ -1,17 +1,30 @@
|
|||||||
FROM node:20-slim AS builder
|
# Build context: client-services/ (the npm workspace root, APPS_PLATFORM D-15)
|
||||||
|
# docker build -f manager_dashboard/Dockerfile .
|
||||||
|
FROM node:22-slim AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package.json package-lock.json* ./
|
# Manifests first so the install layer is cached until a dependency changes.
|
||||||
RUN npm install
|
# The lockfile covers every workspace, so all their package.json files are needed.
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
COPY packages/ui/package.json packages/ui/
|
||||||
|
COPY packages/i18n/package.json packages/i18n/
|
||||||
|
COPY packages/api/package.json packages/api/
|
||||||
|
COPY packages/access/package.json packages/access/
|
||||||
|
COPY waiter_pwa/package.json waiter_pwa/
|
||||||
|
COPY manager_dashboard/package.json manager_dashboard/
|
||||||
|
RUN npm ci --workspace manager-dashboard --include-workspace-root
|
||||||
|
|
||||||
COPY . .
|
COPY packages/ packages/
|
||||||
|
COPY manager_dashboard/ manager_dashboard/
|
||||||
|
|
||||||
|
WORKDIR /app/manager_dashboard
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
COPY --from=builder /app/manager_dashboard/dist /usr/share/nginx/html
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
COPY manager_dashboard/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
|||||||
Generated
-3564
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,11 @@ import react from '@vitejs/plugin-react'
|
|||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
|
// npm workspace (D-15): shared packages are imported from source, so make
|
||||||
|
// sure every import of React resolves to this app's copy.
|
||||||
|
resolve: {
|
||||||
|
dedupe: ['react', 'react-dom'],
|
||||||
|
},
|
||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
port: 5174,
|
port: 5174,
|
||||||
|
|||||||
+4170
-611
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "xenia-client-services",
|
||||||
|
"private": true,
|
||||||
|
"description": "npm workspace for the on-site frontends and their shared packages (APPS_PLATFORM D-15). The backend is not part of it.",
|
||||||
|
"workspaces": [
|
||||||
|
"packages/*",
|
||||||
|
"waiter_pwa",
|
||||||
|
"manager_dashboard"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"dev:waiter": "npm run dev -w waiter_pwa",
|
||||||
|
"dev:manager": "npm run dev -w manager-dashboard",
|
||||||
|
"build:waiter": "npm run build -w waiter_pwa",
|
||||||
|
"build:manager": "npm run build -w manager-dashboard"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "@xenia/access",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"description": "Bootstrap provider and module/permission hooks: useModule, useCan, <Can>, <RequireModule> (plan step 2.5).",
|
||||||
|
"main": "src/index.js",
|
||||||
|
"exports": {
|
||||||
|
".": "./src/index.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
// @xenia/access — Bootstrap provider and module/permission hooks: useModule, useCan, <Can>, <RequireModule> (plan step 2.5).
|
||||||
|
// Imported from source by Vite (no build step). Filled in by its plan step.
|
||||||
|
export {}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "@xenia/api",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"description": "HTTP client (base URL, auth/device/override headers, error codes) and the WebSocket client (plan step 2.5).",
|
||||||
|
"main": "src/index.js",
|
||||||
|
"exports": {
|
||||||
|
".": "./src/index.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
// @xenia/api — HTTP client (base URL, auth/device/override headers, error codes) and the WebSocket client (plan step 2.5).
|
||||||
|
// Imported from source by Vite (no build step). Filled in by its plan step.
|
||||||
|
export {}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "@xenia/i18n",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"description": "i18next setup, en/el resources and format helpers for time, money and numbers (plan step 2.4).",
|
||||||
|
"main": "src/index.js",
|
||||||
|
"exports": {
|
||||||
|
".": "./src/index.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
// @xenia/i18n — i18next setup, en/el resources and format helpers for time, money and numbers (plan step 2.4).
|
||||||
|
// Imported from source by Vite (no build step). Filled in by its plan step.
|
||||||
|
export {}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "@xenia/ui",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"description": "Design tokens (CSS variables), the Tailwind preset and base components (plan step 2.3).",
|
||||||
|
"main": "src/index.js",
|
||||||
|
"exports": {
|
||||||
|
".": "./src/index.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
// @xenia/ui — Design tokens (CSS variables), the Tailwind preset and base components (plan step 2.3).
|
||||||
|
// Imported from source by Vite (no build step). Filled in by its plan step.
|
||||||
|
export {}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
node_modules
|
|
||||||
dist
|
|
||||||
.env
|
|
||||||
# Local-only build outputs — never part of the image build context
|
|
||||||
android
|
|
||||||
releases
|
|
||||||
dist-native
|
|
||||||
+18
-5
@@ -1,3 +1,5 @@
|
|||||||
|
# Build context: client-services/ (the npm workspace root, APPS_PLATFORM D-15)
|
||||||
|
# docker build -f waiter_pwa/Dockerfile .
|
||||||
FROM node:22-slim AS builder
|
FROM node:22-slim AS builder
|
||||||
|
|
||||||
# Shown in the UI bundle manifest (plan step 8); the bundle's identity is its content hash
|
# Shown in the UI bundle manifest (plan step 8); the bundle's identity is its content hash
|
||||||
@@ -5,19 +7,30 @@ ARG APP_VERSION=0.0.0
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package.json package-lock.json* ./
|
# Manifests first so the install layer is cached until a dependency changes.
|
||||||
RUN npm install --legacy-peer-deps
|
# The lockfile covers every workspace, so all their package.json files are needed.
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
COPY packages/ui/package.json packages/ui/
|
||||||
|
COPY packages/i18n/package.json packages/i18n/
|
||||||
|
COPY packages/api/package.json packages/api/
|
||||||
|
COPY packages/access/package.json packages/access/
|
||||||
|
COPY waiter_pwa/package.json waiter_pwa/
|
||||||
|
COPY manager_dashboard/package.json manager_dashboard/
|
||||||
|
RUN npm ci --workspace waiter_pwa --include-workspace-root
|
||||||
|
|
||||||
COPY . .
|
COPY packages/ packages/
|
||||||
|
COPY waiter_pwa/ waiter_pwa/
|
||||||
|
|
||||||
|
WORKDIR /app/waiter_pwa
|
||||||
# Web build (served to browsers) + native UI bundle that phones download from
|
# Web build (served to browsers) + native UI bundle that phones download from
|
||||||
# this server: dist/downloads/waiter-bundle.json + waiter-bundle-<hash>.zip
|
# this server: dist/downloads/waiter-bundle.json + waiter-bundle-<hash>.zip
|
||||||
RUN npm run build && npx vite build --mode native && APP_VERSION=$APP_VERSION node scripts/pack-bundle.mjs
|
RUN npm run build && npx vite build --mode native && APP_VERSION=$APP_VERSION node scripts/pack-bundle.mjs
|
||||||
|
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
COPY --from=builder /app/waiter_pwa/dist /usr/share/nginx/html
|
||||||
RUN chmod -R 755 /usr/share/nginx/html
|
RUN chmod -R 755 /usr/share/nginx/html
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
COPY waiter_pwa/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import reactRefresh from 'eslint-plugin-react-refresh'
|
|||||||
import { defineConfig, globalIgnores } from 'eslint/config'
|
import { defineConfig, globalIgnores } from 'eslint/config'
|
||||||
|
|
||||||
export default defineConfig([
|
export default defineConfig([
|
||||||
globalIgnores(['dist']),
|
globalIgnores(['dist', 'dist-native', 'dev-dist', 'android', 'releases']),
|
||||||
{
|
{
|
||||||
files: ['**/*.{js,jsx}'],
|
files: ['**/*.{js,jsx}'],
|
||||||
extends: [
|
extends: [
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ export default defineConfig(({ mode }) => {
|
|||||||
build: {
|
build: {
|
||||||
outDir: native ? 'dist-native' : 'dist',
|
outDir: native ? 'dist-native' : 'dist',
|
||||||
},
|
},
|
||||||
|
// npm workspace (D-15): shared packages are imported from source, so make
|
||||||
|
// sure every import of React resolves to this app's copy.
|
||||||
|
resolve: {
|
||||||
|
dedupe: ['react', 'react-dom'],
|
||||||
|
},
|
||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
port: 5173,
|
port: 5173,
|
||||||
|
|||||||
Reference in New Issue
Block a user