Skip to content

Releases: cedarjs/cedar

v4.0.0

12 Apr 22:49

Choose a tag to compare

Release Notes

Vite 7

With this release of Cedar we're upgrading Vite from v5 (that's no longer supported) to v7.

Release notes:

Migration guides:

If you have a pretty standard Vite config you probably don't have to make any changes at all. But if you have something more custom, please take a closer look at the resources linked above.

cedar-gen

If you were manually executing the rw-gen bin, you will need to switch to manually executing cedar-gen. The binary was renamed.

I also renamed REDWOOD_ENV_FILES_LOADED to CEDAR_ENV_FILES_LOADED. This is an internal environment variable, and I don't expect anyone to be setting or reading this variable. If you are, please let me know!

.cedar/

This isn't breaking, but I wanted to call it out anyway:
Cedar apps now default to a top level .cedar/ directory for generated types, GraphQL schema, and other transitory data (instead of .redwood/)

With both a cedar.toml file and a .cedar/ directory it should be much more clear to those working on the app that it's a Cedar app and nothing else.

.redwood/ is still supported and will work just like before. But I do recommend you rename it locally (and update relevant .gitignore rules). At some point in the future I will remove support for .redwood/.

Changelog

🚀 Features

feat(pm): Package manager agnostic. Slice 2 (#1495) by @Tobbe

Continue on the work to bring npm and pnpm support to Cedar apps

feat(deps)!: Upgrade to Vite 7 (#1441) by @Tobbe

Hot on the heels of #1376 we're jumping to Vite 7

The upgrade guide from v6 to v7 is here https://v7.vite.dev/guide/migration

A few of the changes I had to do to get this to work with Cedar:

  • We used [::] as the apiHost during dev. Vite 7's underlying proxy library now does a DNS lookup on [::] (with brackets), which fails. Switching to IPv4 127.0.0.1 instead, to make this work
  • Vite 7 is more strict about esbuild resolution. If esbuild can't resolve an import during the dep scan, it fails the entire scan. The src/pages/FatalErrorPage imports in App.tsx/Routes.tsx look like bare module specifiers to esbuild. They work normally only because @vitejs/plugin-react runs them through Babel (specifically babel-plugin-module-resolver with the src alias), but the dep scan uses esbuild directly without Babel transforms. The solution is a new Vite plugin.
  • Had to await a Storybook plugin
feat(pm): Making create-cedar-app package manager agnostic (#1472) by @Tobbe

This is a big step towards making Cedar package manager agnostic!
Every other pm agnostic PR will need to be tested in a Cedar app that uses that PM. And to be able to do that, we first have to be able to create a Cedar app using that PM

feat(cca): Neon Postgres (#1503) by @Tobbe

Optionally give the user a Neon database as part of creating a Cedar app

feat(project-config): Support .cedar/ dir (#1500) by @Tobbe

Support both .cedar/ and .redwood/ dirs for framework generated and transitory files.

This makes it more clear to everyone working on a project that it's a Cedar app and not a Redwood app

feat(cca): Explicit type: commonjs (#1540) by @Tobbe

This makes it easier for users to later switch to esm

feat(live-queries): Make it experimental (#1582) by @Tobbe

Move gqlorm aka live support to the experimental features cli subcommand

feat(cca): PGLite (#1486) by @Tobbe

Adds hidden (which means it's experimental) flag --db pglite to create-cedar-app

feat(vite)!: Upgrade to Vite 6 (#1376) by @Tobbe

Upgrade Vite from 5.4.21 to 6.3.7 across all packages and templates.
Update internal framework usage of ViteRuntime to the new ModuleRunner API.
Update internal createViteRuntime calls to createServerModuleRunner.
Update internal executeUrl usage to import.
Update rollup-plugin-commonjs and postcss-load-config dependencies.
Update test project fixtures.

feat(gqlorm): schema generation (#1560) by @Tobbe

Implements the next step of the gqlorm plan

feat(cca): Neon direct db url (#1507) by @Tobbe

DIRECT_DATABASE_URL for Neon databases, and some more details about the db in .env
Plus nicer install path when it's not in a nested dir

feat(gqlorm): guard schema generation behind experimental.gqlorm.enabled (#1590) by @lisa-assistant

Summary

Wraps all generateGqlormArtifacts() calls behind a config.experimental.gqlorm.enabled check so the schema is only generated when the feature is explicitly opted into via cedar.toml:

[experimental.gqlorm]
  enabled = true

Three places updated:

  • packages/internal/src/generate/generate.ts — the generate() function called by rw-gen / rw-gen-watch
  • packages/cli/src/commands/dev/devHandler.ts — the eager pre-Vite generation
  • packages/cli/src/commands/build/buildHandler.ts — the Listr build task

Test plan

  • With experimental.gqlorm.enabled = false (or absent): yarn cedar build, yarn cedar dev, and yarn cedar generate should not generate .cedar/gqlorm-schema.json
  • With experimental.gqlorm.enabled = true: all three should generate the schema as before

🤖 Generated with Claude Code

feat(cedar-gen)!: Rename rw-gen to cedar-gen (#1591) by @Tobbe

Renaming more public surface areas to cedar

🛠️ Fixes

fix(tui): Don't draw boxen around warnings or errors (#1481) by @Tobbe

The vertical lines in the boxes messes too much with the terminal output when it's resized. A simple header and footer is more resilient to this.

fix(web): simplify Helmet imports to use named ESM exports (#1470) by @mvanhorn

Summary

Replaced import * as helmetPkg + destructuring with direct named imports from @dr.pogodin/react-helmet.

Why this matters

The import * as pattern was needed when the package lacked ESM support. @dr.pogodin/react-helmet v2.0.4 ships with exports.import in its package.json, making named imports work correctly. The old pattern added unnecessary indirection.

Changes

  • packages/web/src/components/MetaTags.tsx: import { Helmet as HelmetHead }
  • packages/web/src/components/Metadata.tsx: import { Helmet as HelmetHead }
  • packages/web/src/components/RedwoodProvider.tsx: import { Helmet, HelmetProvider }
  • packages/web/src/index.ts: import { Helmet }

4 files, net -7 lines.

Testing

Verified @dr.pogodin/react-helmet@2.0.4 has exports.import and module fields in its npm registry entry. No behavioral change - same symbols imported, just cleaner syntax.

Closes #373

This contribution was developed with AI assistance (Claude Code).

fix(cca): Use .env for neon database url (#1506) by @Tobbe

Put the neon connection string in the .env file

fix(cli): Dev handler concurrently shutdown (#1492) by @Tobbe

Comment says it all. Had to add process.exit(0) in a then-handler

  // When the user press Ctrl+C, the terminal sends `SIGINT` to the entire
  // process group. Concurrently's `KillOnSignal` controller catches it and
  // forwards it to the child processes (web, gen, api) but it intentionally
  // suppresses Node's default "exit on SIGINT" behaviour so it can wait for the
  // children to shut down cleanly first.
  // Once all three children exit, `KillOnSignal` remaps their exit codes to `0`
  // (since they were killed by a signal, not a real failure), which causes
  // `result` to resolve rather than reject. The `catch(...)` here then never
  // fires. The `cedar dev` process ends up just sitting here with
  // `process.stdin` still in flowing mode from `handleInput: true`, keeping the
  // event loop alive indefinitely.
  // So we have a `then` handler that cleanly exits the process when `result`
  // resolves.
fix(cca): Include db overlays in bundle (#1491) by @Tobbe

Include templates for the new --db flag

fix(project): .cedar in more places (#1508) by @Tobbe

More work on making .cedar/ the main dir for framework generated data

fix(gqlorm): Add gqlorm to cedar.toml schema (#1601) by @Tobbe

This should have been part of #1582

fix(gqlorm): Load env vars in rw-gen (#1588) by @Tobbe

Fixes a regression introduced by #1560

fix(live-queries): remove extra blank line before [experimental.gqlorm] in cedar.toml (#1597) by @lisa-assistant

Summary

  • When running yarn cedar experimental live-queries, the setup command appended [experimental.gqlorm] with two leading newlines (\n\n), causing an extra blank line in cedar.toml
  • All other experimental setup handlers use a single \n prefix — this one was inconsistent
  • Fix: change '\n\n[experimental.gqlorm]\n enabled = true\n''\n[experimental.gqlorm]\n enabled = true\n'

Test plan

  • Run yarn cedar experimental live-queries on a fresh project and verify `ceda...
Read more

v3.1.1

08 Apr 13:25

Choose a tag to compare

Changelog

🛠️ Fixes

fix(realtime): Use file extension when exporting (#1521) by @Tobbe

ESM requires file extensions (.js or .ts depending on settings)

Fixes #1519

Revert "fix(deps): update dependency vite to v6.4.1 (#1442)" (4fe08b5) by @Tobbe Vite was accidentally upgraded from v5 to v6 in the Cedar v3.1.0 release. It should have been part of a major release. Renovate slipped this one in

🧹 Chore

Click to see all chore contributions
  • Revert "fix(deps): update dependency vite to v6.4.1 (#1442)" (4fe08b5) by @Tobbe
  • Revert "fix(deps): eslint needs to track vite's eslint 0.25.0" (d3c108f) by @Tobbe

v3.1.0

25 Mar 23:54

Choose a tag to compare

Release Notes

Mostly wanted to get two things out:

  • Bug fix for the shared workspace packages feature
  • Upgrade to latest Apollo Client 3.x version to better prepare everyone for AC 4

See #1446 for more details on the first bullet point. That same PR was also back-ported to Cedar v2 with the v2.8.1 release.

The significance of the second bullet point is that the Apollo Client team added many more deprecation messages, to help users prepare for the v4 release of @apollo/client. I wanted to get this out sooner rather than later to give all Cedar users some time to prepare for when Cedar upgrades to Apollo Client 4.

Changelog

🚀 Features

feat(pm): Detect package manager (#1451) by @Tobbe

Start on making Cedar work with both yarn, pnpm and npm

feat(pm): Package manager agnostic install(), add(), dedupe() (#1457) by @Tobbe

Add helper methods for getting the package manager specific install, add and dedupe commands

🛠️ Fixes

  • fix(deps): eslint needs to track vite's eslint 0.25.0 (a08f233) by @Tobbe
fix(cli-helpers): Proper darwin url (#1454) by @Tobbe

This PR fixes this warning:

11:38:27 PM [vite] (ssr) warning: File URL host must be "localhost" or empty on darwin
  Plugin: vite:dynamic-import-vars
  File: /Users/tobbe/dev/cedarjs/cedar/packages/cli-helpers/src/lib/index.ts
 ✓ src/lib/__tests__/index.test.ts (1 test) 297ms
   ✓ prettify formats tsx content 297ms

 Test Files  1 passed (1)
      Tests  1 passed (1)
   Start at  23:38:27
   Duration  724ms (transform 74ms, setup 0ms, collect 154ms, tests 297ms, environment 0ms, prepare 100ms)
fix(cli): skip packages workspace checking during build if feature is disabled (#1446) by @mgramigna

This PR fixes the build handler to skip the Building Packages... and Checking workspace packages... tasks when the experimental.packagesWorkspace feature flag is disabled, preventing unnecessary work and potential failures for projects that don't use the feature.

fix(cli): Fix dry-run upgrade output saying project was upgraded (#1459) by @mvanhorn

Summary

When running yarn cedarjs upgrade --dry-run, the success message now reflects that no changes were made.

Changes

  • packages/cli/src/commands/upgrade/upgradeHandler.ts: Checks dryRun flag before constructing the message. Dry run shows "Dry run complete. Your project would be upgraded to CedarJS X." instead of "Your project has been upgraded."

Testing

  • TypeScript syntax verified
  • Only modifies the message string, no behavioral change

Fixes #498

This contribution was developed with AI assistance (Claude Code).

fix(cli): Derive debug port from server port (#1460) by @Tobbe

If you try to simultaneously run two Cedar apps the second one won't start because the 8910 and 8911 ports are already taken.
So you go and update your cedar.toml file to run your second app on 8912 and 8913.
Now everything starts up just fine 🎉

The problem though is that they both launch with --debug-port 18911. I noticed this when running ps aux | grep rw-

First app, api side running on :8911
image

Second app, api side running on :8913
image

Notice how they both have the same debug port

This PR fixes this by adding '1' to the start of whatever port the dev server i running on.

📦 Dependencies

Click to see all 14 dependency updates

🧹 Chore

Click to see all chore contributions
  • chore(docs): Clean up release_notes_major (6e9ba5a) by @Tobbe
  • chore(local-testing-project): Remove gitignored files (8532a9c) by @Tobbe
  • Version docs to 3.1 (b551cc4) by @Tobbe
  • chore(fixtures): Rename back to test-project (from kitchen-sink) (#1436) by @Tobbe
  • chore(test-project): Rename to local-testing-project (#1437) by @Tobbe
  • chore(project-config): Use mem fs for testing (#1449) by @Tobbe
  • chore(ci): Cache node_modules (#1443) by @Tobbe
  • chore: add engines field to package.json (#1445) by @gameroman

v2.8.1

25 Mar 15:27

Choose a tag to compare

Release Notes

A patch release for workspace packages to not conflict with existing user's paths/files when the feature is not enabled

Changelog

🛠️ Fixes

fix(cli): skip packages workspace checking during build if feature is disabled (#1446) by @mgramigna

This PR fixes the build handler to skip the Building Packages... and Checking workspace packages... tasks when the experimental.packagesWorkspace feature flag is disabled, preventing unnecessary work and potential failures for projects that don't use the feature.

v3.0.0

23 Mar 06:09

Choose a tag to compare

Cedar v3! 🎉

The biggest change in this release is most definitely the introduction of Prisma v7. This is a huge change for Prisma. You should definitely check out their release blog https://www.prisma.io/blog/announcing-prisma-orm-7-0-0. They also have a release video https://www.youtube.com/watch?v=AmIXJHL-sBU

Prisma v7 is faster, both for DX thanks to faster types, and for prod thanks to a faster query engine. It's also much more flexible giving you more deployment options and more package manager options (i.e. Yarn PnP).

Upgrade Guide

  1. Read the Release Notes below. Pay extra attention to the Breaking Changes section.
  2. Run yarn cedar upgrade
  3. Run yarn dlx @cedarjs/codemods prisma-v7

Release Notes

Prisma v7

Cedar now ships with Prisma v7. This is a breaking change that affects how the Prisma client is generated, where your database URL is configured, and how api/src/lib/db.ts is structured. Most of these changes can be applied automatically with the provided codemod.

Please also read through Prisma's own v7 upgrade docs and AI-focused migration guide.
One change in particular that might catch you off guard is a change in how SSL certs are handled. See
https://www.prisma.io/docs/guides/upgrade-prisma-orm/v7#ssl-certificate-validation-changes and #1494

Automatic migration (recommended)

Run the following codemod after you've upgraded to Cedar v3 to migrate your project to Prisma v7 automatically:

yarn dlx @cedarjs/codemods prisma-v7

This will:

  1. Rewrite the generator client block in api/db/schema.prisma to the new Prisma v7 format and remove the url line from datasource db
  2. Update api/prisma.config.cjs to add datasource: { url: env('DATABASE_URL') }. This is the database url used by the prisma CLI.
  3. Update api/src/lib/db.ts: Rewrites imports to the new generated client path and adds the PrismaBetterSqlite3 driver adapter (SQLite projects only)
  4. Rewrite any remaining @prisma/client imports across your project to go through src/lib/db instead
  5. Add @prisma/adapter-better-sqlite3 and better-sqlite3 to api/package.json (SQLite projects only)
  6. Add "allowImportingTsExtensions": true to api/tsconfig.json, scripts/tsconfig.json, and web/tsconfig.json
  7. Add api/db/generated/prisma to .gitignore
  8. Update DATABASE_URL in .env.defaults from file:./dev.db to file:./db/dev.db

After running the codemod:

yarn install
yarn cedar prisma generate
yarn cedar prisma migrate dev
yarn cedar lint --fix

If you use a database other than SQLite or PostgreSQL you will need to add an appropriate Prisma driver adapter to api/src/lib/db.ts yourself. See the Prisma driver adapter docs for details.

What changed and why

Database URL is no longer configured in schema.prisma

Previously, the database URL lived in schema.prisma:

datasource db {
  provider = "sqlite"
  url      = env("DATABASE_URL")
}

The datasource db url was used both for the Prisma CLI and the Prisma Client. In Prisma v7, the URL that is used by the Prisma CLI is configured in api/prisma.config.cjs, and the url used by the client is configured in code when you set up the client adapter (done in api/src/lib/db.ts for Cedar apps)

const { defineConfig, env } = require('prisma/config')

module.exports = defineConfig({
  schema: 'db/schema.prisma',
  migrations: {
    path: 'db/migrations',
    seed: 'yarn cedar exec seed',
  },
  datasource: {
    url: env('DATABASE_URL'),
  },
})

And schema.prisma now just has:

datasource db {
  provider = "sqlite"
}

See further down in the release notes for details on db.ts.

New generator client block format

The old format:

generator client {
  provider      = "prisma-client-js"
  binaryTargets = "native"
}

The new Prisma v7 format:

generator client {
  provider               = "prisma-client"
  output                 = "./generated/prisma"
  moduleFormat           = "cjs"
  generatedFileExtension = "mts"
  importFileExtension    = "mts"
}

The generated client now lives at api/db/generated/prisma/ instead of node_modules/.prisma/client/. This new directory is gitignored and regenerated on demand. binaryTargets is no longer applicable as the new driver is written in TypeScript and works on all targets.

db.ts

All databases now uses a driver adapter

SQLite details

For SQLite projects, api/src/lib/db.ts now uses the PrismaBetterSqlite3 driver adapter and imports PrismaClient from the generated client path:

See https://github.com/cedarjs/cedar/blob/v3.0.0/packages/create-cedar-app/templates/ts/api/src/lib/db.ts for what a SQLite db.ts file might look like

The resolveSqliteUrl helper in the file linked above resolves relative file:./... paths against the api/ directory. This ensures that Prisma CLI commands (which always resolves paths relative to the prisma.config.cjs file, which for Cedar apps lives in api/ by default) and the sqlite adapter both find the same SQLite file.

PostgreSQL details

The prisma-v7 codemod will try to make these changes for you, but if you need to do them manually, here's a reference implementation of db.ts

import { PrismaPg } from '@prisma/adapter-pg'
import { PrismaClient } from 'api/db/generated/prisma/client.mts'

import { emitLogLevels, handlePrismaLogging } from '@cedarjs/api/logger'

import { logger } from './logger.js'

export * from 'api/db/generated/prisma/client.mts'

const adapter = new PrismaPg({
  connectionString: process.env.DATABASE_URL,
})

const prismaClient = new PrismaClient({
  log: emitLogLevels(['info', 'warn', 'error']),
  adapter,
})

handlePrismaLogging({
  db: prismaClient,
  logger,
  logLevels: ['info', 'warn', 'error'],
})

/**
 * Global Prisma client extensions should be added here, as $extend
 * returns a new instance.
 * export const db = prismaClient.$extend(...)
 * Add any .$on hooks before using $extend
 */
export const db = prismaClient

Any code that previously imported types directly from @prisma/client (such as import type { Prisma } from '@prisma/client') should now import from src/lib/db instead. The codemod handles this automatically.

SQLite DATABASE_URL path change

If your project uses SQLite, update your DATABASE_URL from file:./dev.db to file:./db/dev.db. This keeps the SQLite database file in api/db/dev.db, which is where Cedar's Prisma v7 setup expects it to live.

In practice, this means updating the value in the env file your project uses:

DATABASE_URL=file:./db/dev.db

The codemod updates .env.defaults for you automatically, but if you have the old value set in your .env file you will need to update it manually (.env is gitignored and is not modified automatically for safety reasons).

If you leave the old value in place, Prisma CLI commands and runtime database access can end up pointing at different files, which may show up as errors like "table does not exist" even though the expected tables exist in another SQLite file.

Testing

For most projects, testing works the same as before. If you have DATABASE_URL in your prisma.config.cjs, Cedar will substitute it with TEST_DATABASE_URL during tests, exactly as before.

However, if you previously used directUrl in schema.prisma to configure a direct connection URL for testing (common with connection pooling providers like Supabase or PlanetScale), you now need to configure this in prisma.config.cjs instead. Cedar no longer parses schema.prisma to find the what was previously the "directUrl". Instead, you configure the URL explicitly in the config file.

If your project needs a separate URL, that is not the TEST_DATABASE_URL for CLI commands like prisma migrate and prisma reset during tests, the recommended approach is:

// prisma.config.cjs
module.exports = {
  // ...
  datasource: {
    url: env('NODE_ENV') === 'test'
      ? env('TEST_DIRECT_DATABASE_URL')
      : env('DIRECT_DATABASE_URL'),

Most projects that use the default url: env('DATABASE_URL') are unaffected. Cedar will continue to swap in TEST_DATABASE_URL automatically during tests.

If your schema previously had a directUrl line, the codemod will remove it from schema.prisma and print a warning reminding you to update prisma.config.cjs manually.

Breaking Changes

Babel Target Updated: Node.js 20.10 → 24

Cedar now targets Node.js 24 as the minimum version for the API side for the babel config. This allows us to remove several Babel plugins for class fields, private methods, and nullish coalescing. All those are natively supported in Node 24.

Note that Cedar already officially moved to Node 24 with the release of Cedar v2.0.0. So unless you're running on an unsupported version of Node, this change should not affect you at all.

Removed: core-js Polyfills

core-js and @babel/runtime-corejs3 have been completely removed from Cedar. The framework was only polyfilling stage 1–3 TC39 proposals, which are not recommended for production use and are not used anywhere in Cedar itself.

If you need polyfills for any feature it's now up to you to configure it yourself in your app.

Script arguments

If you have scripts that takes positional arguments that you run with yarn cedar exec you will have to change the argument indexes you use.

Let's say you run t...

Read more

v2.8.0

07 Mar 14:42

Choose a tag to compare

Release Notes

@cedarjs/utils

New package @cedarjs/utils. Right now only contains cedarPluralize. The idea is to expose previous internal code to make it easier to move functionality to user-land if users wants to extend or replace built-in Cedar features.

cedarPluralize is used to determine the plural form of Prisma models when generating new SDLs/services and when scaffolding entire CRUD flows.

validateUniqueness()

This release ships a fix for the DB type that was introduced in v2.7.0 that's used with the api side validator validateUniqueness().
If you haven't heard of this validator before, you can read more in our docs https://cedarjs.com/docs/services/#validateuniqueness

Changelog

🚀 Features

feat(utils): New package `@cedarjs/utils` (#1316) by @Tobbe

Shared utilities for CedarJS packages and Cedar apps.
Currently only a small pluralization util

feat(realtime): Export Cedar's pluralize functions (#1305) by @Tobbe

This PR moves the cedarPluralize utility (pluralize/singularize functions) from @cedarjs/cli into @cedarjs/realtime, exporting them so other packages and also Cedar apps can use the same pluralization rules as the cli does when running the generators, setup functions etc

feat(realtime): build as ESM (#1306) by @Tobbe

With node24's support for require(esm) this package doesn't need to be cjs anymore 🎉

feat(live-queries): Generate code comment explaining void startLiveQueryListener (#1304) by @Tobbe
// Fire-and-forget: we intentionally don't await this so it doesn't block the
// GraphQL handler from being registered. The listener doesn't need to be ready
// before the first request is handled.
void startLiveQueryListener()
feat(live-queries): Invalidate collection (#1315) by @Tobbe

Map DB table names to GraphQL type names
Include full collections in invalidations. So that if you're displaying a list of posts, and one of the posts is updated, the entire list of posts is also updated in the UI

🛠️ Fixes

fix(codemods): prisma v7 prep reorder tip (#1319) by @Tobbe

Make tip about fixing imports order read a little bit better

fix(cli-helpers): Add missing listr2 related deps (#1324) by @Tobbe

cli-helpers depends on @listr2/prompt-adapter-enquirer directly, but didn't include it in its list of deps, and that adapter depends on enquirer which also wasn't listed

fix(codemods): prisma v7 prep output (#1299) by @Tobbe

Old Output

Some imports might be in the wrong order. If that's the case, you can run `yarn cedar lint --fix` to reorder them.
✔ Add api/src/lib/db re-export
  → Updated /Users/tobbe/dev/aerafarms/victory/api/src/lib/db.ts
✔ Rewrite imports in api/src
✔ Rewrite imports in api/db/dataMigrations
  → Skipped (directory missing or empty)
✔ Rewrite imports in scripts

Two issues with that:

  1. The "Some imports might be in..." message should come after the task output, not at the top
  2. " → Skipped (directory missing or empty)" kind of make it sound like something's wrong

The first one is because of this issue in tasuku: privatenumber/tasuku#16
And the second issue was easy enough to fix by just rewording things a bit

New Output

❯ Prisma v7 Prep
  ✔ Add api/src/lib/db re-export
    → Updated /Users/tobbe/dev/aerafarms/victory/api/src/lib/db.ts
  ✔ Rewrite imports in api/src
  ✔ Rewrite imports in api/db/dataMigrations
    → No data migrations found
  ✔ Rewrite imports in scripts
  ✔ One more thing...
    →

    Some imports might be in the wrong order. If that's the case,
    you can run `yarn cedar lint --fix` to reorder them.

The final message (formatting) isn't ideal. I can fix that when tasuku v3 is released.

fix(upgrade-scripts): Add TLDR to 2.7 script output (#1328) by @Tobbe

The output is kind of long, so adding a highlighted TLDR to the end

fix(cli): fix live-queries setup output (order and syntax) (#1302) by @Tobbe
  • Make generated code and templates match Cedar style and formatting.
  • Update success message to make it easier to understand
fix(cli): Tweak pre-upgrade message header in upgrade command (#1327) by @Tobbe

I found it a little confusing that a "pre" message was printed "post" installation.
Updating the title to make it more clear that the message comes from the pre-upgrade scripts

fix(api): validateUniqueness db type (#1317) by @Tobbe

This PR fixes a user reported issue with the v2.7.0 release. They were getting the error below:

src/services/users/users.ts:47:9 - error TS2769: No overload matches this call.
  Overload 1 of 2, '(model: string, fields: Record<string, unknown>, optionsOrCallback: (tx: UniquenessTransactionClient) => Promise<any>, callback?: never): Promise<...>', gave the following error.
    Object literal may only specify known properties, and 'db' does not exist in type '(tx: UniquenessTransactionClient) => Promise<any>'.
  Overload 2 of 2, '(model: string, fields: Record<string, unknown>, optionsOrCallback: UniquenessValidatorOptions, callback?: (tx: UniquenessTransactionClient) => Promise<...>): Promise<...>', gave the following error.
    Type 'PrismaClient<PrismaClientOptions, LogLevel, DefaultArgs>' is not assignable to type 'UniquenessDb'.
      Types of property '$transaction' are incompatible.
        Type '{ <P extends Prisma.PrismaPromise<any>[]>(arg: [...P], options?: { isolationLevel?: TransactionIsolationLevel; }): Promise<UnwrapTuple<P>>; <R>(fn: (prisma: Omit<...>) => Promise<...>, options?: { ...; }): Promise<...>; }' is not assignable to type '<T>(callback: (tx: UniquenessTransactionClient) => Promise<T>) => Promise<T>'.
          Types of parameters 'arg' and 'callback' are incompatible.
            Type '(tx: UniquenessTransactionClient) => Promise<any>' is not assignable to type 'any[]'.

Full context: https://discord.com/channels/1375421480858423408/1375421481839755377/1478853688100651089

📦 Dependencies

Click to see all 18 dependency updates

🧹 Chore

Click to see all chore contributions
  • chore(test-project): Bump postcss to 8.5.8 (8be7baf) by @Tobbe
  • chore(test-project): Add resolution for new package `@cedarjs/utils` (88a14fd) by @Tobbe
  • Version docs to 2.8 (3a83b44) by @Tobbe
  • chore(api-server): Internal type fixes related to Yoga (#1311) by @Tobbe
  • chore(codemods): Convert from CJS to ESM (#1303) by @Tobbe

v2.7.0

03 Mar 12:28

Choose a tag to compare

Release Notes

This release brings further refinements to workspace packages, adds the initial code support for useLiveQuery – Cedar's new gql real-time hook. More to come in future releases! But most of all this release is made in preparation of upgrading to Prisma v7

Cedar v2.7.0 still uses Prisma v6, and no code changes are needed on your part if you don't want to. But this release does come with a highly recommended codemod that prepares your Cedar app for Prisma v7 in a way that lets you separate app code changes from the Prisma version bump.

With this release we're also celebrating @Neda-GL as a new contributor 🎉 Thank you for the PR!

Upgrade Instructions

yarn dlx @cedarjs/codemods prisma-v7-prep
yarn cedar upgrade

Changelog

🚀 Features

feat(prisma): Prep @cedarjs/storage for Prisma v7 (#1278) by @Tobbe

Use the client that's passed to defineExtension instead of instantiating a new PrismaClient as that won't work with Prisma v7

feat(cli): setup live-queries (#1208) by @Tobbe

Adds CLI command yarn cedar setup live-queries to configure Postgres LISTEN/NOTIFY-based live query invalidation. Creates database triggers that send notifications on table changes, and a Node.js listener that invalidates live query cache keys.

feat(prisma): Prep v6 for v7 upgrade (#1256) by @Tobbe

This PR prepares for Prisma v7 by introducing an indirection layer for all Prisma imports. Prisma v7 will change where the generated client lives (from @prisma/client to a local project path like ./generated/prisma/), which would normally require rewriting imports across every service, test, and scenario file.

This PR makes the import change now (if you want), while still on v6, to isolate major code changes from the Prisma v7 upgrade, to make it easier to debug any issues (fewer moving parts). The PR does that by making src/lib/db re-export everything from Prisma, then point all consumer code at src/lib/db instead of @prisma/client. This is done now on v6 where both paths work, so the change can be validated safely. When v7 lands, only one line in db.ts needs to change:

// v6 (this PR)
export * from '@prisma/client'
// v7 (future PR)
export * from './generated/prisma/client.js'

The PR touches four areas:

db.ts templates
Adds export * from '@prisma/client' so src/lib/db becomes a superset of @prisma/client

Generator templates & codegen
Newly generated services, tests, scenarios, and GraphQL type files now import from src/lib/db instead of @prisma/client

A jscodeshift codemod
prismaV7Prep.ts automates the migration for existing user projects

All fixture/test-project files
Updated to match the new pattern

feat(codemods): More detailed output for Prisma v7 prep codemod (#1276) by @Tobbe
❯ npx -y @cedarjs/codemods@3.0.0-canary.13477 prisma-v7-prep
✔ Prisma v7 Prep

That's all you'd get when running the codemod before this PR

feat(prisma): UniquenessDb in validations (#1271) by @Tobbe Decouple api validations from `@prisma/client`
feat(docs): Update prerequisites to include n as an option (#1273) by @Neda-GL

added 'n' installation instructions below 'nvm' section

feat(gqlorm): Prisma inspired GraphQL query builder (#1223) by @Tobbe
useLiveQuery((gqlorm) => gqlorm.user.findMany())

From Greptile's summary below:

  • Implemented a complete query builder system with three core components: QueryBuilder (proxy-based query capture), QueryParser (ORM to AST conversion), and GraphQLGenerator (AST to GraphQL string generation)
  • Added useLiveQuery React hook that integrates with @cedarjs/web to provide real-time data fetching using the @live directive
  • Created comprehensive TypeScript type definitions with module augmentation support allowing Cedar to inject its db type for full type safety
  • Integrated gqlorm into Cedar's internal type generation system to automatically augment the GqlormTypeMap interface with the framework's database client type
  • Includes test coverage for core functionality including findUnique, findMany, findFirst operations and live query configuration
feat(prisma): Decouple `@cedarjs/api` from `@prisma/client` (#1275) by @Tobbe

When migrating to Prisma v7 we should no longer import @prisma/client directly and expect it to have errors objects etc. Making this change now, while we're still on Prisma v6 so we can more easily isolate framework changes from Prisma changes

feat(upgrade-scripts): 2.7.x (#1289) by @Tobbe

Nudge users towards running the Prisma v7 prep codemod

feat(prisma): resolveGeneratedPrismaClient (#1281) by @Tobbe

This PR makes two related changes to reduce coupling to @prisma/client:

  1. Extracts Prisma client path resolution into a new resolveGeneratedPrismaClient() utility in @cedarjs/project-config. So now there's only one place I need to update this for Prisma v7
  2. Decouples PrismaAdapter (the background jobs adapter) from import type { PrismaClient } from '@prisma/client'. I tested the previous implementation against Prisma v7 and realized TS wasn't happy with it. So switched to this implementation istead.
feat(docs): Landing page rework (#1194) by @Tobbe

Codex and I have been working on a redesign for the cedarjs.com landing page

image
feat(prisma): Pass TDb to the framework instead of using `@prisma/client` (#1267) by @Tobbe

With the upcoming migration to Prisma v7 the user's DB types will no longer be available from @prisma/client. They'll be in the user's project where they're generated

🛠️ Fixes

fix(cli): broken merge in execHandler (3308c55) by @Tobbe There are breaking changes on main for `yarn cedar exec` that caused a broken merge on the release branch. This commit fixes that.
fix(gqlorm): React 18 (327adec) by @Tobbe Since the gqlorm stuff hasn't been released before it got picked over to the release branch with React 19 (which we're using on the main branch). This commit switches it over to React 18 to align with everything else in stable Cedar releases.
fix(realtime): Make JSDoc comments and implementation match (#1210) by @Tobbe

We never really defaulted to in-memory. The JSDocs were wrong.
We also didn't have a documented way to only support live queries or only subscriptions. Now we do.
And the code now also throws a helpful error message if the config is invalid

fix(cli): type-only import in realtime template (#1231) by @Tobbe
/Users/tobbe/dev/cedarjs/cedar/test-project/api/src/lib/realtime.ts
  1:1  error  All imports in the declaration are only used as types. Use `import type`  @typescript-eslint/consistent-type-imports

✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

This PR fixes the error above

fix(cli): Improve realtime setup command [DEP0040] (#1227) by @Tobbe

Dynamic import to delay the DEP0040 warning.

Before

❯ yarn cedar setup realtime
? Do you want to generate examples? › No / Yes(node:92208) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
✖ Do you want to generate examples? … No / Yes
✖ Adding required api packages...

After

❯ yarn cedar setup realtime -f
✔ Do you want to generate examples? … No / Yes
✔ Adding required api packages...
✔ Adding the realtime api lib...
✔ Enabling realtime support in the GraphQL handler...
✔ Generating types...
✔ Cleaning up...

(node:97523) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Note: You may need to manually restart GraphQL in VSCode to see the new types take effect.
fix(codemods): Run prettier on the output (#1274) by @Tobbe

Running prettier on the changed files after running the codemod. Without this step we'd end up with double quotes, semicolons etc in Cedar app code

fix(codemods): Add tests and fix for Prisma v7 Prep codemods (#1264) by @Tobbe

The codemod didn't properly support import type { ... style imports, this PR fixes that, and adds tests

fix(gql): Fix DTS bug in SDL codegen (#1259) by @Tobbe

Fixing an error that was AI-flagged in another, unrelated, PR review. I'm trusting our test suite to catch any issues with the fix. But by just looking at the code it did look weird, and the fix makes sense.

fix(codemods): prisma v7 prep TS fixes (#1263) by @Tobbe

Code review flagged a potential path.join issue that I fixed, and there were a few TS errors I also took care of

fix(codemods): Support both .cjs and .mjs prettier config (#1292) by @Tobbe

I have a production app that uses prettier.config.mjs, so when I ran a codemod I got ...

Read more

v2.6.0

10 Feb 06:42

Choose a tag to compare

Release Notes

This release is all about improvements to Cedar's realtime features. With more to come!
Plus incorporating the patch that was released as v1.1.2 a couple of days ago

Changelog

🚀 Features

feat(realtime): Rename to useCedarRealtime and CedarRealtimeOptions (#1158) by @Tobbe

Moves the implementation from RW to Cedar naming, but keeps the old exports for backwards compatibility until a future major version

This is very unlikely to happen, but I'm noting it here just to surface the risk a tiny bit more (comment from Greptile)

Symbol string changed from useRedwoodRealtime.wasLiveQueryAdded to useCedarRealtime.wasLiveQueryAdded. Since Symbol.for() returns the same symbol for the same string globally, schemas marked with the old symbol won't be recognized by the new code. If users have cached schemas or use both versions simultaneously during migration, the schema might get the live directive added twice.

feat(realtime): Add realtime to GraphQL Handler during setup (#1157) by @Tobbe

Fixes #512

feat(realtime): Remove RW shim file (#1159) by @Tobbe

This should affect noone, but if you for some reason did a deep import of useRedwoodRealtime you'll need to change it to import from just @cedarjs/realtime now, which is how we've always shown it being done

🛠️ Fixes

fix(realtime): Remove filename comment from auctions sdl template (#1156) by @Tobbe

We typically don't include this in templates shipped with the CLI. We do sometimes have it in our docs though (but I prefer using Docusaurus' title="filename.ext" feature for that)

fix(cli): Use CEDAR_CWD env var (#1179) by @Tobbe

Continuing the rebranding effort from RW to Cedar.
The old RWJS_CWD variable still works, to keep this change backwards compatible.

fix(exec): Support importing graphql handler function (#1168) by @Tobbe

Add Vite plugins to support imports like these

import directives from 'src/directives/**/*.{js,ts}'
import sdls from 'src/graphql/**/*.sdl.{js,ts}'
import services from 'src/services/**/*.{js,ts}'

in files imported and used by scripts

fix(cli): Fix passing multiple files to `yarn cedar lint` (#1163) by @Tobbe

yarn cedar lint file1 file2 used to pass "file1 file2" to eslint, which then looked for a single file literally named "file1 file2", i.e. with a space in the file name. This PR makes sure to pass all files as separate args

fix(cli): Support relative paths for CEDAR_CWD (#1178) by @Tobbe

This PR adds better support for relative paths, like CEDAR_CWD=__fixture__ or CEDAR_CWD=../../test-project. It worked before as well, in simple cases. But when the CLI invoked itself (like calling out to generate a new prisma client in a separate process) it could fail. Now it doesn't anymore

📦 Dependencies

Click to see all 15 dependency updates

🧹 Chore

Click to see all chore contributions
  • chore(ci): Strip hash from canary publish GH comment (7b94164) by @Tobbe
  • Version docs to 2.6 (acd183a) by @Tobbe
  • chore(test-project): rebuild-test-project-fixture: Build cca before running it (#1165) by @Tobbe

v1.1.2

08 Feb 11:36

Choose a tag to compare

Release Notes

Patch release for a single issue with scripts importing other files that have glob imports (like import directives from 'src/directives/**/*.{js,ts}').
(scripts, as in those you generate with yarn cedar generate script and then run with yarn cedar exec)

Changelog

🛠️ Fixes

fix(exec): Support importing graphql handler function (#1168) by @Tobbe

Add Vite plugins to support imports like these

import directives from 'src/directives/**/*.{js,ts}'
import sdls from 'src/graphql/**/*.sdl.{js,ts}'
import services from 'src/services/**/*.{js,ts}'

in files imported and used by scripts

v2.5.1

05 Feb 19:30

Choose a tag to compare

Release Notes

A patch release to get a few security fixes in third-party packages released. Plus a PR from @Bigood! Thank you so much 🙏

Changelog

🛠️ Fixes

fix(docs): Fix link to cedar.toml section (3bbdac8) by @Tobbe

Using file paths with .md extensions for links to work with versioned docs

fix(api-server): Do not watch changes inside packages' src (#1148) by @Tobbe

We had a glob syntax path that wasn't working. I simplified that specific piece of code to not rely on globs

fix(paths): Add missing types for 'subscriptions' and 'packages' paths (#1146) by @Tobbe

We provided both api.subscriptions and packages from getPaths() in @cedarjs/project-config, but they were not part of the exported types

chore(deps): update dependency @sentry/* to v10 and @envelop/sentry t… (#1048) by @Bigood I started having some bugs with the current Prisma version (issue on sentry-javascript repo)
TypeError: request.headers.split is not a function
    at setHeadersOnRequest (…/node_modules/@sentry/node/cjs/integrations/undici/index.js:247:39)
    at _onRequestCreate (…/node_modules/@sentry/node/cjs/integrations/undici/index.js:151:9)
    …

I upgraded beyond v7, and it went fluently, in dev and production. Let me know if there's something more to do before merging !

📚 Docs

docs(README): Replace Redwood with Cedar (#1149) by @Tobbe

As we bring more, new, people to Cedar it's confusing if the READMEs say Redwood.

docs(README): Remove package leads (#1147) by @Tobbe

There is only one maintainer for this project, so it's kind of obvious who to reach out to

📦 Dependencies

Click to see all 15 dependency updates

🧹 Chore

Click to see all chore contributions
  • chore(internal): api.ts rw -> cedar (42af5fc) by @Tobbe
  • chore(ci): publish_canary: npm whoami (8549504) by @Tobbe
  • chore(ci): publish_canary: npm validate token expiry (4816e30) by @Tobbe
  • chore(ci): detect-changes changeset bypass fix (#1141) by @Tobbe
  • chore(ci): get-ci-stats max job duration (#1139) by @Tobbe
  • chore(ci): Make publish-rc script MTS, and configure eslint (#1154) by @Tobbe
  • chore(docs): Correct eslint config for ignore_build.mjs (#1131) by @Tobbe