diff --git a/changelog/cli/0.12.2.md b/changelog/cli/0.12.2.md new file mode 100644 index 000000000..bc6c7222e --- /dev/null +++ b/changelog/cli/0.12.2.md @@ -0,0 +1,18 @@ +--- +package: "@webjsdev/cli" +version: 0.12.2 +date: 2026-11-12T18:56:17.900Z +commit_count: 1 +--- +## Features + +- **`webjs verify`** ([#1698](https://github.com/webjsdev/webjs/pull/1698)) [`1824e0eaa`](https://github.com/webjsdev/webjs/commit/1824e0eaa) + * Whether the app works, in one call: `webjs check` and `webjs typecheck` in parallel, then `webjs test`, then the app's `webjs.dev.before` steps and an in-process boot that requests every page and GET route needing no parameter. No dev server to start or stop. A passing step prints one line and a failing one the tail of its output; every step runs even after a failure. +- **A minimal scaffold** ([#1698](https://github.com/webjsdev/webjs/pull/1698)) [`1824e0eaa`](https://github.com/webjsdev/webjs/commit/1824e0eaa) + * `webjs create` no longer pre-installs UI kit code (the first `webjs ui add` writes `lib/utils/cn.ts`), ships no theme toggle (dark mode follows the OS) and no `instrumentation.ts`. + * The full-stack app has no example module: `modules/` ships empty, and `AGENTS.md` lays out a module (`actions/`, `queries/`, `components/`, `utils/`, `types.ts`, its tests) and names the `modules`, `testing` and `progressive-enhancement` guides. The api template keeps its users endpoints, named as an example to replace. + +## Fixes + +- **On Node, `webjs test` gives each test file its own copy of the test database** ([#1698](https://github.com/webjsdev/webjs/pull/1698)) [`1824e0eaa`](https://github.com/webjsdev/webjs/commit/1824e0eaa) + * On Node every test file runs in a process of its own, and two writing to one SQLite file at once failed with `database is locked`. diff --git a/changelog/mcp/0.1.21.md b/changelog/mcp/0.1.21.md new file mode 100644 index 000000000..c7441a459 --- /dev/null +++ b/changelog/mcp/0.1.21.md @@ -0,0 +1,12 @@ +--- +package: "@webjsdev/mcp" +version: 0.1.21 +date: 2026-11-12T18:56:17.800Z +commit_count: 1 +--- +## Features + +- **The brief points at `webjs verify`, and the catalogue answers the lookups agents made** ([#1698](https://github.com/webjsdev/webjs/pull/1698)) [`1824e0eaa`](https://github.com/webjsdev/webjs/commit/1824e0eaa) + * The brief tells an agent to verify the app with `npx webjs verify` instead of running `webjs status` after every edit. + * `npx webjs source` with no name now says which database `webjs test` uses, how `webjs db seed` runs the seed file, that a page renders per request unless it exports `revalidate`, and what a `route.ts` handler receives. + * The `modules` guide covers a feature's `utils/` folder and no longer points at an example module. diff --git a/changelog/server/0.10.2.md b/changelog/server/0.10.2.md new file mode 100644 index 000000000..3269872d5 --- /dev/null +++ b/changelog/server/0.10.2.md @@ -0,0 +1,15 @@ +--- +package: "@webjsdev/server" +version: 0.10.2 +date: 2026-11-12T18:56:17.700Z +commit_count: 1 +--- +## Fixes + +- **`notFound()`, `forbidden()` and `unauthorized()` in an action called over RPC answer 404, 403 and 401** ([#1698](https://github.com/webjsdev/webjs/pull/1698)) [`1824e0eaa`](https://github.com/webjsdev/webjs/commit/1824e0eaa) + * They answered a logged 500 while the no-JS form path rendered the right status. The generated client stub and `invokeActionForTest` now reject with the same sentinel, so `isForbidden(err)` holds in the caller; with `throwOnError: false` the test gets the body instead. + * As on the form path, a throw evicts none of the action's declared `invalidates` tags, so a guard at the top of an action cannot be used to flush caches. A `revalidatePath()` the action called before the throw is still reported to the browser. +- **`submitForm` refuses to post a layout's lone logout form** ([#1698](https://github.com/webjsdev/webjs/pull/1698)) [`1824e0eaa`](https://github.com/webjsdev/webjs/commit/1824e0eaa) + * When the only bound form on the page has no fields and the test submits some, the form the test means is not rendered for that request; `submitForm` now says so instead of signing the user out. A form with fields of its own is still posted. +- **In development, a page POST with no `__webjs_action` field answers a 405 that names the field and `submitForm()`** ([#1698](https://github.com/webjsdev/webjs/pull/1698)) [`1824e0eaa`](https://github.com/webjsdev/webjs/commit/1824e0eaa) + * Production keeps the bare `Method Not Allowed`. diff --git a/changelog/ui/0.5.2.md b/changelog/ui/0.5.2.md new file mode 100644 index 000000000..d71111019 --- /dev/null +++ b/changelog/ui/0.5.2.md @@ -0,0 +1,11 @@ +--- +package: "@webjsdev/ui" +version: 0.5.2 +date: 2026-11-12T18:56:17.750Z +commit_count: 1 +--- +## Features + +- **The class helpers with a shadcn name take `className`** ([#1698](https://github.com/webjsdev/webjs/pull/1698)) [`1824e0eaa`](https://github.com/webjsdev/webjs/commit/1824e0eaa) + * `buttonClass({ variant: 'link', className: 'mt-2' })` merges the class through `cn()`, as shadcn's `buttonVariants` does, and so do the 16 other helpers that have a shadcn alias (`badgeClass`, `toggleClass`, `tabsListClass`, `itemClass` and the rest). Without a `className` every helper returns exactly what it did. + * `lib/utils.ts` (copied to an app as `lib/utils/cn.ts`) is about half the size: its commentary on the class merger moved to the package docs, and its code is unchanged. diff --git a/examples/blog/package.json b/examples/blog/package.json index 120a1a68b..f181b90f9 100644 --- a/examples/blog/package.json +++ b/examples/blog/package.json @@ -59,9 +59,9 @@ } }, "dependencies": { - "@webjsdev/cli": "^0.12.1", + "@webjsdev/cli": "^0.12.2", "@webjsdev/core": "^0.9.1", - "@webjsdev/server": "^0.10.1", + "@webjsdev/server": "^0.10.2", "dayjs": "^1.11.21", "drizzle-orm": "1.0.0-rc.5" }, diff --git a/gallery/package.json b/gallery/package.json index 8be3b7810..b9792242e 100644 --- a/gallery/package.json +++ b/gallery/package.json @@ -61,10 +61,10 @@ } }, "dependencies": { - "@webjsdev/cli": "^0.12.1", + "@webjsdev/cli": "^0.12.2", "@webjsdev/core": "^0.9.1", - "@webjsdev/server": "^0.10.1", - "@webjsdev/ui": "^0.5.1", + "@webjsdev/server": "^0.10.2", + "@webjsdev/ui": "^0.5.2", "drizzle-orm": "1.0.0-rc.5" }, "devDependencies": { diff --git a/package-lock.json b/package-lock.json index b0600e72b..6a33fa760 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,9 +36,9 @@ "name": "@webjsdev/example-blog", "version": "0.1.0", "dependencies": { - "@webjsdev/cli": "^0.12.1", + "@webjsdev/cli": "^0.12.2", "@webjsdev/core": "^0.9.1", - "@webjsdev/server": "^0.10.1", + "@webjsdev/server": "^0.10.2", "dayjs": "^1.11.21", "drizzle-orm": "1.0.0-rc.5" }, @@ -73,10 +73,10 @@ "name": "@webjsdev/gallery", "version": "0.1.0", "dependencies": { - "@webjsdev/cli": "^0.12.1", + "@webjsdev/cli": "^0.12.2", "@webjsdev/core": "^0.9.1", - "@webjsdev/server": "^0.10.1", - "@webjsdev/ui": "^0.5.1", + "@webjsdev/server": "^0.10.2", + "@webjsdev/ui": "^0.5.2", "drizzle-orm": "1.0.0-rc.5" }, "devDependencies": { @@ -6983,12 +6983,12 @@ }, "packages/cli": { "name": "@webjsdev/cli", - "version": "0.12.1", + "version": "0.12.2", "license": "MIT", "dependencies": { - "@webjsdev/mcp": "^0.1.20", - "@webjsdev/server": "^0.10.1", - "@webjsdev/ui": "^0.5.1" + "@webjsdev/mcp": "^0.1.21", + "@webjsdev/server": "^0.10.2", + "@webjsdev/ui": "^0.5.2" }, "bin": { "webjs": "bin/webjs.js" @@ -7033,11 +7033,11 @@ }, "packages/mcp": { "name": "@webjsdev/mcp", - "version": "0.1.20", + "version": "0.1.21", "license": "MIT", "dependencies": { - "@webjsdev/server": "^0.10.1", - "@webjsdev/ui": "^0.5.1" + "@webjsdev/server": "^0.10.2", + "@webjsdev/ui": "^0.5.2" }, "bin": { "webjs-mcp": "bin/webjs-mcp.js" @@ -7048,7 +7048,7 @@ }, "packages/server": { "name": "@webjsdev/server", - "version": "0.10.1", + "version": "0.10.2", "license": "MIT", "dependencies": { "ws": "^8.20.0" @@ -7089,7 +7089,7 @@ }, "packages/ui": { "name": "@webjsdev/ui", - "version": "0.5.1", + "version": "0.5.2", "license": "MIT", "dependencies": { "@webjsdev/core": "^0.9.1", @@ -7136,9 +7136,9 @@ "name": "@webjsdev/website", "version": "0.1.1", "dependencies": { - "@webjsdev/cli": "^0.12.1", + "@webjsdev/cli": "^0.12.2", "@webjsdev/core": "^0.9.1", - "@webjsdev/server": "^0.10.1" + "@webjsdev/server": "^0.10.2" }, "devDependencies": { "@types/node": "^24.0.0", diff --git a/packages/cli/package.json b/packages/cli/package.json index aaed5007f..a475feff8 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@webjsdev/cli", - "version": "0.12.1", + "version": "0.12.2", "type": "module", "description": "The CLI for WebJs, a full-stack JavaScript framework built on web components with server-side rendering and no build step. Runs the dev and production servers, scaffolds apps, validates conventions, and drives the database. Node 24+ or Bun.", "bin": { @@ -13,9 +13,9 @@ "README.md" ], "dependencies": { - "@webjsdev/mcp": "^0.1.20", - "@webjsdev/server": "^0.10.1", - "@webjsdev/ui": "^0.5.1" + "@webjsdev/mcp": "^0.1.21", + "@webjsdev/server": "^0.10.2", + "@webjsdev/ui": "^0.5.2" }, "publishConfig": { "access": "public" diff --git a/packages/mcp/package.json b/packages/mcp/package.json index 843a5b9a9..d675d95c4 100644 --- a/packages/mcp/package.json +++ b/packages/mcp/package.json @@ -1,6 +1,6 @@ { "name": "@webjsdev/mcp", - "version": "0.1.20", + "version": "0.1.21", "type": "module", "description": "The Model Context Protocol server for WebJs, a full-stack JavaScript framework built on web components with server-side rendering and no build step. Gives AI coding agents the WebJs brief, live app introspection over routes, actions, components, and convention checks, and the framework source.", "bin": { @@ -24,8 +24,8 @@ "README.md" ], "dependencies": { - "@webjsdev/server": "^0.10.1", - "@webjsdev/ui": "^0.5.1" + "@webjsdev/server": "^0.10.2", + "@webjsdev/ui": "^0.5.2" }, "publishConfig": { "access": "public" diff --git a/packages/server/package.json b/packages/server/package.json index ecdd68adc..b6b477172 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@webjsdev/server", - "version": "0.10.1", + "version": "0.10.2", "type": "module", "description": "The server for WebJs, a full-stack JavaScript framework built on web components with server-side rendering and no build step. Provides the file-based router, SSR, server actions, route handlers, middleware, and live reload on Node 24+ or Bun.", "main": "index.js", diff --git a/packages/ui/package.json b/packages/ui/package.json index d1b9c5b44..635be0325 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@webjsdev/ui", - "version": "0.5.1", + "version": "0.5.2", "type": "module", "description": "The AI-first component library for WebJs, a full-stack JavaScript framework built on web components with server-side rendering and no build step. Class-helper functions for visuals, custom elements only where state matters, source-copied into your repo so you own it.", "bin": { diff --git a/test/cli/test-db.test.mjs b/test/cli/test-db.test.mjs index f167b15c4..5f8106c93 100644 --- a/test/cli/test-db.test.mjs +++ b/test/cli/test-db.test.mjs @@ -102,13 +102,17 @@ test('a row round-trips through the app db', async () => { // A second run starts empty again: the row count assertion would fail on a reused database. assert.equal(run({}).status, 0, 'each run gets its own database'); - // #1697: test files run in parallel processes, and on one shared file they - // hit `database is locked`. Each file gets its own copy, so a second file - // inserting the same unique email still sees exactly one row. - writeFileSync(join(app, 'test', 'users', 'again.test.ts'), - readFileSync(join(app, 'test', 'users', 'users.test.ts'), 'utf8')); - const pair = run({}); - assert.equal(pair.status, 0, 'two files writing the same unique row each have their own database\n' + pair.stdout + pair.stderr); + // #1697: on Node, test files run in parallel processes, and on one shared + // file they hit `database is locked`. Each file gets its own copy, so a + // second file inserting the same unique email still sees exactly one row. + // `bun test` runs every file in one process, one after another, so there is + // no lock to hit and the files share the run's database by design. + if (!process.versions.bun) { + writeFileSync(join(app, 'test', 'users', 'again.test.ts'), + readFileSync(join(app, 'test', 'users', 'users.test.ts'), 'utf8')); + const pair = run({}); + assert.equal(pair.status, 0, 'two files writing the same unique row each have their own database\n' + pair.stdout + pair.stderr); + } // Counterfactual: opted out, the test runs against the unmigrated dev database and fails. assert.notEqual(run({ WEBJS_TEST_DB: '0' }).status, 0, 'without the test database the table does not exist'); diff --git a/website/app/(site)/docs/testing/page.ts b/website/app/(site)/docs/testing/page.ts index 1726d9b4b..acffc25ff 100644 --- a/website/app/(site)/docs/testing/page.ts +++ b/website/app/(site)/docs/testing/page.ts @@ -23,7 +23,7 @@ test('listPosts returns an array', async () => { const posts = await listPosts(); assert.ok(Array.isArray(posts)); }); -
Server tests get their own database. For a SQLite app, webjs test creates a temporary database, applies the app's migrations to it with webjs db migrate (or, before the first migration exists, pushes the schema with webjs db push, as Rails loads its schema file), and runs the server tests with DATABASE_URL pointing there, the way Rails prepares a test database. So a test can import the app's db and write to it without touching db/dev.db, and every run starts empty (insert what a test needs; the seed file is not applied). On Node each test file runs in a process of its own with its own copy of that database, as Rails gives each parallel worker one, so two files writing at once never see each other's rows or a database is locked error. A DATABASE_URL set in the shell is used as is (CI, or a Postgres test database), and WEBJS_TEST_DB=0 turns it off.
Server tests get their own database. For a SQLite app, webjs test creates a temporary database, applies the app's migrations to it with webjs db migrate (or, before the first migration exists, pushes the schema with webjs db push, as Rails loads its schema file), and runs the server tests with DATABASE_URL pointing there, the way Rails prepares a test database. So a test can import the app's db and write to it without touching db/dev.db, and every run starts empty (insert what a test needs; the seed file is not applied). On Node each test file runs in a process of its own with its own copy of that database, as Rails gives each parallel worker one, so two files writing at once never see each other's rows or a database is locked error. On Bun, bun test runs every file in one process, one after another, so the files share the run's database: a test inserts the rows it needs and does not rely on another file's. A DATABASE_URL set in the shell is used as is (CI, or a Postgres test database), and WEBJS_TEST_DB=0 turns it off.
Test renderToString for SSR output. Import it from @webjsdev/core/server, not the root, so your test stays explicit about which side it runs on: