Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

### Fixed

- README / `@cedarjs/pg/vite-plus` Vite+ example: `dev` is now `cedarpg run --attach --mode=dev -- vp dev` (with `cache: false`). Vite+ `dependsOn` does not forward env and task `env` only passes through the `vp` process env, so the old `command: "vp dev"` + `env: ["DATABASE_URL"]` never saw the leased URL.
- `cedarpg run` (plain and `--attach`) and `cedarpg studio` forward `SIGINT` / `SIGTERM` / `SIGHUP` to the child. A supervisor that signalled only the `cedarpg` process (Nx, pm2, `kill <pid>`) used to leave the child running. A child killed by a signal now exits with `128 + n` (130 for `SIGINT`, 143 for `SIGTERM`) instead of 1.
- Ephemeral host cold start no longer deletes `/dev/shm/PostgreSQL.*` and `pgserve-*`. Those are live shared-memory segments of every Postgres on the machine. Running with `CI=true` or `CEDAR_PG_EPHEMERAL_HOST=1` next to a registered local host deleted that host's segment, and every new connection to it then failed with `58P01 could not open shared memory segment` until it was restarted. Cold start now removes only cedar-pg's own leftover data dir (`/dev/shm/cedar-pg-<uid>`). The `53100` / quota hint no longer recommends `rm /dev/shm/PostgreSQL.*`.
- TEMPLATE `cloneWorkerDatabase` reuses the worker's `<template>_c_<workerId>` in Postgres across Jest test files. The `0.2.0-beta.0` fix cached the clone on `globalThis`, but Jest resets `globalThis` and the module registry for each test file. So the second file in a worker still ran `CREATE DATABASE` and failed with `database already exists`. The in-memory memo is removed; the database is the source of truth. As a result, calling it again with a different `root` / `name` in one process no longer throws: each call clones or reuses its own name. `smoke:pg` now runs two Jest files in one worker, after a seeded crashed run.
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,17 @@ export default defineConfig({
env: ["DATABASE_URL", "TEST_DATABASE_URL"],
},
dev: {
command: "vp dev",
command: "cedarpg run --attach --mode=dev -- vp dev",
dependsOn: ["db:acquire"],
env: ["DATABASE_URL"],
cache: false,
},
},
},
});
```

Like Nx `dependsOn`, Vite+ `dependsOn` does not forward env, and task `env` only fingerprints and passes through variables already set in the `vp` process. So `dev` acquires once via `db:acquire`, then `cedarpg run --attach` hands the lease `DATABASE_URL` to `vp dev`. `test` needs no wrapper: the stock Vitest setup acquires and sets the URL itself.

`cedarPgDev()` does not acquire. Keep `dependsOn: ["db:acquire"]`. On listen it prints a status panel (TTY, non-CI). Vite CLI shortcuts (`key` then Enter; also listed under `h`):

| Key | Action |
Expand Down
5 changes: 3 additions & 2 deletions src/adapters/vite-plus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
* dependsOn: ['db:acquire-test'],
* env: ['DATABASE_URL', 'TEST_DATABASE_URL'],
* },
* // dependsOn does not forward env: attach hands vp dev the lease URL.
* dev: {
* command: 'vp dev',
* command: 'cedarpg run --attach --mode=dev -- vp dev',
* dependsOn: ['db:acquire'],
* env: ['DATABASE_URL'],
* cache: false,
* },
* },
* },
Expand Down
Loading