@xeplr/cli 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/package.json +1 -1
- package/templates/CLAUDE.md +2 -0
- package/templates/api/README.md +7 -1
- package/templates/api/development.env.tpl +16 -5
- package/templates/api/env.required.js +3 -1
- package/templates/api/package.json +3 -2
- package/templates/ui/README.md +1 -0
- package/templates/ui/package.json +3 -3
- package/templates/ui/src/index.css +31 -0
package/README.md
CHANGED
|
@@ -85,6 +85,7 @@ These are architecture decisions, not defaults to tune — each one exists becau
|
|
|
85
85
|
| **Designing, new forms and publishing are Super Admin only.** | `api/routes/access.js`, `@xeplr/auth` menu routes | Publishing changes database tables. Every other screen route checks the permission catalog. |
|
|
86
86
|
| **The browser is not a security boundary.** Front-end hooks (`ui/src/pages/Edit<Form>.jsx`) shape what people see and send; anything that must hold goes in server hooks (`api/screens/<form>/<form>.hooks.js`); data shape in the model (`<form>.model.js`). | `@xeplr/ui-factory`, `@xeplr/factory` | |
|
|
87
87
|
| **Anything every app would write identically lives in a package, not in the generated app.** A generated app is a starting point that then lives its own life — glue copied into it can never be fixed centrally, so an app made last month keeps that copy forever. When the flow designer needed this app's forms, its functions and its flows, the wiring went into `@xeplr/ui-factory` (`FlowDesignerPage`) and the generated page passes its two API clients. | `@xeplr/ui-factory` | A fix or a new control type has to reach apps that already exist, and it cannot reach code that was copied into them. `test/cli.test.js` fails if the glue reappears in the generated app. |
|
|
88
|
+
| **Every page works on a phone.** Below 640px the side rail is a bar across the top, forms from the designer go one field per row, and tables scroll sideways inside their own box with their row buttons pinned on screen. | `@xeplr/ui-account`, `@xeplr/ui-factory`, `@xeplr/ui-table`, `ui/src/index.css` | One design serves both. A phone-only copy of a screen drifts from the real one, and a scaled-down desktop form is text too small to read in boxes too small to tap. |
|
|
88
89
|
| **Every data address is under `/api`.** | `api/routes`, `ui/vite.config.js` | A page path and a data path must never collide. |
|
|
89
90
|
| **No guessed database names or connections.** | `api/development.env` | A wrong-but-present value starts cleanly and reads as empty data. |
|
|
90
91
|
| **Email is checked at start, never fatal.** The sign-in banner shows `email ✓ …` or `✗ NOT WORKING — reason`. | `@xeplr/auth` | Sign-in works without email; activation, invite and reset links cannot be sent until `EMAIL_PROVIDER` is set. |
|
package/package.json
CHANGED
package/templates/CLAUDE.md
CHANGED
|
@@ -68,3 +68,5 @@ Replace the bold parts. Add behaviour in the same message if you want it — "a
|
|
|
68
68
|
- The browser is not a security boundary: anything that must hold goes in a server function, named in the screen's events.
|
|
69
69
|
- Hooks and models are **methods** calling `super` — never arrow-function properties.
|
|
70
70
|
- `authFetch` returns the parsed body, not a Response.
|
|
71
|
+
- **Every page works on a phone.** Forms and lists from the designer stack themselves below 640px; a page written by hand puts its phone rules in the `@media (max-width: 640px)` block at the bottom of `ui/src/index.css` — inputs 16px or larger, buttons 44px tall, tables scrolling inside their own box, no fixed width wider than the screen. Do not design a second, phone-only screen.
|
|
72
|
+
- Sign-up needs email and `AUTH_REGISTER_ROLES` (the role a new account gets, in `api/development.env`); without either, registration is refused on purpose — never work around it by activating accounts or granting roles in SQL. An admin can activate an account from the User Roles screen.
|
package/templates/api/README.md
CHANGED
|
@@ -41,4 +41,10 @@ The API (`@xeplr/base-apis`) and the sign-in service (`@xeplr/auth`), with this
|
|
|
41
41
|
| `DB_API`, `AUTH_DB_NAME` | the two database names — never guessed |
|
|
42
42
|
| `AUTH_SUPER_ADMIN_EMAIL` / `_PASSWORD` | the first account — created once, when the sign-in database is first set up |
|
|
43
43
|
| `AUTH_TENANT_HEADER` | `none`: one set of roles for everyone. A multi-tenant app names its company header (e.g. `x-company-id`), so a role made inside a company belongs to it |
|
|
44
|
-
| `
|
|
44
|
+
| `AUTH_ACTIVATION_URL`, `AUTH_INVITE_URL`, `AUTH_RESET_URL` | the UI pages the emailed links open; the token is appended. The reset address is never taken from the request |
|
|
45
|
+
| `AUTH_REGISTER_ROLES` | the role a new sign-up gets when activated (`Viewer`). **Required to register:** unset, or naming a role that does not exist, and registration is refused |
|
|
46
|
+
| `EMAIL_PROVIDER` and its settings | needed to register, resend an activation link, invite or reset a password — each is refused while email does not work. Signing in works without it |
|
|
47
|
+
|
|
48
|
+
## Sign-up
|
|
49
|
+
|
|
50
|
+
Register → an activation email → the link (or an admin's **Activate** on the User Roles screen) → sign in. Lost the email? `/auth/resend-activation` sends a new one. Invited people set their password at `/auth/accept-invite`.
|
|
@@ -65,6 +65,16 @@ AUTH_TENANT_HEADER=none
|
|
|
65
65
|
# email template can carry a token as a value but cannot build an address.
|
|
66
66
|
AUTH_ACTIVATION_URL=http://localhost:__UI_PORT__/auth/activate
|
|
67
67
|
AUTH_INVITE_URL=http://localhost:__UI_PORT__/auth/accept-invite
|
|
68
|
+
# Never taken from the request: a link built from its Host header could point
|
|
69
|
+
# a real user's reset mail at someone else's site. Unset, reset is refused.
|
|
70
|
+
AUTH_RESET_URL=http://localhost:__UI_PORT__/auth/reset-password
|
|
71
|
+
|
|
72
|
+
# ── The role a new sign-up gets ──
|
|
73
|
+
# Given when the account is activated. Without a role a person can sign in
|
|
74
|
+
# and do nothing — not even open their own profile. No default: unset, or a
|
|
75
|
+
# role that does not exist, and registration is refused. Comma-separate for
|
|
76
|
+
# more than one; Super Admin is never allowed here.
|
|
77
|
+
AUTH_REGISTER_ROLES=Viewer
|
|
68
78
|
|
|
69
79
|
# ── Uploaded files ──
|
|
70
80
|
# Where a form's FILE field puts what people upload. The path is what the
|
|
@@ -72,10 +82,12 @@ AUTH_INVITE_URL=http://localhost:__UI_PORT__/auth/accept-invite
|
|
|
72
82
|
# which checks the caller the way reading a record does. Relative to api/.
|
|
73
83
|
FACTORY_FILES_DIR=./uploads/factory
|
|
74
84
|
|
|
75
|
-
# ── Email
|
|
76
|
-
#
|
|
77
|
-
#
|
|
78
|
-
#
|
|
85
|
+
# ── Email ──
|
|
86
|
+
# Needed for anyone but the super admin to get in: registration, resending an
|
|
87
|
+
# activation link, invites and password reset all send a link, and each is
|
|
88
|
+
# refused while email does not work — no half-made accounts. Signing in keeps
|
|
89
|
+
# working without it. The sign-in service checks it at start and says so in
|
|
90
|
+
# its banner: "email ✓ smtp — host:587, connected" or "✗ NOT WORKING — reason".
|
|
79
91
|
# Providers: smtp | brevo | aws | azure — see @xeplr/utils' README.
|
|
80
92
|
# EMAIL_PROVIDER=smtp
|
|
81
93
|
# SMTP_HOST=
|
|
@@ -83,4 +95,3 @@ FACTORY_FILES_DIR=./uploads/factory
|
|
|
83
95
|
# SMTP_USER=
|
|
84
96
|
# SMTP_PASS=
|
|
85
97
|
# SMTP_FROM=
|
|
86
|
-
# (smtp also needs `npm install nodemailer` in this folder)
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
module.exports = [
|
|
11
11
|
// ENCRYPTION_KEY, AUTH_JWT_SECRET, AUTH_PORT, AUTH_DB_NAME,
|
|
12
|
-
// XEPLR_AUTH_MIGRATIONS, AUTH_SUPER_ADMIN_EMAIL / _PASSWORD, REDIS_PREFIX
|
|
12
|
+
// XEPLR_AUTH_MIGRATIONS, AUTH_SUPER_ADMIN_EMAIL / _PASSWORD, REDIS_PREFIX,
|
|
13
|
+
// AUTH_TENANT_HEADER, and the sign-up settings: AUTH_REGISTER_ROLES,
|
|
14
|
+
// AUTH_ACTIVATION_URL, AUTH_RESET_URL
|
|
13
15
|
...require('@xeplr/auth').requiredEnv,
|
|
14
16
|
|
|
15
17
|
// ── this app's own ──
|
|
@@ -17,15 +17,16 @@
|
|
|
17
17
|
"start-api": "node ./bin/www"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@xeplr/auth": "^1.
|
|
20
|
+
"@xeplr/auth": "^1.3.0",
|
|
21
21
|
"@xeplr/base-apis": "^2.0.0",
|
|
22
22
|
"@xeplr/db": "^1.0.6",
|
|
23
23
|
"@xeplr/factory": "^2.0.0",
|
|
24
|
-
"@xeplr/ui-factory": "^1.
|
|
24
|
+
"@xeplr/ui-factory": "^1.8.3",
|
|
25
25
|
"@xeplr/utils": "^1.0.11",
|
|
26
26
|
"dotenv": "^17.4.2",
|
|
27
27
|
"express": "^5.2.0",
|
|
28
28
|
"multer": "^2.0.2",
|
|
29
|
+
"nodemailer": "^10.0.2",
|
|
29
30
|
"@xeplr/actions": "^1.4.0",
|
|
30
31
|
"@xeplr/workflow-api": "^1.1.0"
|
|
31
32
|
},
|
package/templates/ui/README.md
CHANGED
|
@@ -26,4 +26,5 @@ npm run build # → dist/
|
|
|
26
26
|
- `authFetch` returns the **parsed body**, not a Response — no `.json()`.
|
|
27
27
|
- A side-rail item needs an **icon** (a collapsed rail shows icons only) and its key must exist as a menu row, or it is dropped silently. Give it its **`path`** too: that is how the rail marks the page you are on.
|
|
28
28
|
- The rail is 48px when collapsed; `--app-rail-width` in `src/index.css` reserves the same space and must match it.
|
|
29
|
+
- **Phones work without extra code.** Below 640px the rail becomes a bar across the top (`@xeplr/ui-account`) and `src/index.css` gives the page's top to it instead of its left (`--xeplr-nav-bar-height`). Forms and lists made in the designer stack themselves (`@xeplr/ui-factory`); tables keep scrolling sideways with their row buttons pinned on screen (`@xeplr/ui-table`). A page you write by hand follows the same rules in the phone block at the bottom of `src/index.css`: inputs 16px or larger (or iOS zooms the page), buttons 44px tall, tables that scroll inside their own box, nothing a fixed width wider than the screen.
|
|
29
30
|
- Set page backgrounds on a container inside the theme, never on `body`.
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@tanstack/react-table": "^8.21.3",
|
|
13
|
-
"@xeplr/ui-account": "^1.
|
|
13
|
+
"@xeplr/ui-account": "^1.4.2",
|
|
14
14
|
"@xeplr/ui-canvas": "^1.1.0",
|
|
15
|
-
"@xeplr/ui-factory": "^1.
|
|
16
|
-
"@xeplr/ui-table": "^1.
|
|
15
|
+
"@xeplr/ui-factory": "^1.8.3",
|
|
16
|
+
"@xeplr/ui-table": "^1.1.3",
|
|
17
17
|
"react": "^19.2.4",
|
|
18
18
|
"react-dom": "^19.2.4",
|
|
19
19
|
"react-router-dom": "^7.13.2",
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
--app-rail-width: 48px;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/* ON A PHONE (below 640px) the rail becomes a bar across the top — see
|
|
14
|
+
@xeplr/ui-account's nav.css — so the page gives up its top instead of its
|
|
15
|
+
left: --xeplr-nav-bar-height, set by that stylesheet. The rest of this
|
|
16
|
+
file's phone rules are at the bottom. */
|
|
17
|
+
|
|
13
18
|
body { margin: 0; }
|
|
14
19
|
|
|
15
20
|
.app {
|
|
@@ -374,3 +379,29 @@ body { margin: 0; }
|
|
|
374
379
|
.app-connect-steps li { margin-bottom: 14px; }
|
|
375
380
|
.app-connect code { font-size: 12.5px; padding: 1px 5px; border-radius: 4px; background: var(--xeplr-bg-secondary); border: 1px solid var(--xeplr-border-primary); }
|
|
376
381
|
.app-connect pre { margin: 6px 0 0; font-size: 12.5px; }
|
|
382
|
+
|
|
383
|
+
/* ── on a phone ──────────────────────────────────────────────────────────
|
|
384
|
+
Forms and lists made in the designer stack themselves (@xeplr/ui-factory),
|
|
385
|
+
and @xeplr/ui-table keeps its own rows reachable. What is left is this
|
|
386
|
+
app's own chrome: room for the top bar instead of the rail, tighter page
|
|
387
|
+
padding, fields one per row, tables that scroll inside their own box
|
|
388
|
+
rather than widening the page, and buttons a thumb can hit. */
|
|
389
|
+
@media (max-width: 640px) {
|
|
390
|
+
.app { padding-left: 0; padding-top: var(--xeplr-nav-bar-height, 52px); }
|
|
391
|
+
.main { padding: 16px 12px; }
|
|
392
|
+
.app-page h1 { font-size: 22px; }
|
|
393
|
+
.app-welcome h1 { font-size: 24px; }
|
|
394
|
+
|
|
395
|
+
.app-field-row { flex-direction: column; gap: 0; }
|
|
396
|
+
.app-field input, .app-field textarea, .app-field select { font-size: 16px; min-height: 44px; }
|
|
397
|
+
.app-forms-field { min-width: 0; flex-basis: 100%; }
|
|
398
|
+
.app-menu-label, .app-forms-new input { font-size: 16px; min-height: 44px; box-sizing: border-box; }
|
|
399
|
+
.app-btn { min-height: 44px; }
|
|
400
|
+
.app-row-actions .app-btn { min-height: 40px; padding: 8px 12px; }
|
|
401
|
+
|
|
402
|
+
.app-table { display: block; overflow-x: auto; }
|
|
403
|
+
.app-tabs { overflow-x: auto; }
|
|
404
|
+
.app-tab { white-space: nowrap; min-height: 44px; }
|
|
405
|
+
.app-help { padding: 16px; }
|
|
406
|
+
.app-connect { padding: 16px; }
|
|
407
|
+
}
|