@webjsdev/cli 0.10.50 → 0.10.51
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 +3 -1
- package/bin/webjs.js +133 -30
- package/lib/api-gallery.js +6 -7
- package/lib/app-name.js +208 -0
- package/lib/create.js +37 -9
- package/lib/doctor.js +479 -7
- package/package.json +2 -2
- package/templates/.agents/rules/workflow.md +9 -1
- package/templates/.agents/skills/webjs/SKILL.md +25 -11
- package/templates/.agents/skills/webjs/references/auth-and-sessions.md +2 -2
- package/templates/.agents/skills/webjs/references/built-ins.md +25 -6
- package/templates/.agents/skills/webjs/references/client-router-and-streaming.md +6 -2
- package/templates/.agents/skills/webjs/references/components.md +9 -1
- package/templates/.agents/skills/webjs/references/data-and-actions.md +40 -7
- package/templates/.agents/skills/webjs/references/muscle-memory-gotchas.md +54 -18
- package/templates/.agents/skills/webjs/references/optimistic-ui.md +35 -14
- package/templates/.agents/skills/webjs/references/routing-and-pages.md +34 -15
- package/templates/.agents/skills/webjs/references/runtime.md +5 -1
- package/templates/.agents/skills/webjs/references/styling.md +1 -1
- package/templates/.agents/skills/webjs/references/testing.md +61 -3
- package/templates/.agents/skills/webjs/references/typescript.md +71 -2
- package/templates/.agents/skills/webjs/references/ui-kit.md +5 -2
- package/templates/.github/pull_request_template.md +1 -0
- package/templates/.github/workflows/ci.yml +13 -0
- package/templates/AGENTS.md +31 -5
- package/templates/CONVENTIONS.md +4 -1
- package/templates/gallery/app/examples/layout.ts +2 -1
- package/templates/gallery/app/examples/todo/page.ts +3 -16
- package/templates/gallery/app/features/auth/dashboard/layout.ts +2 -1
- package/templates/gallery/app/features/auth/signup/page.ts +4 -23
- package/templates/gallery/app/features/caching/page.ts +6 -6
- package/templates/gallery/app/features/file-storage/page.ts +8 -19
- package/templates/gallery/app/features/forms/page.ts +12 -38
- package/templates/gallery/app/features/layout.ts +6 -2
- package/templates/gallery/app/features/route-handler/data/route.ts +2 -1
- package/templates/gallery/app/features/view-transitions/page.ts +1 -1
- package/templates/gallery/app/global-error.ts +7 -4
- package/templates/gallery/modules/auth/actions/signup.server.ts +27 -11
- package/templates/gallery/modules/file-storage/actions/store-upload.server.ts +21 -10
- package/templates/gallery/modules/forms/actions/send-message.server.ts +34 -0
- package/templates/gallery/modules/gallery/nav.ts +1 -1
- package/templates/gallery/modules/server-actions/actions/greet.test.ts +6 -5
- package/templates/gallery/modules/todo/actions/submit-todo.server.ts +31 -0
- package/templates/gallery/modules/todo/components/todo-app.ts +8 -5
- package/templates/gallery/modules/todo/types.ts +15 -10
- package/templates/gallery/test/auth/auth.test.ts +31 -16
- package/templates/partials/agents-playbook-api.md +5 -0
- package/templates/partials/agents-playbook-fullstack.md +5 -0
- package/templates/scripts/clear-gallery.mjs +5 -4
- package/templates/test/hello/e2e/hello.test.ts +18 -1
|
@@ -47,6 +47,10 @@ cross-origin access use the `cors()` middleware from `@webjsdev/server`; with
|
|
|
47
47
|
Run each of these and fix what it reports, in order:
|
|
48
48
|
|
|
49
49
|
- `npm run check` (correctness: no browser-import or boundary violation).
|
|
50
|
+
- `npm run doctor` (project health; CI runs it too). It fails on whatever
|
|
51
|
+
`package.json` `webjs.doctor.gate` marks `error`, plus the two hard toolchain
|
|
52
|
+
checks that are fatal with no gate entry, `NODE_VERSION` and
|
|
53
|
+
`TSCONFIG_ERASABLE`.
|
|
50
54
|
- `npm run typecheck` (zero type errors).
|
|
51
55
|
- `npm test` (unit tests for the endpoints and modules you built).
|
|
52
56
|
|
|
@@ -63,5 +67,6 @@ npm run start # production server
|
|
|
63
67
|
npm test # unit + browser tests
|
|
64
68
|
npm run typecheck
|
|
65
69
|
npm run check # correctness checks
|
|
70
|
+
npm run doctor # project health (severity per check: webjs.doctor.gate)
|
|
66
71
|
npm run db:generate && npm run db:migrate
|
|
67
72
|
```
|
|
@@ -98,6 +98,10 @@ accessor). Use the shorthand for primitives
|
|
|
98
98
|
Run each of these and fix what it reports, in order:
|
|
99
99
|
|
|
100
100
|
- `npm run check` (correctness: no browser-import or boundary violation).
|
|
101
|
+
- `npm run doctor` (project health; CI runs it too). It fails on whatever
|
|
102
|
+
`package.json` `webjs.doctor.gate` marks `error`, plus the two hard toolchain
|
|
103
|
+
checks that are fatal with no gate entry, `NODE_VERSION` and
|
|
104
|
+
`TSCONFIG_ERASABLE`.
|
|
101
105
|
- `npm run typecheck` (zero type errors).
|
|
102
106
|
- `npm test` (unit and browser tests for the features you built).
|
|
103
107
|
- `npm run css:build` (compile Tailwind).
|
|
@@ -118,6 +122,7 @@ npm test # unit + browser tests
|
|
|
118
122
|
npm run typecheck
|
|
119
123
|
npm run css:build # compile Tailwind
|
|
120
124
|
npm run check # correctness checks
|
|
125
|
+
npm run doctor # project health (severity per check: webjs.doctor.gate)
|
|
121
126
|
npx webjsdev ui add <name> # copy a ui primitive into components/ui/
|
|
122
127
|
npx webjsdev ui view <name> # inspect a primitive's exact signature
|
|
123
128
|
npm run db:generate && npm run db:migrate
|
|
@@ -79,9 +79,9 @@ const galleryPaths = [
|
|
|
79
79
|
// query), pruned with the rest of the card.
|
|
80
80
|
const galleryModules = [
|
|
81
81
|
'async-render', 'auth', 'broadcast', 'caching', 'client-router', 'components',
|
|
82
|
-
'directives', 'file-storage', 'frames', 'gallery', 'optimistic-ui',
|
|
83
|
-
'route-handler', 'server-actions', 'sessions', 'stream',
|
|
84
|
-
'todo', 'websockets',
|
|
82
|
+
'directives', 'file-storage', 'forms', 'frames', 'gallery', 'optimistic-ui',
|
|
83
|
+
'rate-limit', 'route-handler', 'server-actions', 'sessions', 'stream',
|
|
84
|
+
'streaming', 'suspense', 'todo', 'websockets',
|
|
85
85
|
].map((m) => `modules/${m}`);
|
|
86
86
|
|
|
87
87
|
let removed = 0;
|
|
@@ -174,6 +174,7 @@ export default function Home() {
|
|
|
174
174
|
|
|
175
175
|
function MINIMAL_LAYOUT() {
|
|
176
176
|
return `import { html, asset } from '@webjsdev/core';
|
|
177
|
+
import type { LayoutProps } from '@webjsdev/core';
|
|
177
178
|
|
|
178
179
|
/**
|
|
179
180
|
* Root layout: the ONLY file that writes the document shell. It links the
|
|
@@ -191,7 +192,7 @@ function MINIMAL_LAYOUT() {
|
|
|
191
192
|
// hand-written <link> in the template body is ignored by browsers).
|
|
192
193
|
export const metadata = { icons: '/public/favicon.svg' };
|
|
193
194
|
|
|
194
|
-
export default function RootLayout({ children }:
|
|
195
|
+
export default function RootLayout({ children }: LayoutProps) {
|
|
195
196
|
return html\`
|
|
196
197
|
<meta name="color-scheme" content="light dark">
|
|
197
198
|
<!-- asset() content-hashes the url in production, so a deploy that changes
|
|
@@ -12,9 +12,26 @@
|
|
|
12
12
|
import { test, describe, before, after } from 'node:test';
|
|
13
13
|
import assert from 'node:assert/strict';
|
|
14
14
|
import { spawn } from 'node:child_process';
|
|
15
|
+
import type { ChildProcess } from 'node:child_process';
|
|
15
16
|
import { createServer } from 'node:net';
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
// puppeteer-core is an optional dev dependency, so `import type { Browser,
|
|
19
|
+
// Page } from 'puppeteer-core'` does not resolve until you install it. These
|
|
20
|
+
// minimal structural types keep the file typed in the meantime; swap them for
|
|
21
|
+
// the real imports once puppeteer-core is in package.json. Reaching for `any`
|
|
22
|
+
// here would silently un-type every call below.
|
|
23
|
+
type Page = {
|
|
24
|
+
// goto resolves an HTTPResponse this file never reads, and modelling that
|
|
25
|
+
// type would mean re-declaring puppeteer's. Returning void is the honest
|
|
26
|
+
// narrow shape for the surface actually used.
|
|
27
|
+
goto(url: string, opts?: { waitUntil?: string; timeout?: number }): Promise<void>;
|
|
28
|
+
title(): Promise<string>;
|
|
29
|
+
on(event: string, handler: (e: Error) => void): void;
|
|
30
|
+
removeAllListeners(event: string): void;
|
|
31
|
+
};
|
|
32
|
+
type Browser = { newPage(): Promise<Page>; close(): Promise<void> };
|
|
33
|
+
|
|
34
|
+
let browser: Browser, page: Page, serverProcess: ChildProcess, baseUrl: string;
|
|
18
35
|
|
|
19
36
|
function freePort(): Promise<number> {
|
|
20
37
|
return new Promise((resolve, reject) => {
|