@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.
Files changed (111) hide show
  1. package/README.md +2 -3
  2. package/bin/webjs.js +18 -18
  3. package/lib/api-gallery.js +1 -1
  4. package/lib/create.js +154 -243
  5. package/package.json +1 -1
  6. package/templates/.agents/rules/workflow.md +7 -3
  7. package/templates/.agents/skills/webjs/SKILL.md +4 -2
  8. package/templates/.agents/skills/webjs/references/auth-and-sessions.md +78 -16
  9. package/templates/.agents/skills/webjs/references/built-ins.md +16 -2
  10. package/templates/.agents/skills/webjs/references/client-router-and-streaming.md +38 -6
  11. package/templates/.agents/skills/webjs/references/components.md +101 -6
  12. package/templates/.agents/skills/webjs/references/data-and-actions.md +19 -2
  13. package/templates/.agents/skills/webjs/references/muscle-memory-gotchas.md +5 -1
  14. package/templates/.agents/skills/webjs/references/optimistic-ui.md +18 -0
  15. package/templates/.agents/skills/webjs/references/routing-and-pages.md +25 -2
  16. package/templates/.agents/skills/webjs/references/runtime.md +1 -1
  17. package/templates/.agents/skills/webjs/references/service-worker.md +1 -1
  18. package/templates/.agents/skills/webjs/references/styling.md +82 -2
  19. package/templates/AGENTS.md +12 -5
  20. package/templates/gallery/app/api/auth/[...path]/route.ts +7 -0
  21. package/templates/gallery/app/apple-icon.ts +2 -5
  22. package/templates/gallery/app/examples/layout.ts +16 -0
  23. package/templates/gallery/app/examples/todo/page.ts +2 -1
  24. package/templates/gallery/app/features/async-render/page.ts +3 -2
  25. package/templates/gallery/app/features/auth/dashboard/layout.ts +21 -0
  26. package/templates/gallery/app/features/auth/dashboard/middleware.ts +14 -0
  27. package/templates/gallery/app/features/auth/dashboard/page.ts +20 -0
  28. package/templates/gallery/app/features/auth/dashboard/settings/page.ts +22 -0
  29. package/templates/gallery/app/features/auth/login/middleware.ts +15 -0
  30. package/templates/gallery/app/features/auth/login/page.ts +43 -0
  31. package/templates/gallery/app/features/auth/page.ts +34 -0
  32. package/templates/gallery/app/features/auth/signup/middleware.ts +11 -0
  33. package/templates/gallery/app/features/auth/signup/page.ts +61 -0
  34. package/templates/gallery/app/features/boundaries/error.ts +5 -4
  35. package/templates/gallery/app/features/boundaries/gated/forbidden.ts +5 -4
  36. package/templates/gallery/app/features/boundaries/not-found.ts +5 -4
  37. package/templates/gallery/app/features/boundaries/page.ts +11 -10
  38. package/templates/gallery/app/features/boundaries/private/unauthorized.ts +5 -4
  39. package/templates/gallery/app/features/broadcast/page.ts +4 -3
  40. package/templates/gallery/app/features/caching/page.ts +5 -4
  41. package/templates/gallery/app/features/client-router/page.ts +7 -5
  42. package/templates/gallery/app/features/client-router/second/page.ts +4 -3
  43. package/templates/gallery/app/features/components/page.ts +3 -2
  44. package/templates/gallery/app/features/directives/page.ts +3 -2
  45. package/templates/gallery/app/features/env/page.ts +4 -3
  46. package/templates/gallery/app/features/file-storage/page.ts +8 -5
  47. package/templates/gallery/app/features/forms/page.ts +10 -6
  48. package/templates/gallery/app/features/frames/page.ts +26 -10
  49. package/templates/gallery/app/features/layout.ts +67 -0
  50. package/templates/gallery/app/features/metadata/page.ts +7 -6
  51. package/templates/gallery/app/features/optimistic-ui/page.ts +3 -2
  52. package/templates/gallery/app/features/rate-limit/page.ts +6 -5
  53. package/templates/gallery/app/features/route-handler/page.ts +4 -3
  54. package/templates/gallery/app/features/routing/[id]/page.ts +7 -6
  55. package/templates/gallery/app/features/routing/page.ts +10 -9
  56. package/templates/gallery/app/features/server-actions/page.ts +7 -4
  57. package/templates/gallery/app/features/service-worker/page.ts +4 -3
  58. package/templates/gallery/app/features/sessions/page.ts +5 -4
  59. package/templates/gallery/app/features/stream/page.ts +46 -0
  60. package/templates/gallery/app/features/streaming/page.ts +32 -0
  61. package/templates/gallery/app/features/suspense/page.ts +35 -0
  62. package/templates/gallery/app/features/view-transitions/page.ts +44 -0
  63. package/templates/gallery/app/features/view-transitions/second/page.ts +30 -0
  64. package/templates/gallery/app/features/websockets/page.ts +4 -3
  65. package/templates/gallery/app/global-error.ts +2 -5
  66. package/templates/gallery/app/global-not-found.ts +4 -6
  67. package/templates/gallery/app/icon.ts +2 -5
  68. package/templates/gallery/app/manifest.ts +1 -4
  69. package/templates/gallery/app/opengraph-image.ts +3 -6
  70. package/templates/gallery/app/robots.ts +0 -3
  71. package/templates/gallery/app/sitemap.ts +0 -3
  72. package/templates/gallery/app/twitter-image.ts +3 -6
  73. package/templates/gallery/components/ui/badge.ts +41 -0
  74. package/templates/gallery/components/ui/button.ts +86 -0
  75. package/templates/gallery/components/ui/card.ts +36 -0
  76. package/templates/gallery/components/ui/input.ts +50 -0
  77. package/templates/gallery/lib/utils/ui.ts +31 -0
  78. package/templates/gallery/modules/auth/actions/signup.server.ts +19 -0
  79. package/templates/gallery/modules/auth/auth.server.ts +53 -0
  80. package/templates/gallery/modules/auth/password.server.ts +20 -0
  81. package/templates/gallery/modules/auth/queries/current-user.server.ts +12 -0
  82. package/templates/gallery/modules/auth/types.ts +9 -0
  83. package/templates/gallery/modules/broadcast/components/broadcast-feed.ts +4 -2
  84. package/templates/gallery/modules/caching/components/cache-buster.ts +2 -1
  85. package/templates/gallery/modules/client-router/components/router-controls.ts +4 -3
  86. package/templates/gallery/modules/components/components/counter-card.ts +4 -2
  87. package/templates/gallery/modules/components/components/reactive-meter.ts +9 -1
  88. package/templates/gallery/modules/components/components/task-loader.ts +3 -2
  89. package/templates/gallery/modules/components/components/theme-context.ts +5 -3
  90. package/templates/gallery/modules/directives/components/directive-demo.ts +17 -10
  91. package/templates/gallery/modules/gallery/components/gallery-nav.ts +54 -0
  92. package/templates/gallery/modules/gallery/nav.ts +79 -0
  93. package/templates/gallery/modules/optimistic-ui/components/like-button.ts +19 -1
  94. package/templates/gallery/modules/rate-limit/components/rate-probe.ts +2 -1
  95. package/templates/gallery/modules/route-handler/components/rich-data.ts +2 -1
  96. package/templates/gallery/modules/server-actions/actions/greet.server.ts +2 -2
  97. package/templates/gallery/modules/server-actions/actions/greet.test.ts +39 -36
  98. package/templates/gallery/modules/server-actions/components/greeter.ts +11 -11
  99. package/templates/gallery/modules/server-actions/middleware/require-auth.server.ts +14 -9
  100. package/templates/gallery/modules/stream/components/stream-demo.ts +81 -0
  101. package/templates/gallery/modules/streaming/actions/stream-tokens.server.ts +17 -0
  102. package/templates/gallery/modules/streaming/components/token-stream.ts +53 -0
  103. package/templates/gallery/modules/suspense/components/slow-fact.ts +20 -0
  104. package/templates/gallery/modules/todo/components/todo-app.ts +8 -4
  105. package/templates/gallery/modules/websockets/components/ws-echo.ts +5 -3
  106. package/templates/gallery/test/auth/auth.test.ts +81 -0
  107. package/templates/public/favicon.svg +10 -3
  108. package/templates/scripts/clear-api-gallery.mjs +55 -0
  109. package/templates/scripts/clear-gallery.mjs +143 -24
  110. package/lib/lean-copy.js +0 -43
  111. 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 three scaffolds exist. Keep this list as the single source of
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', 'saas'];
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|saas] [--db sqlite|postgres] [--runtime node|bun] [--no-install] Scaffold a new webjs app
64
- (only 3 templates exist. default: full-stack, Drizzle, --db sqlite, --runtime node)
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|saas] [--db sqlite|postgres] [--runtime node|bun] [--no-install]',
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), api, or saas.' },
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-saas --template saas --db postgres',
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|saas]');
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 three scaffolds exist:
860
- full-stack (default): pages + components + API + Drizzle/SQLite.
861
- Pick this for any app the user describes in product terms
862
- (todo app, blog, dashboard, marketplace, social feed, …).
863
- api backend-only: route handlers + modules, no pages/SSR.
864
- Pick this only if the user explicitly asks for an HTTP/JSON
865
- API with no UI.
866
- saas auth + login/signup + protected dashboard + Drizzle User
867
- model. Pick this only if the user explicitly asks for auth
868
- or a SaaS-shaped product.
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 +
@@ -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 (like saas-template.js) to keep create.js readable and dodge
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
  */