@prisma-next/cli 0.10.0-dev.22 → 0.10.0-dev.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma-next/cli",
3
- "version": "0.10.0-dev.22",
3
+ "version": "0.10.0-dev.23",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -14,15 +14,15 @@
14
14
  "dependencies": {
15
15
  "@clack/prompts": "^1.3.0",
16
16
  "@dagrejs/dagre": "^3.0.0",
17
- "@prisma-next/config": "0.10.0-dev.22",
18
- "@prisma-next/contract": "0.10.0-dev.22",
19
- "@prisma-next/emitter": "0.10.0-dev.22",
20
- "@prisma-next/errors": "0.10.0-dev.22",
21
- "@prisma-next/framework-components": "0.10.0-dev.22",
22
- "@prisma-next/migration-tools": "0.10.0-dev.22",
23
- "@prisma-next/psl-printer": "0.10.0-dev.22",
24
- "@prisma-next/cli-telemetry": "0.10.0-dev.22",
25
- "@prisma-next/utils": "0.10.0-dev.22",
17
+ "@prisma-next/config": "0.10.0-dev.23",
18
+ "@prisma-next/contract": "0.10.0-dev.23",
19
+ "@prisma-next/emitter": "0.10.0-dev.23",
20
+ "@prisma-next/errors": "0.10.0-dev.23",
21
+ "@prisma-next/framework-components": "0.10.0-dev.23",
22
+ "@prisma-next/migration-tools": "0.10.0-dev.23",
23
+ "@prisma-next/psl-printer": "0.10.0-dev.23",
24
+ "@prisma-next/cli-telemetry": "0.10.0-dev.23",
25
+ "@prisma-next/utils": "0.10.0-dev.23",
26
26
  "arktype": "^2.2.0",
27
27
  "c12": "^3.3.4",
28
28
  "ci-info": "^4.3.1",
@@ -39,14 +39,14 @@
39
39
  "wrap-ansi": "^10.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@prisma-next/sql-contract": "0.10.0-dev.22",
43
- "@prisma-next/sql-contract-emitter": "0.10.0-dev.22",
44
- "@prisma-next/sql-contract-ts": "0.10.0-dev.22",
45
- "@prisma-next/sql-operations": "0.10.0-dev.22",
46
- "@prisma-next/sql-runtime": "0.10.0-dev.22",
47
- "@prisma-next/test-utils": "0.10.0-dev.22",
48
- "@prisma-next/tsconfig": "0.10.0-dev.22",
49
- "@prisma-next/tsdown": "0.10.0-dev.22",
42
+ "@prisma-next/sql-contract": "0.10.0-dev.23",
43
+ "@prisma-next/sql-contract-emitter": "0.10.0-dev.23",
44
+ "@prisma-next/sql-contract-ts": "0.10.0-dev.23",
45
+ "@prisma-next/sql-operations": "0.10.0-dev.23",
46
+ "@prisma-next/sql-runtime": "0.10.0-dev.23",
47
+ "@prisma-next/test-utils": "0.10.0-dev.23",
48
+ "@prisma-next/tsconfig": "0.10.0-dev.23",
49
+ "@prisma-next/tsdown": "0.10.0-dev.23",
50
50
  "@types/node": "24.10.4",
51
51
  "tsdown": "0.22.0",
52
52
  "typescript": "5.9.3",
@@ -56,6 +56,21 @@ export function formatRunCommand(pm: PackageManager, bin: string, args: string):
56
56
  return `${pm} ${bin} ${args}`;
57
57
  }
58
58
 
59
+ export function formatRunScriptCommand(pm: PackageManager, scriptName: string): string {
60
+ switch (pm) {
61
+ case 'deno':
62
+ return `deno task ${scriptName}`;
63
+ case 'bun':
64
+ return `bun run ${scriptName}`;
65
+ case 'pnpm':
66
+ return `pnpm run ${scriptName}`;
67
+ case 'yarn':
68
+ return `yarn run ${scriptName}`;
69
+ default:
70
+ return `npm run ${scriptName}`;
71
+ }
72
+ }
73
+
59
74
  export function formatAddArgs(pm: PackageManager, packages: string[]): string[] {
60
75
  if (pm === 'deno') {
61
76
  return ['add', ...packages.map((p) => `npm:${p}`)];
@@ -59,6 +59,7 @@ import {
59
59
  import { configFile, dbFile, starterSchema, targetPackageName } from './templates/code-templates';
60
60
  import { envExampleContent, envFileContent, MIN_SERVER_VERSION } from './templates/env';
61
61
  import { quickReferenceMd } from './templates/quick-reference';
62
+ import { minimalProjectReadmeMd } from './templates/readme';
62
63
  import { defaultTsConfig, mergeTsConfig, TsConfigParseError } from './templates/tsconfig';
63
64
 
64
65
  interface FileEntry {
@@ -349,6 +350,26 @@ export async function runInit(
349
350
  }
350
351
  }
351
352
 
353
+ if (existsSync(join(baseDir, 'src/index.ts'))) {
354
+ if (!existsSync(join(baseDir, 'README.md'))) {
355
+ const rawName =
356
+ parsedPackageJson !== null && typeof parsedPackageJson['name'] === 'string'
357
+ ? parsedPackageJson['name']
358
+ : basename(baseDir);
359
+ filesToWrite.push({
360
+ path: 'README.md',
361
+ content: minimalProjectReadmeMd(
362
+ inputs.target,
363
+ inputs.schemaPath,
364
+ sanitisePackageName(rawName),
365
+ pm,
366
+ ),
367
+ });
368
+ } else {
369
+ warnings.push('README.md already exists; leaving it untouched.');
370
+ }
371
+ }
372
+
352
373
  // -----------------------------------------------------------------
353
374
  // Write phase — every input has been parsed and every merged file is
354
375
  // staged. From here on, failures are only possible at the
@@ -0,0 +1,35 @@
1
+ # {{projectName}}
2
+
3
+ Generated by `prisma-next init` with the Minimal template.
4
+
5
+ ## First run
6
+
7
+ 1. `{{runDbUp}}` — start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
8
+ 2. `{{runDev}}` — runs `src/index.ts`, which writes one row and reads it back.
9
+
10
+ ## Available scripts
11
+
12
+ - `{{runDev}}` — run the Prisma Next sample script
13
+
14
+ ### Database and migrations
15
+
16
+ - `{{runContractEmit}}` — emit contract artifacts after contract changes
17
+ - `{{runDbUp}}` — start the local MongoDB replica set with `mongodb-memory-server`. Data persists in `.mongo-data/` across restarts.
18
+ - `{{runDbDown}}` — stop the local MongoDB process (data preserved)
19
+ - `{{runDbReset}}` — stop and wipe `.mongo-data/` for a clean slate
20
+ - `{{runMigrationPlan}}` — create a MongoDB migration plan
21
+ - `{{runMigrate}}` — apply the planned MongoDB migration
22
+ - `{{runDbSeed}}` — insert sample users manually
23
+
24
+ ## Prisma Next
25
+
26
+ Prisma Next setup is scaffolded in:
27
+
28
+ - `{{contractPath}}`
29
+ - `prisma-next.config.ts`
30
+ - `prisma/db.ts`
31
+ - `src/lib/prisma.ts`
32
+
33
+ For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma Next skills live in the upstream `skills/` directory: https://github.com/prisma/prisma-next/tree/main/skills.
34
+
35
+ Node-based Prisma Next projects expect Node.js 24 LTS or newer.
@@ -0,0 +1,34 @@
1
+ # {{projectName}}
2
+
3
+ Generated by `prisma-next init` with the Minimal template.
4
+
5
+ ## First run
6
+
7
+ 1. `{{runDbInit}}` — applies your contract to the database (creates tables, signs the marker).
8
+ 2. `{{runDev}}` — runs `src/index.ts`, which writes one row and reads it back.
9
+
10
+ ## Available scripts
11
+
12
+ - `{{runDev}}` — run the Prisma Next sample script
13
+
14
+ ### Database and migrations
15
+
16
+ - `{{runContractEmit}}` — emit contract artifacts after contract changes
17
+ - `{{runDbInit}}` — initialize database state manually
18
+ - `{{runDbUpdate}}` — update database state manually
19
+ - `{{runMigrationPlan}}` — create a migration plan
20
+ - `{{runMigrate}}` — apply a planned migration
21
+ - `{{runDbSeed}}` — insert sample users manually (run after `db:init`)
22
+
23
+ ## Prisma Next
24
+
25
+ Prisma Next setup is scaffolded in:
26
+
27
+ - `{{contractPath}}`
28
+ - `prisma-next.config.ts`
29
+ - `prisma/db.ts`
30
+ - `src/lib/prisma.ts`
31
+
32
+ For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma Next skills live in the upstream `skills/` directory: https://github.com/prisma/prisma-next/tree/main/skills.
33
+
34
+ Node-based Prisma Next projects expect Node.js 24 LTS or newer.
@@ -0,0 +1,62 @@
1
+ import { formatRunScriptCommand, type PackageManager } from '../detect-package-manager';
2
+ import type { TargetId } from './code-templates';
3
+ import { renderTemplate } from './render';
4
+
5
+ const sharedVariables = ['projectName', 'contractPath', 'runDev', 'runContractEmit'] as const;
6
+
7
+ export const postgresVariables = [
8
+ ...sharedVariables,
9
+ 'runDbInit',
10
+ 'runDbUpdate',
11
+ 'runMigrationPlan',
12
+ 'runMigrate',
13
+ 'runDbSeed',
14
+ ] as const;
15
+
16
+ export const mongoVariables = [
17
+ ...sharedVariables,
18
+ 'runDbUp',
19
+ 'runDbDown',
20
+ 'runDbReset',
21
+ 'runMigrationPlan',
22
+ 'runMigrate',
23
+ 'runDbSeed',
24
+ ] as const;
25
+
26
+ type PostgresVars = Record<(typeof postgresVariables)[number], string>;
27
+ type MongoVars = Record<(typeof mongoVariables)[number], string>;
28
+
29
+ export function minimalProjectReadmeMd(
30
+ target: TargetId,
31
+ schemaPath: string,
32
+ projectName: string,
33
+ pm: PackageManager,
34
+ ): string {
35
+ const run = (script: string): string => formatRunScriptCommand(pm, script);
36
+ const shared = {
37
+ projectName,
38
+ contractPath: schemaPath,
39
+ runDev: run('dev'),
40
+ runContractEmit: run('contract:emit'),
41
+ runMigrationPlan: run('migration:plan'),
42
+ runMigrate: run('migrate'),
43
+ runDbSeed: run('db:seed'),
44
+ };
45
+
46
+ if (target === 'mongo') {
47
+ const vars: MongoVars = {
48
+ ...shared,
49
+ runDbUp: run('db:up'),
50
+ runDbDown: run('db:down'),
51
+ runDbReset: run('db:reset'),
52
+ };
53
+ return renderTemplate('readme-mongo.md', mongoVariables, vars);
54
+ }
55
+
56
+ const vars: PostgresVars = {
57
+ ...shared,
58
+ runDbInit: run('db:init'),
59
+ runDbUpdate: run('db:update'),
60
+ };
61
+ return renderTemplate('readme-postgres.md', postgresVariables, vars);
62
+ }