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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prisma-cli",
"version": "8.0.0-rc.19",
"version": "8.0.0-rc.20",
"private": true,
"engines": {
"node": ">=24"
Expand Down
4 changes: 2 additions & 2 deletions packages/cli-conformance/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@repo/cli-conformance",
"private": true,
"version": "8.0.0-rc.19",
"version": "8.0.0-rc.20",
"description": "Reusable conformance checks for the engine's consumers: import purity over built output, config-section validators that never throw, and verification of the tarballs a registry would receive. Depends on no package it checks.",
"type": "module",
"exports": {
Expand All @@ -24,7 +24,7 @@
"test": "pnpm run typecheck && vitest run"
},
"devDependencies": {
"@repo/tsconfig": "workspace:8.0.0-rc.19",
"@repo/tsconfig": "workspace:8.0.0-rc.20",
"@types/node": "^22.19.19",
"es-module-lexer": "^2.1.0",
"tsx": "^4.22.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
},
"devDependencies": {
"@prisma/management-api-sdk": "1.80.0",
"@repo/cli-conformance": "workspace:8.0.0-rc.19",
"@repo/tsconfig": "workspace:8.0.0-rc.19",
"@repo/cli-conformance": "workspace:8.0.0-rc.20",
"@repo/tsconfig": "workspace:8.0.0-rc.20",
"@types/node": "^22.19.19",
"ci-info": "^4.3.1",
"tsdown": "^0.21.10",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli-telemetry/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@repo/cli-telemetry",
"private": true,
"version": "8.0.0-rc.19",
"version": "8.0.0-rc.20",
"description": "CLI telemetry child sender: the detached subprocess the engine hands a composed payload to, its system probes, and the POST",
"type": "module",
"sideEffects": [
Expand Down Expand Up @@ -35,7 +35,7 @@
"@vercel/detect-agent": "^1.2.3"
},
"devDependencies": {
"@repo/tsconfig": "workspace:8.0.0-rc.19",
"@repo/tsconfig": "workspace:8.0.0-rc.20",
"@types/node": "^22.19.19",
"tsdown": "^0.21.10",
"typescript": "^6.0.3",
Expand Down
12 changes: 6 additions & 6 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@prisma/cli",
"version": "8.0.0-rc.19",
"version": "8.0.0-rc.20",
"description": "Command-line interface for the Prisma Developer Platform.",
"type": "module",
"bin": {
Expand Down Expand Up @@ -50,7 +50,7 @@
"dependencies": {
"@manypkg/tools": "^2.1.2",
"@prisma/cli-engine": "workspace:0.6.2",
"@prisma/composer-cli": "0.25.0",
"@prisma/composer-cli": "0.26.0",
"@prisma/compute-sdk": "0.43.0",
"@prisma/management-api-sdk": "1.80.0",
"@prisma/orm-toolchain": "8.0.0-rc.14",
Expand All @@ -62,11 +62,11 @@
"open": "^11.0.0"
},
"devDependencies": {
"@prisma/composer": "0.25.0",
"@prisma/composer": "0.26.0",
"@prisma/credentials-store": "^7.8.0",
"@repo/cli-conformance": "workspace:8.0.0-rc.19",
"@repo/cli-telemetry": "workspace:8.0.0-rc.19",
"@repo/tsconfig": "workspace:8.0.0-rc.19",
"@repo/cli-conformance": "workspace:8.0.0-rc.20",
"@repo/cli-telemetry": "workspace:8.0.0-rc.20",
"@repo/tsconfig": "workspace:8.0.0-rc.20",
"@types/node": "^22.19.19",
"@types/cross-spawn": "^6.0.6",
"tsdown": "^0.21.10",
Expand Down
8 changes: 0 additions & 8 deletions packages/cli/scripts/conformance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,6 @@ async function tarball(): Promise<readonly Finding[]> {
enginePackage: "@prisma/cli-engine",
familyPackages: ["@prisma/composer-cli", "@prisma/orm-toolchain"],
exceptions: [
{
familyPackage: "@prisma/composer-cli",
familyPin: "0.6.1",
shellPin: "0.6.2",
reason: "engine 0.6.2 must publish before composer-cli can peer it",
removeWhen:
"composer-cli releases peering 0.6.2 and the follow-up bump PR pins that release",
},
{
familyPackage: "@prisma/orm-toolchain",
familyPin: "0.6.1",
Expand Down
126 changes: 65 additions & 61 deletions packages/cli/tests/bin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,20 @@ const MISSING_PRISMA_CONFIG_PATH = join(
"missing-prisma.config.ts",
);

/** A prisma.config.ts whose only section is composer's. */
const COMPOSER_SECTION_CONFIG_PATH = join(
/** A composer section that still carries the retired `configPath`. */
const COMPOSER_CONFIG_PATH_CONFIG_PATH = join(
dirname(fileURLToPath(import.meta.url)),
"fixtures",
"config",
"composer-section.config.ts",
"composer-config-path.config.ts",
);

/** A composer section built with `@prisma/composer/config`. */
const COMPOSER_VALID_CONFIG_PATH = join(
dirname(fileURLToPath(import.meta.url)),
"fixtures",
"config",
"composer-valid.config.ts",
);

const SEMVER_PREFIX = /^\d+\.\d+\.\d+/;
Expand Down Expand Up @@ -492,7 +500,10 @@ describe("buildCli", () => {
* stdout is not a TTY here, so the stream is JSON, and JSON escapes
* every separator in a Windows path — no path the CLI printed is a
* substring of the stream that carried it. */
function resultError(stdoutText: string): Diagnostic {
function resultFailure(stdoutText: string): {
readonly error: Diagnostic;
readonly diagnostics: readonly Diagnostic[];
} {
const frames = stdoutText
.split("\n")
.filter((line) => line !== "")
Expand All @@ -501,81 +512,74 @@ describe("buildCli", () => {
if (last?.kind !== "result" || last.envelope.ok) {
throw new Error(`expected a failed result frame, got: ${stdoutText}`);
}
return last.envelope.error;
return {
error: last.envelope.error,
diagnostics: last.envelope.diagnostics,
};
}

/** Composer's `dev` through the real bin, against the fixture whose
* composer section names a config file that is not there. */
async function runComposerDev(): Promise<{
/** Composer's `dev` through the real bin, reading the given config. */
async function runComposerDev(configPath: string): Promise<{
readonly exitCode: number;
readonly error: Diagnostic;
readonly diagnostics: readonly Diagnostic[];
}> {
const proc = makeProcess({
argv: [
"node",
"bin.js",
"dev",
"--config",
COMPOSER_SECTION_CONFIG_PATH,
"src/service.ts",
],
argv: ["node", "bin.js", "dev", "--config", configPath, "src/service.ts"],
});

const exitCode = await main(proc);
return { exitCode, error: resultError(proc.stdoutText) };
return { exitCode, ...resultFailure(proc.stdoutText) };
}

/**
* The mount's config wiring, end to end: the section name composer's
* family declares, read by the bin's real disk loader, reaching
* composer's own handler as the path it acts on.
*
* Every platform but Windows. `dev` is the only composer command
* that reaches config discovery without credentials — `deploy` stops
* at the credential check — and it refuses Windows before it reads
* the section it was handed, so no shipped command can show the
* section arriving there. The test after this one pins what Windows
* can still show.
* family declares, read by the bin's real disk loader and checked by
* composer's own validator before any handler runs, so every
* platform sees the same refusal.
*/
it.skipIf(process.platform === "win32")(
"hands the composer section of prisma.config.ts to the composer family",
async () => {
const { exitCode, error } = await runComposerDev();

expect(exitCode).toBe(2);
expect(error.code).toBe("CONFIG.FILE_MISSING");
// Composer resolves the section's relative path against the
// prisma.config.ts that declared it, not against the cwd.
expect(error.where?.path).toBe(
join(
dirname(COMPOSER_SECTION_CONFIG_PATH),
"named-by-the-section.config.ts",
),
);
expect(error.why).toContain("there is no walk to fall back on");
},
);
it("refuses a composer section that still names a config file", async () => {
const { exitCode, error, diagnostics } = await runComposerDev(
COMPOSER_CONFIG_PATH_CONFIG_PATH,
);

expect(exitCode).toBe(2);
expect(error).toMatchObject({
code: "CLI.CONFIG_SECTION_INVALID",
summary: `The 'composer' section of ${COMPOSER_CONFIG_PATH_CONFIG_PATH} is invalid.`,
});
expect(diagnostics).toEqual([
expect.objectContaining({
code: "CONFIG.FIELD_RETIRED",
severity: "error",
meta: { field: "configPath" },
where: { path: COMPOSER_CONFIG_PATH_CONFIG_PATH },
}),
]);
});

/**
* What Windows still shows: the bin evaluated the config file, the
* engine accepted its `composer` section, and the command reached
* composer's own operation — which then refuses the platform. A
* mis-wired section would fail here as a config diagnostic instead.
* What it does not show is the section's path reaching composer's
* config discovery, since the refusal comes first.
*
* When composer supports Windows this test fails, and the pair
* collapses back into the one above.
* `dev --help` never evaluates the config, so a valid section shows
* only on a run that validates it: composer's validator accepts the
* section and the handler runs. Its first step imports the entry the
* host passed, which does not exist; on Windows the handler refuses
* the platform before that.
*/
it.runIf(process.platform === "win32")(
"on Windows, composer's dev refuses the platform before it reads the section",
async () => {
const { exitCode, error } = await runComposerDev();
it("hands a valid composer section to composer's dev", async () => {
const { exitCode, error } = await runComposerDev(
COMPOSER_VALID_CONFIG_PATH,
);

expect(exitCode).toBe(2);
expect(error.code).toBe("DEV.PLATFORM_UNSUPPORTED");
},
);
expect(exitCode).toBe(2);
expect(error).toMatchObject(
process.platform === "win32"
? { code: "DEV.PLATFORM_UNSUPPORTED" }
: {
code: "COMPOSE.ENTRY_UNLOADABLE",
summary: expect.stringContaining(join("src", "service.ts")),
},
);
});

it("runs --version through the real tree, printing the version with exit 0", async () => {
const proc = makeProcess({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { definePrismaConfig } from "@prisma/cli-engine";
// appearing in one of this repository's directories above these
// fixtures can never join a test's chain.
export default definePrismaConfig({
composer: { configPath: "./named-by-the-section.config.ts" },
composer: { configPath: "./prisma-composer.config.ts" },
parent: false,
});
18 changes: 18 additions & 0 deletions packages/cli/tests/fixtures/config/composer-valid.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { definePrismaConfig } from "@prisma/cli-engine";
import { defineConfig as composer } from "@prisma/composer/config";
import { nodeBuild } from "@prisma/composer/node/control";

const build = nodeBuild();

export default definePrismaConfig({
composer: composer({
extensions: [build],
state: {
extension: build.id,
create: () => {
throw new Error("no command in these tests reaches the state store");
},
},
}),
parent: false,
});
2 changes: 1 addition & 1 deletion packages/compute/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"test": "vitest run"
},
"devDependencies": {
"@repo/tsconfig": "workspace:8.0.0-rc.19",
"@repo/tsconfig": "workspace:8.0.0-rc.20",
"@types/node": "^22.19.19",
"tsdown": "^0.21.10",
"typescript": "^6.0.3",
Expand Down
10 changes: 5 additions & 5 deletions packages/prisma/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prisma",
"version": "8.0.0-rc.19",
"version": "8.0.0-rc.20",
"description": "The Prisma CLI: one binary for the ORM, Composer, and the Prisma Developer Platform.",
"type": "module",
"bin": {
Expand Down Expand Up @@ -51,7 +51,7 @@
"dependencies": {
"@manypkg/tools": "^2.1.2",
"@prisma/cli-engine": "workspace:0.6.2",
"@prisma/composer-cli": "0.25.0",
"@prisma/composer-cli": "0.26.0",
"@prisma/compute-sdk": "0.43.0",
"@prisma/management-api-sdk": "1.80.0",
"@prisma/orm-toolchain": "8.0.0-rc.14",
Expand All @@ -63,10 +63,10 @@
"open": "^11.0.0"
},
"devDependencies": {
"@prisma/cli": "workspace:8.0.0-rc.19",
"@prisma/cli": "workspace:8.0.0-rc.20",
"@prisma/credentials-store": "^7.8.0",
"@repo/cli-telemetry": "workspace:8.0.0-rc.19",
"@repo/tsconfig": "workspace:8.0.0-rc.19",
"@repo/cli-telemetry": "workspace:8.0.0-rc.20",
"@repo/tsconfig": "workspace:8.0.0-rc.20",
"@types/node": "^22.19.19",
"tsdown": "^0.21.10",
"typescript": "^6.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/tsconfig/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@repo/tsconfig",
"private": true,
"version": "8.0.0-rc.19",
"version": "8.0.0-rc.20",
"description": "Base tsconfig providing package for the monorepo",
"license": "Apache-2.0",
"files": [
Expand Down
Loading
Loading