@prisma-next/cli 0.10.0-dev.9 → 0.11.0
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/README.md +1 -1
- package/dist/{cli-errors-CF60g2cG.mjs → cli-errors-Djtz98Vm.mjs} +3 -3
- package/dist/cli-errors-Djtz98Vm.mjs.map +1 -0
- package/dist/cli.mjs +46 -51
- package/dist/cli.mjs.map +1 -1
- package/dist/{client-Brv4qlfB.mjs → client-oXO2WCPD.mjs} +6 -5
- package/dist/client-oXO2WCPD.mjs.map +1 -0
- package/dist/{command-helpers-Dvgul7UA.mjs → command-helpers-BSb0tRC8.mjs} +103 -9
- package/dist/command-helpers-BSb0tRC8.mjs.map +1 -0
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.d.mts.map +1 -1
- package/dist/commands/db-init.mjs +19 -20
- package/dist/commands/db-init.mjs.map +1 -1
- package/dist/commands/db-schema.mjs +6 -10
- package/dist/commands/db-schema.mjs.map +1 -1
- package/dist/commands/db-sign.mjs +7 -11
- package/dist/commands/db-sign.mjs.map +1 -1
- package/dist/commands/db-update.d.mts.map +1 -1
- package/dist/commands/db-update.mjs +16 -17
- package/dist/commands/db-update.mjs.map +1 -1
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migrate.d.mts +1 -1
- package/dist/commands/migrate.mjs +7 -11
- package/dist/commands/migrate.mjs.map +1 -1
- package/dist/commands/migration-check.mjs +4 -7
- package/dist/commands/migration-check.mjs.map +1 -1
- package/dist/commands/migration-graph.d.mts +1 -1
- package/dist/commands/migration-graph.mjs +6 -10
- package/dist/commands/migration-graph.mjs.map +1 -1
- package/dist/commands/migration-list.mjs +5 -9
- package/dist/commands/migration-list.mjs.map +1 -1
- package/dist/commands/migration-log.d.mts.map +1 -1
- package/dist/commands/migration-log.mjs +7 -10
- package/dist/commands/migration-log.mjs.map +1 -1
- package/dist/commands/migration-new.mjs +6 -10
- package/dist/commands/migration-new.mjs.map +1 -1
- package/dist/commands/migration-plan.d.mts +1 -1
- package/dist/commands/migration-plan.mjs +1 -1
- package/dist/commands/migration-show.d.mts +1 -1
- package/dist/commands/migration-show.mjs +8 -12
- package/dist/commands/migration-show.mjs.map +1 -1
- package/dist/commands/migration-status.d.mts +1 -1
- package/dist/commands/migration-status.d.mts.map +1 -1
- package/dist/commands/migration-status.mjs +36 -14
- package/dist/commands/migration-status.mjs.map +1 -1
- package/dist/commands/ref.d.mts +1 -1
- package/dist/commands/ref.mjs +9 -19
- package/dist/commands/ref.mjs.map +1 -1
- package/dist/{contract-emit-iynA3BCA.mjs → contract-emit-bcrpT-wD.mjs} +3 -3
- package/dist/{contract-emit-iynA3BCA.mjs.map → contract-emit-bcrpT-wD.mjs.map} +1 -1
- package/dist/{contract-emit-BDBzHlaC.mjs → contract-emit-r4y8Zhf1.mjs} +7 -12
- package/dist/contract-emit-r4y8Zhf1.mjs.map +1 -0
- package/dist/{contract-infer-Dm8pBZMR.mjs → contract-infer-BmySmqVT.mjs} +8 -13
- package/dist/contract-infer-BmySmqVT.mjs.map +1 -0
- package/dist/{contract-space-aggregate-loader-pAc8CDfY.mjs → contract-space-aggregate-loader-BmNQwlws.mjs} +2 -2
- package/dist/{contract-space-aggregate-loader-pAc8CDfY.mjs.map → contract-space-aggregate-loader-BmNQwlws.mjs.map} +1 -1
- package/dist/{db-verify-CW8DR5Ei.mjs → db-verify-BClPs3ph.mjs} +9 -13
- package/dist/db-verify-BClPs3ph.mjs.map +1 -0
- package/dist/exports/control-api.d.mts +1 -1
- package/dist/exports/control-api.mjs +2 -2
- package/dist/exports/index.mjs +1 -1
- package/dist/exports/init-output.mjs +1 -1
- package/dist/{framework-components-xFLFpZUO.mjs → framework-components-65gOHkHB.mjs} +2 -2
- package/dist/{framework-components-xFLFpZUO.mjs.map → framework-components-65gOHkHB.mjs.map} +1 -1
- package/dist/{global-flags-DGmw6Kqg.d.mts → global-flags-CdE7M0d9.d.mts} +4 -1
- package/dist/global-flags-CdE7M0d9.d.mts.map +1 -0
- package/dist/{graph-render-eJDcLWny.mjs → graph-render-DJVv0_uf.mjs} +1 -1
- package/dist/{graph-render-eJDcLWny.mjs.map → graph-render-DJVv0_uf.mjs.map} +1 -1
- package/dist/{init-CxS9eqbQ.mjs → init-BCJZPWE1.mjs} +141 -55
- package/dist/init-BCJZPWE1.mjs.map +1 -0
- package/dist/{inspect-live-schema-iETRZ_59.mjs → inspect-live-schema-DSRbFoOL.mjs} +4 -4
- package/dist/{inspect-live-schema-iETRZ_59.mjs.map → inspect-live-schema-DSRbFoOL.mjs.map} +1 -1
- package/dist/{migration-command-scaffold-BlgVj_Pn.mjs → migration-command-scaffold-Bzd9La5c.mjs} +4 -4
- package/dist/{migration-command-scaffold-BlgVj_Pn.mjs.map → migration-command-scaffold-Bzd9La5c.mjs.map} +1 -1
- package/dist/{migration-plan-BSzcWsvm.mjs → migration-plan-CFwqw3Gk.mjs} +8 -12
- package/dist/migration-plan-CFwqw3Gk.mjs.map +1 -0
- package/dist/{migration-types-D2FW63pr.d.mts → migration-types-BXWvz12q.d.mts} +1 -1
- package/dist/{migration-types-D2FW63pr.d.mts.map → migration-types-BXWvz12q.d.mts.map} +1 -1
- package/dist/{migrations-CgANWI0w.mjs → migrations-CwZMa1Ck.mjs} +2 -2
- package/dist/{migrations-CgANWI0w.mjs.map → migrations-CwZMa1Ck.mjs.map} +1 -1
- package/dist/{output-B60Gw5fu.mjs → output-BlsrGMEF.mjs} +1 -1
- package/dist/{output-B60Gw5fu.mjs.map → output-BlsrGMEF.mjs.map} +1 -1
- package/dist/readme-mongo.md +35 -0
- package/dist/readme-postgres.md +34 -0
- package/dist/{terminal-ui-XtOQsqe9.mjs → terminal-ui-BiB_8KNo.mjs} +131 -24
- package/dist/terminal-ui-BiB_8KNo.mjs.map +1 -0
- package/dist/{types-0aS865QN.d.mts → types--CqjMdk0.d.mts} +2 -2
- package/dist/{types-0aS865QN.d.mts.map → types--CqjMdk0.d.mts.map} +1 -1
- package/dist/{verify-nlzO0uIY.mjs → verify-Bom75OYI.mjs} +2 -2
- package/dist/{verify-nlzO0uIY.mjs.map → verify-Bom75OYI.mjs.map} +1 -1
- package/package.json +18 -18
- package/src/cli.ts +36 -9
- package/src/commands/contract-emit.ts +4 -4
- package/src/commands/contract-infer.ts +6 -6
- package/src/commands/db-init.ts +13 -5
- package/src/commands/db-schema.ts +4 -4
- package/src/commands/db-sign.ts +4 -4
- package/src/commands/db-update.ts +13 -5
- package/src/commands/db-verify.ts +5 -5
- package/src/commands/init/detect-package-manager.ts +15 -0
- package/src/commands/init/errors.ts +31 -0
- package/src/commands/init/index.ts +2 -2
- package/src/commands/init/init.ts +33 -17
- package/src/commands/init/inputs.ts +6 -4
- package/src/commands/init/output.ts +1 -1
- package/src/commands/init/skill-install.ts +37 -26
- package/src/commands/init/templates/code-templates.ts +4 -12
- package/src/commands/init/templates/env.ts +8 -1
- package/src/commands/init/templates/readme-mongo.md +35 -0
- package/src/commands/init/templates/readme-postgres.md +34 -0
- package/src/commands/init/templates/readme.ts +62 -0
- package/src/commands/migrate.ts +4 -7
- package/src/commands/migration-check.ts +4 -4
- package/src/commands/migration-graph.ts +4 -4
- package/src/commands/migration-list.ts +4 -4
- package/src/commands/migration-log.ts +6 -5
- package/src/commands/migration-new.ts +4 -4
- package/src/commands/migration-plan.ts +4 -4
- package/src/commands/migration-show.ts +4 -4
- package/src/commands/migration-status.ts +49 -6
- package/src/commands/ref.ts +8 -8
- package/src/control-api/operations/apply-aggregate.ts +1 -0
- package/src/utils/cli-errors.ts +4 -0
- package/src/utils/command-helpers.ts +6 -2
- package/src/utils/global-flags.ts +102 -17
- package/src/utils/telemetry.ts +27 -52
- package/src/utils/terminal-ui.ts +44 -23
- package/dist/cli-errors-CF60g2cG.mjs.map +0 -1
- package/dist/client-Brv4qlfB.mjs.map +0 -1
- package/dist/command-helpers-Dvgul7UA.mjs.map +0 -1
- package/dist/contract-emit-BDBzHlaC.mjs.map +0 -1
- package/dist/contract-infer-Dm8pBZMR.mjs.map +0 -1
- package/dist/db-verify-CW8DR5Ei.mjs.map +0 -1
- package/dist/errors-BYAXmyRJ.mjs +0 -56
- package/dist/errors-BYAXmyRJ.mjs.map +0 -1
- package/dist/global-flags-DGmw6Kqg.d.mts.map +0 -1
- package/dist/init-CxS9eqbQ.mjs.map +0 -1
- package/dist/is-ci-YyvQBBke.mjs +0 -44
- package/dist/is-ci-YyvQBBke.mjs.map +0 -1
- package/dist/migration-plan-BSzcWsvm.mjs.map +0 -1
- package/dist/result-handler-CG3vVoKf.mjs +0 -25
- package/dist/result-handler-CG3vVoKf.mjs.map +0 -1
- package/dist/terminal-ui-XtOQsqe9.mjs.map +0 -1
- /package/dist/{cli-errors-DdcjVLJV.d.mts → cli-errors-Czmx92Zy.d.mts} +0 -0
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { t as CliStructuredError } from "./cli-errors-
|
|
2
|
-
import {
|
|
3
|
-
import { n as formatErrorOutput, t as formatErrorJson } from "./errors-BYAXmyRJ.mjs";
|
|
4
|
-
import { t as TerminalUI } from "./terminal-ui-XtOQsqe9.mjs";
|
|
1
|
+
import { t as CliStructuredError } from "./cli-errors-Djtz98Vm.mjs";
|
|
2
|
+
import { a as isCI, i as formatErrorOutput, r as formatErrorJson, t as createTerminalUI } from "./terminal-ui-BiB_8KNo.mjs";
|
|
5
3
|
import { t as version } from "./cli.mjs";
|
|
6
|
-
import { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from "./output-
|
|
4
|
+
import { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from "./output-BlsrGMEF.mjs";
|
|
7
5
|
import { createRequire } from "node:module";
|
|
8
6
|
import { basename, dirname, extname, isAbsolute, join, normalize } from "pathe";
|
|
9
7
|
import * as clack from "@clack/prompts";
|
|
@@ -56,6 +54,15 @@ function formatRunCommand(pm, bin, args) {
|
|
|
56
54
|
if (pm === "deno") return `deno run npm:${bin} ${args}`;
|
|
57
55
|
return `${pm} ${bin} ${args}`;
|
|
58
56
|
}
|
|
57
|
+
function formatRunScriptCommand(pm, scriptName) {
|
|
58
|
+
switch (pm) {
|
|
59
|
+
case "deno": return `deno task ${scriptName}`;
|
|
60
|
+
case "bun": return `bun run ${scriptName}`;
|
|
61
|
+
case "pnpm": return `pnpm run ${scriptName}`;
|
|
62
|
+
case "yarn": return `yarn run ${scriptName}`;
|
|
63
|
+
default: return `npm run ${scriptName}`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
59
66
|
function formatAddArgs(pm, packages) {
|
|
60
67
|
if (pm === "deno") return ["add", ...packages.map((p) => `npm:${p}`)];
|
|
61
68
|
return ["add", ...packages];
|
|
@@ -225,6 +232,26 @@ function errorInitInvalidFlagValue(options) {
|
|
|
225
232
|
});
|
|
226
233
|
}
|
|
227
234
|
/**
|
|
235
|
+
* `--authoring` and `--schema-path` disagree on file extension (e.g. PSL
|
|
236
|
+
* authoring with a `.ts` path). Surfaces before any scaffold files are
|
|
237
|
+
* written so the project tree stays untouched.
|
|
238
|
+
*/
|
|
239
|
+
function errorInitAuthoringSchemaPathMismatch(options) {
|
|
240
|
+
const expectedAuthoring = options.expectedExtension === ".ts" ? "typescript" : "psl";
|
|
241
|
+
return new CliStructuredError("5014", "Authoring and schema path do not match", {
|
|
242
|
+
domain: "CLI",
|
|
243
|
+
why: `\`--authoring ${options.authoring}\` requires a schema file ending in ${options.expectedExtension}, but \`--schema-path ${options.schemaPath}\` ends in ${options.actualExtension}.`,
|
|
244
|
+
fix: `Use a matching pair, for example \`--authoring ${expectedAuthoring} --schema-path <path>${options.expectedExtension}\`, or change \`--authoring\` to match the path you supplied. You can also omit \`--schema-path\` to use the default for the chosen authoring.`,
|
|
245
|
+
docsUrl: "https://prisma-next.dev/docs/cli/init",
|
|
246
|
+
meta: {
|
|
247
|
+
authoring: options.authoring,
|
|
248
|
+
schemaPath: options.schemaPath,
|
|
249
|
+
actualExtension: options.actualExtension,
|
|
250
|
+
expectedExtension: options.expectedExtension
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
228
255
|
* The user cancelled an interactive prompt (Ctrl-C, escape, declined a
|
|
229
256
|
* selection). Distinct from `errorInitReinitNeedsForce` because that path
|
|
230
257
|
* applies to non-interactive mode where the user was never given the
|
|
@@ -660,11 +687,9 @@ model User {
|
|
|
660
687
|
function schemaSampleTsPostgres() {
|
|
661
688
|
return `\`\`\`typescript
|
|
662
689
|
import { defineContract } from '@prisma-next/postgres/contract-builder';
|
|
663
|
-
import sqlFamily from '@prisma-next/postgres/family';
|
|
664
|
-
import postgresTarget from '@prisma-next/postgres/target';
|
|
665
690
|
|
|
666
691
|
export const contract = defineContract(
|
|
667
|
-
{
|
|
692
|
+
{},
|
|
668
693
|
({ field, model }) => ({
|
|
669
694
|
models: {
|
|
670
695
|
User: model('User', {
|
|
@@ -683,11 +708,9 @@ export const contract = defineContract(
|
|
|
683
708
|
function schemaSampleTsMongo() {
|
|
684
709
|
return `\`\`\`typescript
|
|
685
710
|
import { defineContract } from '@prisma-next/mongo/contract-builder';
|
|
686
|
-
import mongoFamily from '@prisma-next/mongo/family';
|
|
687
|
-
import mongoTarget from '@prisma-next/mongo/target';
|
|
688
711
|
|
|
689
712
|
export const contract = defineContract(
|
|
690
|
-
{
|
|
713
|
+
{},
|
|
691
714
|
({ field, model }) => ({
|
|
692
715
|
models: {
|
|
693
716
|
User: model('User', {
|
|
@@ -752,11 +775,9 @@ model Post {
|
|
|
752
775
|
}
|
|
753
776
|
function starterSchemaTsPostgres() {
|
|
754
777
|
return `import { defineContract } from '@prisma-next/postgres/contract-builder';
|
|
755
|
-
import sqlFamily from '@prisma-next/postgres/family';
|
|
756
|
-
import postgresTarget from '@prisma-next/postgres/target';
|
|
757
778
|
|
|
758
779
|
export const contract = defineContract(
|
|
759
|
-
{
|
|
780
|
+
{},
|
|
760
781
|
({ field, model, rel }) => ({
|
|
761
782
|
models: {
|
|
762
783
|
User: model('User', {
|
|
@@ -793,11 +814,9 @@ export const contract = defineContract(
|
|
|
793
814
|
}
|
|
794
815
|
function starterSchemaTsMongo() {
|
|
795
816
|
return `import { defineContract } from '@prisma-next/mongo/contract-builder';
|
|
796
|
-
import mongoFamily from '@prisma-next/mongo/family';
|
|
797
|
-
import mongoTarget from '@prisma-next/mongo/target';
|
|
798
817
|
|
|
799
818
|
export const contract = defineContract(
|
|
800
|
-
{
|
|
819
|
+
{},
|
|
801
820
|
({ field, model, rel }) => ({
|
|
802
821
|
models: {
|
|
803
822
|
User: model('User', {
|
|
@@ -1096,10 +1115,11 @@ function validateSchemaPath(value, authoring) {
|
|
|
1096
1115
|
});
|
|
1097
1116
|
const ext = extname(trimmed).toLowerCase();
|
|
1098
1117
|
const expected = authoring === "typescript" ? ".ts" : ".prisma";
|
|
1099
|
-
if (ext !== expected) throw
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1118
|
+
if (ext !== expected) throw errorInitAuthoringSchemaPathMismatch({
|
|
1119
|
+
authoring,
|
|
1120
|
+
schemaPath: trimmed,
|
|
1121
|
+
actualExtension: ext.length > 0 ? ext : "(none)",
|
|
1122
|
+
expectedExtension: expected
|
|
1103
1123
|
});
|
|
1104
1124
|
return normalize(trimmed);
|
|
1105
1125
|
}
|
|
@@ -1437,6 +1457,17 @@ function isLocalPath(base) {
|
|
|
1437
1457
|
return base.startsWith("/") || /^[a-zA-Z]:[\\/]/.test(base);
|
|
1438
1458
|
}
|
|
1439
1459
|
/**
|
|
1460
|
+
* Agents passed to every project-level init install. Upstream `skills add`
|
|
1461
|
+
* is the source of truth for per-agent install behaviour; the CLI lists
|
|
1462
|
+
* every supported runtime on one invocation and delegates the rest.
|
|
1463
|
+
*/
|
|
1464
|
+
const DEFAULT_SKILL_AGENTS = [
|
|
1465
|
+
"cursor",
|
|
1466
|
+
"claude-code",
|
|
1467
|
+
"codex",
|
|
1468
|
+
"windsurf"
|
|
1469
|
+
];
|
|
1470
|
+
/**
|
|
1440
1471
|
* Build the `<base>/<subpath>[#ref]` URL the `skills` CLI will
|
|
1441
1472
|
* resolve. Exported for unit tests so the per-source format can be
|
|
1442
1473
|
* asserted without going through the full install loop.
|
|
@@ -1456,39 +1487,34 @@ function formatSkillSourceUrl(source) {
|
|
|
1456
1487
|
* rest of the install step so a single project consistently uses one
|
|
1457
1488
|
* runner.
|
|
1458
1489
|
*
|
|
1459
|
-
* `--
|
|
1460
|
-
*
|
|
1461
|
-
* shows by default. A non-interactive scaffold step cannot present
|
|
1462
|
-
* prompts.
|
|
1490
|
+
* `--agent` takes space-separated slugs on one flag; `--skill '*'` and `-y`
|
|
1491
|
+
* skip the multi-select prompts a non-interactive scaffold step cannot show.
|
|
1463
1492
|
*
|
|
1464
1493
|
* Exported for unit tests so the per-PM dispatch can be asserted
|
|
1465
1494
|
* without a live subprocess.
|
|
1466
1495
|
*/
|
|
1467
|
-
function formatSkillInstallCommand(
|
|
1468
|
-
|
|
1496
|
+
function formatSkillInstallCommand(args) {
|
|
1497
|
+
const agents = args.agents ?? DEFAULT_SKILL_AGENTS;
|
|
1498
|
+
const cliArgs = [
|
|
1469
1499
|
"skills@latest",
|
|
1470
1500
|
"add",
|
|
1471
|
-
formatSkillSourceUrl(source),
|
|
1472
|
-
"--all"
|
|
1473
|
-
]);
|
|
1474
|
-
}
|
|
1475
|
-
/**
|
|
1476
|
-
* `skills add --all` should cover Claude Code, but upstream currently skips
|
|
1477
|
-
* project-local Claude symlinks when `.claude/` does not already exist. Run
|
|
1478
|
-
* the explicit Claude Code install as well so fresh projects get
|
|
1479
|
-
* `.claude/skills` without asking users to create that folder first.
|
|
1480
|
-
*/
|
|
1481
|
-
function formatClaudeSkillInstallCommand(pm, source) {
|
|
1482
|
-
return formatPackageManagerCommand(pm, [
|
|
1483
|
-
"skills@latest",
|
|
1484
|
-
"add",
|
|
1485
|
-
formatSkillSourceUrl(source),
|
|
1501
|
+
formatSkillSourceUrl(args.source),
|
|
1486
1502
|
"--agent",
|
|
1487
|
-
|
|
1503
|
+
...agents,
|
|
1488
1504
|
"--skill",
|
|
1489
1505
|
"'*'",
|
|
1490
1506
|
"-y"
|
|
1491
|
-
]
|
|
1507
|
+
];
|
|
1508
|
+
return formatPackageManagerCommand(args.pm, cliArgs);
|
|
1509
|
+
}
|
|
1510
|
+
/**
|
|
1511
|
+
* Ordered skill-install commands for one init run. Exported for unit tests.
|
|
1512
|
+
*/
|
|
1513
|
+
function resolveProjectSkillInstallCommands(pm) {
|
|
1514
|
+
return DEFAULT_SKILL_SOURCES.map((source) => formatSkillInstallCommand({
|
|
1515
|
+
pm,
|
|
1516
|
+
source
|
|
1517
|
+
}));
|
|
1492
1518
|
}
|
|
1493
1519
|
function formatPackageManagerCommand(pm, args) {
|
|
1494
1520
|
switch (pm) {
|
|
@@ -1526,7 +1552,7 @@ function commandToExec(command) {
|
|
|
1526
1552
|
*/
|
|
1527
1553
|
async function runProjectLevelSkillInstall(ctx) {
|
|
1528
1554
|
const commands = [];
|
|
1529
|
-
const installCommands =
|
|
1555
|
+
const installCommands = resolveProjectSkillInstallCommands(ctx.pm);
|
|
1530
1556
|
for (const command of installCommands) {
|
|
1531
1557
|
const { file, args } = commandToExec(command);
|
|
1532
1558
|
try {
|
|
@@ -1607,7 +1633,12 @@ function envPlaceholderBody(target) {
|
|
|
1607
1633
|
lines.push(`# Requires ${label} >= ${minVersion}.`);
|
|
1608
1634
|
lines.push("");
|
|
1609
1635
|
if (target === "postgres") lines.push("DATABASE_URL=\"postgresql://user:password@localhost:5432/mydb\"");
|
|
1610
|
-
else
|
|
1636
|
+
else {
|
|
1637
|
+
lines.push("# Standalone local mongod / `docker run mongo:7` — no replica set required for first-run queries.");
|
|
1638
|
+
lines.push("# Transactions and change streams need a replica set; add ?replicaSet=... only after initiating one.");
|
|
1639
|
+
lines.push("");
|
|
1640
|
+
lines.push("DATABASE_URL=\"mongodb://user:password@localhost:27017/mydb\"");
|
|
1641
|
+
}
|
|
1611
1642
|
lines.push("");
|
|
1612
1643
|
return lines.join("\n");
|
|
1613
1644
|
}
|
|
@@ -1693,6 +1724,54 @@ function requirementsBlock(target) {
|
|
|
1693
1724
|
].join("\n");
|
|
1694
1725
|
}
|
|
1695
1726
|
//#endregion
|
|
1727
|
+
//#region src/commands/init/templates/readme.ts
|
|
1728
|
+
const sharedVariables = [
|
|
1729
|
+
"projectName",
|
|
1730
|
+
"contractPath",
|
|
1731
|
+
"runDev",
|
|
1732
|
+
"runContractEmit"
|
|
1733
|
+
];
|
|
1734
|
+
const postgresVariables = [
|
|
1735
|
+
...sharedVariables,
|
|
1736
|
+
"runDbInit",
|
|
1737
|
+
"runDbUpdate",
|
|
1738
|
+
"runMigrationPlan",
|
|
1739
|
+
"runMigrate",
|
|
1740
|
+
"runDbSeed"
|
|
1741
|
+
];
|
|
1742
|
+
const mongoVariables = [
|
|
1743
|
+
...sharedVariables,
|
|
1744
|
+
"runDbUp",
|
|
1745
|
+
"runDbDown",
|
|
1746
|
+
"runDbReset",
|
|
1747
|
+
"runMigrationPlan",
|
|
1748
|
+
"runMigrate",
|
|
1749
|
+
"runDbSeed"
|
|
1750
|
+
];
|
|
1751
|
+
function minimalProjectReadmeMd(target, schemaPath, projectName, pm) {
|
|
1752
|
+
const run = (script) => formatRunScriptCommand(pm, script);
|
|
1753
|
+
const shared = {
|
|
1754
|
+
projectName,
|
|
1755
|
+
contractPath: schemaPath,
|
|
1756
|
+
runDev: run("dev"),
|
|
1757
|
+
runContractEmit: run("contract:emit"),
|
|
1758
|
+
runMigrationPlan: run("migration:plan"),
|
|
1759
|
+
runMigrate: run("migrate"),
|
|
1760
|
+
runDbSeed: run("db:seed")
|
|
1761
|
+
};
|
|
1762
|
+
if (target === "mongo") return renderTemplate("readme-mongo.md", mongoVariables, {
|
|
1763
|
+
...shared,
|
|
1764
|
+
runDbUp: run("db:up"),
|
|
1765
|
+
runDbDown: run("db:down"),
|
|
1766
|
+
runDbReset: run("db:reset")
|
|
1767
|
+
});
|
|
1768
|
+
return renderTemplate("readme-postgres.md", postgresVariables, {
|
|
1769
|
+
...shared,
|
|
1770
|
+
runDbInit: run("db:init"),
|
|
1771
|
+
runDbUpdate: run("db:update")
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
//#endregion
|
|
1696
1775
|
//#region src/commands/init/templates/tsconfig.ts
|
|
1697
1776
|
/**
|
|
1698
1777
|
* Compiler options the scaffolded `prisma-next.config.ts` and `db.ts` need
|
|
@@ -1850,10 +1929,7 @@ function mergeTypesArray(existing) {
|
|
|
1850
1929
|
*/
|
|
1851
1930
|
async function runInit(baseDir, runOptions) {
|
|
1852
1931
|
const { options, flags, canPrompt, probeOverrides, afterFirstTelemetryConsent } = runOptions;
|
|
1853
|
-
const ui =
|
|
1854
|
-
color: flags.color,
|
|
1855
|
-
interactive: flags.interactive
|
|
1856
|
-
});
|
|
1932
|
+
const ui = createTerminalUI(flags);
|
|
1857
1933
|
const warnings = [];
|
|
1858
1934
|
const filesWritten = [];
|
|
1859
1935
|
const filesDeleted = [];
|
|
@@ -1982,6 +2058,13 @@ async function runInit(baseDir, runOptions) {
|
|
|
1982
2058
|
if (typeWarning !== null) warnings.push(typeWarning);
|
|
1983
2059
|
if (synthesisePackageJson) warnings.push("No package.json found in the target directory; created a minimal one. Edit `name` / `version` to taste.");
|
|
1984
2060
|
}
|
|
2061
|
+
if (existsSync(join(baseDir, "src/index.ts"))) if (!existsSync(join(baseDir, "README.md"))) {
|
|
2062
|
+
const rawName = parsedPackageJson !== null && typeof parsedPackageJson["name"] === "string" ? parsedPackageJson["name"] : basename(baseDir);
|
|
2063
|
+
filesToWrite.push({
|
|
2064
|
+
path: "README.md",
|
|
2065
|
+
content: minimalProjectReadmeMd(inputs.target, inputs.schemaPath, sanitisePackageName(rawName), pm)
|
|
2066
|
+
});
|
|
2067
|
+
} else warnings.push("README.md already exists; leaving it untouched.");
|
|
1985
2068
|
for (const file of filesToWrite) {
|
|
1986
2069
|
const fullPath = join(baseDir, file.path);
|
|
1987
2070
|
mkdirSync(dirname(fullPath), { recursive: true });
|
|
@@ -2045,10 +2128,12 @@ async function runInit(baseDir, runOptions) {
|
|
|
2045
2128
|
filesWritten
|
|
2046
2129
|
}));
|
|
2047
2130
|
}
|
|
2048
|
-
const manualProjectSkillSummary = DEFAULT_SKILL_SOURCES.
|
|
2131
|
+
const manualProjectSkillSummary = DEFAULT_SKILL_SOURCES.map((source) => formatSkillInstallCommand({
|
|
2132
|
+
pm: install.effectivePm,
|
|
2133
|
+
source
|
|
2134
|
+
})).map((c) => `\`${c}\``).join(" && ");
|
|
2049
2135
|
let skillRegistered = false;
|
|
2050
2136
|
if (!inputs.installProjectSkill) warnings.push(`Skipped Prisma Next skills install (--no-skill). To install the skills later, run: ${manualProjectSkillSummary}`);
|
|
2051
|
-
else if (install.skipped) warnings.push(`Skipped Prisma Next skills install because --no-install was passed. After you run install manually, install the skills with: ${manualProjectSkillSummary}`);
|
|
2052
2137
|
else {
|
|
2053
2138
|
const spinner = ui.spinner();
|
|
2054
2139
|
spinner.start("Registering Prisma Next skills with the agent runtime...");
|
|
@@ -2139,7 +2224,8 @@ function exitCodeForError(error) {
|
|
|
2139
2224
|
case "5005":
|
|
2140
2225
|
case "5010":
|
|
2141
2226
|
case "5011":
|
|
2142
|
-
case "5012":
|
|
2227
|
+
case "5012":
|
|
2228
|
+
case "5014": return 2;
|
|
2143
2229
|
case "5006": return 3;
|
|
2144
2230
|
case "5007": return 4;
|
|
2145
2231
|
case "5008": return 5;
|
|
@@ -2361,7 +2447,7 @@ async function runEmit(ctx) {
|
|
|
2361
2447
|
const spinner = ctx.ui.spinner();
|
|
2362
2448
|
spinner.start("Emitting contract...");
|
|
2363
2449
|
try {
|
|
2364
|
-
const { executeContractEmit } = await import("./contract-emit-
|
|
2450
|
+
const { executeContractEmit } = await import("./contract-emit-bcrpT-wD.mjs").then((n) => n.t);
|
|
2365
2451
|
await executeContractEmit({ configPath: join(ctx.baseDir, "prisma-next.config.ts") });
|
|
2366
2452
|
spinner.stop("Contract emitted");
|
|
2367
2453
|
} catch (err) {
|
|
@@ -2414,4 +2500,4 @@ function sanitisePackageName(raw) {
|
|
|
2414
2500
|
//#endregion
|
|
2415
2501
|
export { runInit };
|
|
2416
2502
|
|
|
2417
|
-
//# sourceMappingURL=init-
|
|
2503
|
+
//# sourceMappingURL=init-BCJZPWE1.mjs.map
|