@webjsdev/cli 0.10.44 → 0.10.46
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 +2 -3
- package/bin/webjs.js +18 -18
- package/lib/api-gallery.js +1 -1
- package/lib/create.js +154 -243
- package/package.json +1 -1
- package/templates/.agents/rules/workflow.md +7 -3
- package/templates/.agents/skills/webjs/SKILL.md +4 -2
- package/templates/.agents/skills/webjs/references/auth-and-sessions.md +78 -16
- package/templates/.agents/skills/webjs/references/built-ins.md +16 -2
- package/templates/.agents/skills/webjs/references/client-router-and-streaming.md +38 -6
- package/templates/.agents/skills/webjs/references/components.md +101 -6
- package/templates/.agents/skills/webjs/references/data-and-actions.md +19 -2
- package/templates/.agents/skills/webjs/references/muscle-memory-gotchas.md +5 -1
- package/templates/.agents/skills/webjs/references/optimistic-ui.md +18 -0
- package/templates/.agents/skills/webjs/references/routing-and-pages.md +25 -2
- package/templates/.agents/skills/webjs/references/runtime.md +1 -1
- package/templates/.agents/skills/webjs/references/service-worker.md +1 -1
- package/templates/.agents/skills/webjs/references/styling.md +82 -2
- package/templates/AGENTS.md +12 -5
- package/templates/gallery/app/api/auth/[...path]/route.ts +7 -0
- package/templates/gallery/app/apple-icon.ts +2 -5
- package/templates/gallery/app/examples/layout.ts +16 -0
- package/templates/gallery/app/examples/todo/page.ts +2 -1
- package/templates/gallery/app/features/async-render/page.ts +3 -2
- package/templates/gallery/app/features/auth/dashboard/layout.ts +21 -0
- package/templates/gallery/app/features/auth/dashboard/middleware.ts +14 -0
- package/templates/gallery/app/features/auth/dashboard/page.ts +20 -0
- package/templates/gallery/app/features/auth/dashboard/settings/page.ts +22 -0
- package/templates/gallery/app/features/auth/login/middleware.ts +15 -0
- package/templates/gallery/app/features/auth/login/page.ts +43 -0
- package/templates/gallery/app/features/auth/page.ts +34 -0
- package/templates/gallery/app/features/auth/signup/middleware.ts +11 -0
- package/templates/gallery/app/features/auth/signup/page.ts +61 -0
- package/templates/gallery/app/features/boundaries/error.ts +5 -4
- package/templates/gallery/app/features/boundaries/gated/forbidden.ts +5 -4
- package/templates/gallery/app/features/boundaries/not-found.ts +5 -4
- package/templates/gallery/app/features/boundaries/page.ts +11 -10
- package/templates/gallery/app/features/boundaries/private/unauthorized.ts +5 -4
- package/templates/gallery/app/features/broadcast/page.ts +4 -3
- package/templates/gallery/app/features/caching/page.ts +5 -4
- package/templates/gallery/app/features/client-router/page.ts +7 -5
- package/templates/gallery/app/features/client-router/second/page.ts +4 -3
- package/templates/gallery/app/features/components/page.ts +3 -2
- package/templates/gallery/app/features/directives/page.ts +3 -2
- package/templates/gallery/app/features/env/page.ts +4 -3
- package/templates/gallery/app/features/file-storage/page.ts +8 -5
- package/templates/gallery/app/features/forms/page.ts +10 -6
- package/templates/gallery/app/features/frames/page.ts +26 -10
- package/templates/gallery/app/features/layout.ts +67 -0
- package/templates/gallery/app/features/metadata/page.ts +7 -6
- package/templates/gallery/app/features/optimistic-ui/page.ts +3 -2
- package/templates/gallery/app/features/rate-limit/page.ts +6 -5
- package/templates/gallery/app/features/route-handler/page.ts +4 -3
- package/templates/gallery/app/features/routing/[id]/page.ts +7 -6
- package/templates/gallery/app/features/routing/page.ts +10 -9
- package/templates/gallery/app/features/server-actions/page.ts +7 -4
- package/templates/gallery/app/features/service-worker/page.ts +4 -3
- package/templates/gallery/app/features/sessions/page.ts +5 -4
- package/templates/gallery/app/features/stream/page.ts +46 -0
- package/templates/gallery/app/features/streaming/page.ts +32 -0
- package/templates/gallery/app/features/suspense/page.ts +35 -0
- package/templates/gallery/app/features/view-transitions/page.ts +44 -0
- package/templates/gallery/app/features/view-transitions/second/page.ts +30 -0
- package/templates/gallery/app/features/websockets/page.ts +4 -3
- package/templates/gallery/app/global-error.ts +2 -5
- package/templates/gallery/app/global-not-found.ts +4 -6
- package/templates/gallery/app/icon.ts +2 -5
- package/templates/gallery/app/manifest.ts +1 -4
- package/templates/gallery/app/opengraph-image.ts +3 -6
- package/templates/gallery/app/robots.ts +0 -3
- package/templates/gallery/app/sitemap.ts +0 -3
- package/templates/gallery/app/twitter-image.ts +3 -6
- package/templates/gallery/components/ui/badge.ts +41 -0
- package/templates/gallery/components/ui/button.ts +86 -0
- package/templates/gallery/components/ui/card.ts +36 -0
- package/templates/gallery/components/ui/input.ts +50 -0
- package/templates/gallery/lib/utils/ui.ts +31 -0
- package/templates/gallery/modules/auth/actions/signup.server.ts +19 -0
- package/templates/gallery/modules/auth/auth.server.ts +53 -0
- package/templates/gallery/modules/auth/password.server.ts +20 -0
- package/templates/gallery/modules/auth/queries/current-user.server.ts +12 -0
- package/templates/gallery/modules/auth/types.ts +9 -0
- package/templates/gallery/modules/broadcast/components/broadcast-feed.ts +4 -2
- package/templates/gallery/modules/caching/components/cache-buster.ts +2 -1
- package/templates/gallery/modules/client-router/components/router-controls.ts +4 -3
- package/templates/gallery/modules/components/components/counter-card.ts +4 -2
- package/templates/gallery/modules/components/components/reactive-meter.ts +9 -1
- package/templates/gallery/modules/components/components/task-loader.ts +3 -2
- package/templates/gallery/modules/components/components/theme-context.ts +5 -3
- package/templates/gallery/modules/directives/components/directive-demo.ts +17 -10
- package/templates/gallery/modules/gallery/components/gallery-nav.ts +54 -0
- package/templates/gallery/modules/gallery/nav.ts +79 -0
- package/templates/gallery/modules/optimistic-ui/components/like-button.ts +19 -1
- package/templates/gallery/modules/rate-limit/components/rate-probe.ts +2 -1
- package/templates/gallery/modules/route-handler/components/rich-data.ts +2 -1
- package/templates/gallery/modules/server-actions/actions/greet.server.ts +2 -2
- package/templates/gallery/modules/server-actions/actions/greet.test.ts +39 -36
- package/templates/gallery/modules/server-actions/components/greeter.ts +11 -11
- package/templates/gallery/modules/server-actions/middleware/require-auth.server.ts +14 -9
- package/templates/gallery/modules/stream/components/stream-demo.ts +81 -0
- package/templates/gallery/modules/streaming/actions/stream-tokens.server.ts +17 -0
- package/templates/gallery/modules/streaming/components/token-stream.ts +53 -0
- package/templates/gallery/modules/suspense/components/slow-fact.ts +20 -0
- package/templates/gallery/modules/todo/components/todo-app.ts +8 -4
- package/templates/gallery/modules/websockets/components/ws-echo.ts +5 -3
- package/templates/gallery/test/auth/auth.test.ts +81 -0
- package/templates/public/favicon.svg +10 -3
- package/templates/scripts/clear-api-gallery.mjs +55 -0
- package/templates/scripts/clear-gallery.mjs +143 -24
- package/lib/lean-copy.js +0 -43
- package/lib/saas-template.js +0 -568
package/README.md
CHANGED
|
@@ -38,9 +38,8 @@ Both `webjs create` and `create-webjs-app` auto-install dependencies in the new
|
|
|
38
38
|
## Commands
|
|
39
39
|
|
|
40
40
|
```sh
|
|
41
|
-
webjs create <name> # scaffold a full-stack app (default)
|
|
42
|
-
webjs create <name> --template api # backend-only API app
|
|
43
|
-
webjs create <name> --template saas # auth + dashboard + Drizzle User model
|
|
41
|
+
webjs create <name> # scaffold a full-stack app (default; auth ships as a gallery card)
|
|
42
|
+
webjs create <name> --template api # backend-only API app (routes + modules + Drizzle)
|
|
44
43
|
|
|
45
44
|
webjs dev # dev server with live reload (runs webjs.dev.before, e.g. webjs db migrate, then serves; npm run dev is a thin alias)
|
|
46
45
|
webjs start # production server (no build step, serves source directly)
|
package/bin/webjs.js
CHANGED
|
@@ -43,10 +43,10 @@ if (cmd !== 'help' && cmd !== undefined && !wantsHelp && !wantsVersion) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
// Exactly
|
|
46
|
+
// Exactly two scaffolds exist. Keep this list as the single source of
|
|
47
47
|
// truth. AI-agent docs in README.md / AGENTS.md / .cursorrules /
|
|
48
48
|
// .agents/rules/workflow.md / .github/copilot-instructions.md mirror it.
|
|
49
|
-
const TEMPLATES = ['full-stack', 'api'
|
|
49
|
+
const TEMPLATES = ['full-stack', 'api'];
|
|
50
50
|
|
|
51
51
|
const USAGE = `webjs commands:
|
|
52
52
|
webjs dev [--port 8080] [--no-hot] Start dev server with live reload
|
|
@@ -60,8 +60,8 @@ const USAGE = `webjs commands:
|
|
|
60
60
|
--json emits the structured results (with stable codes). --strict also fails the exit on warnings
|
|
61
61
|
webjs types Generate .webjs/routes.d.ts (typed Route union + per-route params)
|
|
62
62
|
webjs typecheck [tsc args...] Type-check the app with the project's tsc --noEmit (non-zero on errors)
|
|
63
|
-
webjs create <name> [--template full-stack|api
|
|
64
|
-
(only
|
|
63
|
+
webjs create <name> [--template full-stack|api] [--db sqlite|postgres] [--runtime node|bun] [--no-install] Scaffold a new webjs app
|
|
64
|
+
(only 2 templates exist. default: full-stack, Drizzle, --db sqlite, --runtime node)
|
|
65
65
|
--runtime bun emits a Bun-flavored app (bun.lock, bun Dockerfile/CI, bun docs);
|
|
66
66
|
also auto-detected when run via "bun create webjs".
|
|
67
67
|
Auto-runs the detected package manager's install in the new dir
|
|
@@ -160,10 +160,10 @@ const HELP = {
|
|
|
160
160
|
examples: ['webjs typecheck', 'webjs typecheck --watch'],
|
|
161
161
|
},
|
|
162
162
|
create: {
|
|
163
|
-
usage: 'webjs create <name> [--template full-stack|api
|
|
163
|
+
usage: 'webjs create <name> [--template full-stack|api] [--db sqlite|postgres] [--runtime node|bun] [--no-install]',
|
|
164
164
|
summary: 'Scaffold a new app. Defaults: full-stack template, Drizzle + SQLite, Node runtime.',
|
|
165
165
|
options: [
|
|
166
|
-
{ flag: '--template <t>', description: 'full-stack (default)
|
|
166
|
+
{ flag: '--template <t>', description: 'full-stack (default) or api (backend-only, no UI).' },
|
|
167
167
|
{ flag: '--db <d>', description: 'sqlite (default) or postgres.' },
|
|
168
168
|
{ flag: '--runtime <r>', description: 'node (default) or bun.' },
|
|
169
169
|
{ flag: '--no-install', description: 'Skip the package-manager install step.' },
|
|
@@ -171,7 +171,7 @@ const HELP = {
|
|
|
171
171
|
examples: [
|
|
172
172
|
'webjs create my-app',
|
|
173
173
|
'webjs create my-api --template api',
|
|
174
|
-
'webjs create my-
|
|
174
|
+
'webjs create my-api --template api --db postgres',
|
|
175
175
|
'webjs create my-app --runtime bun',
|
|
176
176
|
],
|
|
177
177
|
},
|
|
@@ -846,7 +846,7 @@ async function main() {
|
|
|
846
846
|
case 'create': {
|
|
847
847
|
const name = rest[0];
|
|
848
848
|
if (!name || name.startsWith('-')) {
|
|
849
|
-
console.error('Usage: webjs create <app-name> [--template full-stack|api
|
|
849
|
+
console.error('Usage: webjs create <app-name> [--template full-stack|api]');
|
|
850
850
|
process.exit(1);
|
|
851
851
|
}
|
|
852
852
|
const template = flag(rest, '--template', 'full-stack');
|
|
@@ -856,16 +856,16 @@ async function main() {
|
|
|
856
856
|
// on which scaffold to pick for which kind of app.
|
|
857
857
|
console.error(`Error: unknown template '${template}'.
|
|
858
858
|
|
|
859
|
-
Only
|
|
860
|
-
full-stack (default): pages + components + API + Drizzle/SQLite
|
|
861
|
-
|
|
862
|
-
(
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
859
|
+
Only two scaffolds exist:
|
|
860
|
+
full-stack (default): pages + components + API + Drizzle/SQLite, plus a
|
|
861
|
+
browsable feature gallery. Auth is one of the gallery cards
|
|
862
|
+
(login + session + a protected route), so a full-stack app
|
|
863
|
+
already carries a real auth baseline. Pick this for any app
|
|
864
|
+
the user describes in product terms (todo, blog, dashboard,
|
|
865
|
+
marketplace, social feed, a SaaS with accounts, …).
|
|
866
|
+
api backend-only: route handlers + modules + Drizzle/SQLite, no
|
|
867
|
+
pages/SSR. Pick this only if the user explicitly asks for an
|
|
868
|
+
HTTP/JSON API with no UI.
|
|
869
869
|
|
|
870
870
|
The scaffold is a starting point. Replace the example layout/page/
|
|
871
871
|
components/schema with the actual app the user requested. Use Drizzle +
|
package/lib/api-gallery.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Backend-features showcase for `webjs create --template api`.
|
|
3
3
|
* A set of JSON/HTTP endpoints under `app/api/features/` that demonstrate the
|
|
4
4
|
* backend capabilities an API app uses (the api counterpart of the UI gallery).
|
|
5
|
-
* Extracted here
|
|
5
|
+
* Extracted here to keep create.js readable and dodge
|
|
6
6
|
* nested-template-literal escaping: files are built from arrays of
|
|
7
7
|
* double-quoted strings, so `${...}` and backticks are emitted literally.
|
|
8
8
|
*/
|