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
17 changes: 12 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "22.18.0"
node-version: "22.22.0"

- name: Setup Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22.18.0"
node-version: "22.22.0"
registry-url: "https://registry.npmjs.org"

- name: Compute preview metadata
Expand All @@ -106,7 +106,7 @@ jobs:

- name: Ensure npm version for trusted publishing
run: |
npm install -g npm@11.5.1
npm install -g npm@11.6.0
echo "Node: $(node --version)"
echo "npm: $(npm --version)"

Expand Down Expand Up @@ -148,6 +148,9 @@ jobs:
CREATE_PRISMA_TELEMETRY_API_KEY: ${{ steps.preview.outputs.publish_next == 'true' && secrets.CREATE_PRISMA_TELEMETRY_API_KEY || '' }}
CREATE_PRISMA_TELEMETRY_HOST: ${{ steps.preview.outputs.publish_next == 'true' && vars.CREATE_PRISMA_TELEMETRY_HOST || '' }}

- name: Test packed CLI on the minimum Node version
run: node scripts/smoke-node.mjs

- name: Publish to npm
run: npm publish --access public --tag "${{ steps.preview.outputs.dist_tag }}"

Expand Down Expand Up @@ -248,7 +251,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22.18.0"
node-version: "22.22.0"
registry-url: "https://registry.npmjs.org"

- name: Extract version from commit message
Expand Down Expand Up @@ -288,7 +291,7 @@ jobs:
- name: Ensure npm version for trusted publishing
if: steps.check-version.outputs.exists == 'false'
run: |
npm install -g npm@11.5.1
npm install -g npm@11.6.0
echo "Node: $(node --version)"
echo "npm: $(npm --version)"

Expand Down Expand Up @@ -322,6 +325,10 @@ jobs:
if: steps.check-version.outputs.exists == 'false'
run: bun run build

- name: Test packed CLI on the minimum Node version
if: steps.check-version.outputs.exists == 'false'
run: node scripts/smoke-node.mjs

- name: Publish to npm
if: steps.check-version.outputs.exists == 'false'
run: npm publish --access public
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Deploy to Prisma now?

Choose no to deploy later with the generated `deploy` script.

New apps explicitly use `us-east-1` in `prisma-composer.config.ts`. Change the
New apps explicitly use `us-east-1` in the Composer section of `prisma.config.ts`. Change the
`prismaCloud({ region })` option before deploying if you need another region.
Composer requires a region when creating a new project; leaving it unspecified
only works when deploying into an existing project whose region can be inherited.
Expand Down
66 changes: 66 additions & 0 deletions scripts/smoke-node.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { execa } from "execa";
import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";

const directory = await mkdtemp(path.join(tmpdir(), "create-prisma-node-smoke-"));
const env = {
DO_NOT_TRACK: "1",
CREATE_PRISMA_DISABLE_TELEMETRY: "1",
PRISMA_NEXT_DISABLE_TELEMETRY: "1",
NO_UPDATE_NOTIFIER: "1",
npm_config_engine_strict: "true",
};

try {
const packed = await execa("npm", [
"pack",
"--ignore-scripts",
"--pack-destination",
directory,
"--json",
]);
const [{ filename }] = JSON.parse(packed.stdout);
await execa(
"npm",
[
"install",
"--prefix",
directory,
path.join(directory, filename),
"--ignore-scripts",
"--no-audit",
"--no-fund",
],
{ env, stdout: "inherit", stderr: "inherit" },
);
const created = await execa(
process.execPath,
[
path.join(directory, "node_modules/create-prisma/dist/cli.mjs"),
"app",
"--template",
"minimal",
"--provider",
"postgres",
"--authoring",
"psl",
"--package-manager",
"npm",
"--skills",
"none",
"--no-deploy",
"--json",
],
{ cwd: directory, env },
);
if (!JSON.parse(created.stdout).ok) throw new Error("Packed CLI did not scaffold successfully");
const options = { cwd: path.join(directory, "app"), env, stdout: "inherit", stderr: "inherit" };
await execa("npm", ["run", "build"], options);
await execa("npm", ["exec", "--", "tsc", "--noEmit"], options);
console.log(
`Packed CLI, dependency engines, scaffold, build and typecheck passed on Node ${process.versions.node}.`,
);
} finally {
await rm(directory, { recursive: true, force: true });
}
43 changes: 21 additions & 22 deletions src/constants/dependencies.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
import type { CreateTemplate, PackageManager } from "../types";

export const dependencyVersionMap = {
"@astrojs/node": "^10.0.2",
"@elysiajs/node": "^1.4.5",
"@prisma/composer": "0.25.0",
"@prisma/composer-prisma-cloud": "0.25.0",
"@astrojs/node": "^11.1.7",
"@elysia/node": "^1.4.6",
"@prisma/composer": "0.28.0",
"@prisma/composer-prisma-cloud": "0.28.0",
"@prisma/dev": "0.25.2",
"@prisma/orm-mongo": "8.0.0-rc.13",
"@prisma/orm-mongo": "8.0.0-rc.16",
// Must match @prisma/composer-prisma-cloud's exact peerDependency, even when
// prisma bundles a newer @prisma/orm-toolchain, or npm install fails with
// ERESOLVE.
"@prisma/orm-postgres": "8.0.0-rc.13",
"@sveltejs/adapter-node": "^5.3.2",
"@types/node": "^25.6.2",
"@prisma/orm-postgres": "8.0.0-rc.16",
"@sveltejs/adapter-node": "^6.0.0",
"@types/node": "^26.6.4",
alchemy: "2.0.0-beta.78",
arktype: "^2.2.3",
dotenv: "^17.4.2",
arktype: "^2.2.7",
dotenv: "^18.0.6",
effect: "4.0.0-rc.115",
mongodb: "^7.1.0",
"mongodb-memory-server": "^11.1.0",
nitro: "^3.0.260610-beta",
mongodb: "^7.7.0",
"mongodb-memory-server": "^11.3.0",
nitro: "^3.0.260903-beta",
// Must match the @prisma/composer-cli version this prisma release depends on.
// `bun run check:pins` verifies that against the Composer pins above.
prisma: "8.0.0-rc.19",
// The ORM runtime's timestamp columns need a global Temporal, which no
// stable Node or Bun ships yet.
"temporal-polyfill": "^1.0.4",
tsdown: "^0.22.14",
turbo: "2.10.12",
tsx: "^4.21.0",
typescript: "^5.9.3",
prisma: "8.0.0-rc.21",
// Node 22 needs a global Temporal for the ORM runtime's timestamp columns.
"temporal-polyfill": "^1.0.5",
tsdown: "^0.23.0",
turbo: "2.11.7",
tsx: "^4.23.15",
typescript: "^6.0.3",
} as const;

// Pinned to the effect version as a set: @effect/* siblings depend on each other with
Expand Down Expand Up @@ -84,7 +83,7 @@ export function getCreateTemplateDependencies(
devDependencies.push("typescript");
}
if (template === "elysia") {
dependencies.push("@elysiajs/node");
dependencies.push("@elysia/node");
devDependencies.push("@types/node");
}
if (template === "svelte") {
Expand Down
12 changes: 6 additions & 6 deletions src/utils/package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ type RuntimeScriptOptions = {
const DENO_ALLOW_FRESH_DEPENDENCIES = "--minimum-dependency-age=0";

const packageManagerManifestValues = {
npm: "npm@11.6.0",
pnpm: "pnpm@11.21.0",
yarn: "yarn@4.13.0",
bun: "bun@1.4.1",
npm: "npm@12.2.0",
pnpm: "pnpm@11.28.5",
yarn: "yarn@4.18.1",
bun: "bun@1.4.2",
} as const;

type PackageManagerVersion = readonly [major: number, minor: number, patch: number];
Expand Down Expand Up @@ -62,8 +62,8 @@ const packageManagerChecks: Record<
versionArgs: ["--version"],
install: "Install it with Corepack (https://yarnpkg.com/corepack)",
minimum: {
version: [2, 0, 0],
guidance: `Generated projects use ${packageManagerManifestValues.yarn}, which Yarn 1 refuses to install. Enable Corepack (https://yarnpkg.com/corepack) or install Yarn 4, then retry create-prisma, or choose another package manager with --package-manager.`,
version: [4, 10, 0],
guidance: `Generated projects use ${packageManagerManifestValues.yarn} and its release-age allowlist for Prisma packages. Enable Corepack (https://yarnpkg.com/corepack) or update Yarn, then retry create-prisma, or choose another package manager with --package-manager.`,
},
},
bun: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{{#if (eq packageManager "yarn")}}
nodeLinker: node-modules
npmPreapprovedPackages:
- "prisma"
- "@prisma/*"
{{/if}}
4 changes: 2 additions & 2 deletions templates/create/_shared/README.md.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ After changing the contract, run:
{{runScriptCommand packageManager "contract:emit"}}
```

To run the workspace's development tasks directly, use `{{runScriptCommand packageManager "dev"}}`. This direct mode requires `{{#if (eq provider "postgres")}}DATABASE_URL{{else}}MONGODB_URL{{/if}}`.
To run the workspace's development tasks directly, use `{{runScriptCommand packageManager "dev"}}`. This direct mode requires `DATABASE_URL`.
{{else}}
A minimal {{template}} app with Prisma 8 and Prisma Composer.

Expand All @@ -84,7 +84,7 @@ A minimal {{template}} app with Prisma 8 and Prisma Composer.
{{runScriptCommand packageManager "dev:composer"}}
```

This builds the app and starts it with Composer. PostgreSQL projects get a local Prisma Postgres database and apply the contract automatically.
This builds the app and starts it with Composer. PostgreSQL projects get a local Prisma Postgres database and apply the committed migrations automatically.

## Deploy

Expand Down
13 changes: 0 additions & 13 deletions templates/create/_shared/prisma-composer.config.ts.hbs

This file was deleted.

17 changes: 12 additions & 5 deletions templates/create/_shared/prisma.config.ts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ export default definePrismaConfig({
output: "./{{#if (eq template "turborepo")}}packages/database/src{{else}}src/prisma{{/if}}/generated",
{{/if}}
db: {
connection: process.env.{{#if (eq provider "postgres")}}DATABASE_URL{{else}}MONGODB_URL{{/if}}!,
connection: process.env.DATABASE_URL!,
},
}),
});
{{else}}
import { definePrismaConfig } from "prisma/config";
import { defineConfig as ormConfig } from "@prisma/orm-{{#if (eq provider "postgres")}}postgres{{else}}mongo{{/if}}/config";
import { defineConfig as composer } from "@prisma/composer/config";
import { nodeBuild } from "@prisma/composer/node/control";
{{#if (eq template "next")}}
import { nextjsBuild } from "@prisma/composer/nextjs/control";
{{/if}}
import { prismaCloud, prismaState } from "@prisma/composer-prisma-cloud/control";

export default definePrismaConfig({
skills: {
Expand All @@ -28,11 +34,12 @@ export default definePrismaConfig({
output: "./{{#if (eq template "turborepo")}}packages/database/src{{else}}src/prisma{{/if}}/generated",
{{/if}}
db: {
connection: process.env.{{#if (eq provider "postgres")}}DATABASE_URL{{else}}MONGODB_URL{{/if}}!,
connection: process.env.DATABASE_URL!,
},
}),
composer: {
configPath: "./prisma-composer.config.ts",
},
composer: composer({
extensions: [prismaCloud({ region: "us-east-1" }), nodeBuild(){{#if (eq template "next")}}, nextjsBuild(){{/if}}],
state: prismaState(),
}),
});
{{/if}}
3 changes: 0 additions & 3 deletions templates/create/astro/.yarnrc.yml.hbs

This file was deleted.

10 changes: 5 additions & 5 deletions templates/create/astro/package.json.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"astro": "astro"
},
"dependencies": {
"astro": "^6.3.3"
"astro": "^7.3.6"
},
"devDependencies": {
"@types/node": "^24.3.0",
"tsx": "^4.7.1",
"typescript": "^5.9.3",
"vite": "^8.1.2"
"@types/node": "^26.6.4",
"tsx": "^4.23.15",
"typescript": "^6.0.3",
"vite": "^8.3.3"
}
}
3 changes: 0 additions & 3 deletions templates/create/elysia/.yarnrc.yml.hbs

This file was deleted.

8 changes: 4 additions & 4 deletions templates/create/elysia/package.json.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
{{/if}}
"type": "module",
"engines": {
"node": "^22.18.0 || >=24.11.0"
"node": "^22.18.0 || ^24.11.0 || >=26.0.0"
},
"scripts": {
"dev": "tsx watch src/index.ts",
"build": "tsdown",
"start": "node dist/server.mjs"
},
"dependencies": {
"@sinclair/typebox": "^0.34.48",
"elysia": "^1.4.28",
"@sinclair/typebox": "^0.34.52",
"elysia": "^1.4.30",
"openapi-types": "^12.1.3"
},
"devDependencies": {
"typescript": "^5.9.3"
"typescript": "^6.0.3"
}
}
2 changes: 1 addition & 1 deletion templates/create/elysia/src/index.ts.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { node } from "@elysiajs/node";
import { node } from "@elysia/node";
import { Elysia } from "elysia";

import { listUsers } from "./prisma/users";
Expand Down
3 changes: 0 additions & 3 deletions templates/create/hono/.yarnrc.yml.hbs

This file was deleted.

10 changes: 5 additions & 5 deletions templates/create/hono/package.json.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
{{/if}}
"type": "module",
"engines": {
"node": "^22.18.0 || >=24.11.0"
"node": "^22.18.0 || ^24.11.0 || >=26.0.0"
},
"scripts": {
"dev": "{{runtimeScript packageManager "dev" "src/index.ts" "dist/src/index.js"}}",
"build": "tsdown",
"start": "node dist/server.mjs"
},
"dependencies": {
"@hono/node-server": "^1.19.9",
"hono": "^4.12.2"
"@hono/node-server": "^2.1.3",
"hono": "^4.13.13"
},
"devDependencies": {
"@types/node": "^20.11.17",
"typescript": "^5.9.3"
"@types/node": "^26.6.4",
"typescript": "^6.0.3"
}
}
Loading
Loading