create-prisma 0.0.0 → 0.1.4
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/CHANGELOG.md +3 -0
- package/README.md +128 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +9 -0
- package/dist/create-Dz9GFGFQ.mjs +1090 -0
- package/dist/index.d.mts +319 -0
- package/dist/index.mjs +38 -0
- package/package.json +63 -3
- package/templates/create/hono/README.md.hbs +66 -0
- package/templates/create/hono/package.json.hbs +19 -0
- package/templates/create/hono/src/index.ts.hbs +34 -0
- package/templates/create/hono/tsconfig.json +15 -0
- package/templates/create/next/README.md.hbs +45 -0
- package/templates/create/next/app/globals.css +47 -0
- package/templates/create/next/app/layout.tsx.hbs +19 -0
- package/templates/create/next/app/page.tsx.hbs +46 -0
- package/templates/create/next/eslint.config.mjs +16 -0
- package/templates/create/next/next.config.ts +7 -0
- package/templates/create/next/package.json.hbs +25 -0
- package/templates/create/next/tsconfig.json +34 -0
- package/templates/init/prisma/index.ts.hbs +52 -0
- package/templates/init/prisma/schema.prisma.hbs +18 -0
- package/templates/init/prisma.config.ts.hbs +12 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as _orpc_server0 from "@orpc/server";
|
|
3
|
+
import * as trpc_cli0 from "trpc-cli";
|
|
4
|
+
import * as zod from "zod";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
7
|
+
|
|
8
|
+
//#region node_modules/@orpc/client/dist/index.d.mts
|
|
9
|
+
declare const COMMON_ORPC_ERROR_DEFS: {
|
|
10
|
+
readonly BAD_REQUEST: {
|
|
11
|
+
readonly status: 400;
|
|
12
|
+
readonly message: "Bad Request";
|
|
13
|
+
};
|
|
14
|
+
readonly UNAUTHORIZED: {
|
|
15
|
+
readonly status: 401;
|
|
16
|
+
readonly message: "Unauthorized";
|
|
17
|
+
};
|
|
18
|
+
readonly FORBIDDEN: {
|
|
19
|
+
readonly status: 403;
|
|
20
|
+
readonly message: "Forbidden";
|
|
21
|
+
};
|
|
22
|
+
readonly NOT_FOUND: {
|
|
23
|
+
readonly status: 404;
|
|
24
|
+
readonly message: "Not Found";
|
|
25
|
+
};
|
|
26
|
+
readonly METHOD_NOT_SUPPORTED: {
|
|
27
|
+
readonly status: 405;
|
|
28
|
+
readonly message: "Method Not Supported";
|
|
29
|
+
};
|
|
30
|
+
readonly NOT_ACCEPTABLE: {
|
|
31
|
+
readonly status: 406;
|
|
32
|
+
readonly message: "Not Acceptable";
|
|
33
|
+
};
|
|
34
|
+
readonly TIMEOUT: {
|
|
35
|
+
readonly status: 408;
|
|
36
|
+
readonly message: "Request Timeout";
|
|
37
|
+
};
|
|
38
|
+
readonly CONFLICT: {
|
|
39
|
+
readonly status: 409;
|
|
40
|
+
readonly message: "Conflict";
|
|
41
|
+
};
|
|
42
|
+
readonly PRECONDITION_FAILED: {
|
|
43
|
+
readonly status: 412;
|
|
44
|
+
readonly message: "Precondition Failed";
|
|
45
|
+
};
|
|
46
|
+
readonly PAYLOAD_TOO_LARGE: {
|
|
47
|
+
readonly status: 413;
|
|
48
|
+
readonly message: "Payload Too Large";
|
|
49
|
+
};
|
|
50
|
+
readonly UNSUPPORTED_MEDIA_TYPE: {
|
|
51
|
+
readonly status: 415;
|
|
52
|
+
readonly message: "Unsupported Media Type";
|
|
53
|
+
};
|
|
54
|
+
readonly UNPROCESSABLE_CONTENT: {
|
|
55
|
+
readonly status: 422;
|
|
56
|
+
readonly message: "Unprocessable Content";
|
|
57
|
+
};
|
|
58
|
+
readonly TOO_MANY_REQUESTS: {
|
|
59
|
+
readonly status: 429;
|
|
60
|
+
readonly message: "Too Many Requests";
|
|
61
|
+
};
|
|
62
|
+
readonly CLIENT_CLOSED_REQUEST: {
|
|
63
|
+
readonly status: 499;
|
|
64
|
+
readonly message: "Client Closed Request";
|
|
65
|
+
};
|
|
66
|
+
readonly INTERNAL_SERVER_ERROR: {
|
|
67
|
+
readonly status: 500;
|
|
68
|
+
readonly message: "Internal Server Error";
|
|
69
|
+
};
|
|
70
|
+
readonly NOT_IMPLEMENTED: {
|
|
71
|
+
readonly status: 501;
|
|
72
|
+
readonly message: "Not Implemented";
|
|
73
|
+
};
|
|
74
|
+
readonly BAD_GATEWAY: {
|
|
75
|
+
readonly status: 502;
|
|
76
|
+
readonly message: "Bad Gateway";
|
|
77
|
+
};
|
|
78
|
+
readonly SERVICE_UNAVAILABLE: {
|
|
79
|
+
readonly status: 503;
|
|
80
|
+
readonly message: "Service Unavailable";
|
|
81
|
+
};
|
|
82
|
+
readonly GATEWAY_TIMEOUT: {
|
|
83
|
+
readonly status: 504;
|
|
84
|
+
readonly message: "Gateway Timeout";
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
type CommonORPCErrorCode = keyof typeof COMMON_ORPC_ERROR_DEFS;
|
|
88
|
+
type ORPCErrorCode = CommonORPCErrorCode | (string & {});
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region node_modules/@standard-schema/spec/dist/index.d.ts
|
|
91
|
+
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
92
|
+
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
93
|
+
/** The Standard properties. */
|
|
94
|
+
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
95
|
+
}
|
|
96
|
+
declare namespace StandardTypedV1 {
|
|
97
|
+
/** The Standard Typed properties interface. */
|
|
98
|
+
interface Props<Input = unknown, Output = Input> {
|
|
99
|
+
/** The version number of the standard. */
|
|
100
|
+
readonly version: 1;
|
|
101
|
+
/** The vendor name of the schema library. */
|
|
102
|
+
readonly vendor: string;
|
|
103
|
+
/** Inferred types associated with the schema. */
|
|
104
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
105
|
+
}
|
|
106
|
+
/** The Standard Typed types interface. */
|
|
107
|
+
interface Types<Input = unknown, Output = Input> {
|
|
108
|
+
/** The input type of the schema. */
|
|
109
|
+
readonly input: Input;
|
|
110
|
+
/** The output type of the schema. */
|
|
111
|
+
readonly output: Output;
|
|
112
|
+
}
|
|
113
|
+
/** Infers the input type of a Standard Typed. */
|
|
114
|
+
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
115
|
+
/** Infers the output type of a Standard Typed. */
|
|
116
|
+
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
117
|
+
}
|
|
118
|
+
/** The Standard Schema interface. */
|
|
119
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
120
|
+
/** The Standard Schema properties. */
|
|
121
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
122
|
+
}
|
|
123
|
+
declare namespace StandardSchemaV1 {
|
|
124
|
+
/** The Standard Schema properties interface. */
|
|
125
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
126
|
+
/** Validates unknown input values. */
|
|
127
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
128
|
+
}
|
|
129
|
+
/** The result interface of the validate function. */
|
|
130
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
131
|
+
/** The result interface if validation succeeds. */
|
|
132
|
+
interface SuccessResult<Output> {
|
|
133
|
+
/** The typed output value. */
|
|
134
|
+
readonly value: Output;
|
|
135
|
+
/** A falsy value for `issues` indicates success. */
|
|
136
|
+
readonly issues?: undefined;
|
|
137
|
+
}
|
|
138
|
+
interface Options {
|
|
139
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
140
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
141
|
+
}
|
|
142
|
+
/** The result interface if validation fails. */
|
|
143
|
+
interface FailureResult {
|
|
144
|
+
/** The issues of failed validation. */
|
|
145
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
146
|
+
}
|
|
147
|
+
/** The issue interface of the failure output. */
|
|
148
|
+
interface Issue {
|
|
149
|
+
/** The error message of the issue. */
|
|
150
|
+
readonly message: string;
|
|
151
|
+
/** The path of the issue, if any. */
|
|
152
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
153
|
+
}
|
|
154
|
+
/** The path segment interface of the issue. */
|
|
155
|
+
interface PathSegment {
|
|
156
|
+
/** The key representing a path segment. */
|
|
157
|
+
readonly key: PropertyKey;
|
|
158
|
+
}
|
|
159
|
+
/** The Standard types interface. */
|
|
160
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
|
|
161
|
+
/** Infers the input type of a Standard. */
|
|
162
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
163
|
+
/** Infers the output type of a Standard. */
|
|
164
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
165
|
+
}
|
|
166
|
+
/** The Standard JSON Schema interface. */
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region node_modules/@orpc/contract/dist/shared/contract.TuRtB1Ca.d.mts
|
|
169
|
+
type Schema<TInput, TOutput> = StandardSchemaV1<TInput, TOutput>;
|
|
170
|
+
type AnySchema = Schema<any, any>;
|
|
171
|
+
interface ErrorMapItem<TDataSchema extends AnySchema> {
|
|
172
|
+
status?: number;
|
|
173
|
+
message?: string;
|
|
174
|
+
data?: TDataSchema;
|
|
175
|
+
}
|
|
176
|
+
type ErrorMap = { [key in ORPCErrorCode]?: ErrorMapItem<AnySchema> };
|
|
177
|
+
type MergedErrorMap<T1 extends ErrorMap, T2 extends ErrorMap> = Omit<T1, keyof T2> & T2;
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/types.d.ts
|
|
180
|
+
declare const DatabaseProviderSchema: z.ZodEnum<{
|
|
181
|
+
postgresql: "postgresql";
|
|
182
|
+
mysql: "mysql";
|
|
183
|
+
sqlite: "sqlite";
|
|
184
|
+
sqlserver: "sqlserver";
|
|
185
|
+
cockroachdb: "cockroachdb";
|
|
186
|
+
}>;
|
|
187
|
+
declare const PackageManagerSchema: z.ZodEnum<{
|
|
188
|
+
npm: "npm";
|
|
189
|
+
pnpm: "pnpm";
|
|
190
|
+
bun: "bun";
|
|
191
|
+
}>;
|
|
192
|
+
declare const SchemaPresetSchema: z.ZodEnum<{
|
|
193
|
+
empty: "empty";
|
|
194
|
+
basic: "basic";
|
|
195
|
+
}>;
|
|
196
|
+
declare const CreateTemplateSchema: z.ZodEnum<{
|
|
197
|
+
hono: "hono";
|
|
198
|
+
next: "next";
|
|
199
|
+
}>;
|
|
200
|
+
declare const DatabaseUrlSchema: z.ZodString;
|
|
201
|
+
declare const InitCommandInputSchema: z.ZodObject<{
|
|
202
|
+
yes: z.ZodOptional<z.ZodBoolean>;
|
|
203
|
+
verbose: z.ZodOptional<z.ZodBoolean>;
|
|
204
|
+
provider: z.ZodOptional<z.ZodEnum<{
|
|
205
|
+
postgresql: "postgresql";
|
|
206
|
+
mysql: "mysql";
|
|
207
|
+
sqlite: "sqlite";
|
|
208
|
+
sqlserver: "sqlserver";
|
|
209
|
+
cockroachdb: "cockroachdb";
|
|
210
|
+
}>>;
|
|
211
|
+
packageManager: z.ZodOptional<z.ZodEnum<{
|
|
212
|
+
npm: "npm";
|
|
213
|
+
pnpm: "pnpm";
|
|
214
|
+
bun: "bun";
|
|
215
|
+
}>>;
|
|
216
|
+
prismaPostgres: z.ZodOptional<z.ZodBoolean>;
|
|
217
|
+
databaseUrl: z.ZodOptional<z.ZodString>;
|
|
218
|
+
install: z.ZodOptional<z.ZodBoolean>;
|
|
219
|
+
generate: z.ZodOptional<z.ZodBoolean>;
|
|
220
|
+
schemaPreset: z.ZodOptional<z.ZodEnum<{
|
|
221
|
+
empty: "empty";
|
|
222
|
+
basic: "basic";
|
|
223
|
+
}>>;
|
|
224
|
+
}, z.core.$strip>;
|
|
225
|
+
type InitCommandInput = z.infer<typeof InitCommandInputSchema>;
|
|
226
|
+
declare const CreateCommandInputSchema: z.ZodObject<{
|
|
227
|
+
yes: z.ZodOptional<z.ZodBoolean>;
|
|
228
|
+
verbose: z.ZodOptional<z.ZodBoolean>;
|
|
229
|
+
name: z.ZodOptional<z.ZodString>;
|
|
230
|
+
template: z.ZodOptional<z.ZodEnum<{
|
|
231
|
+
hono: "hono";
|
|
232
|
+
next: "next";
|
|
233
|
+
}>>;
|
|
234
|
+
force: z.ZodOptional<z.ZodBoolean>;
|
|
235
|
+
provider: z.ZodOptional<z.ZodEnum<{
|
|
236
|
+
postgresql: "postgresql";
|
|
237
|
+
mysql: "mysql";
|
|
238
|
+
sqlite: "sqlite";
|
|
239
|
+
sqlserver: "sqlserver";
|
|
240
|
+
cockroachdb: "cockroachdb";
|
|
241
|
+
}>>;
|
|
242
|
+
packageManager: z.ZodOptional<z.ZodEnum<{
|
|
243
|
+
npm: "npm";
|
|
244
|
+
pnpm: "pnpm";
|
|
245
|
+
bun: "bun";
|
|
246
|
+
}>>;
|
|
247
|
+
prismaPostgres: z.ZodOptional<z.ZodBoolean>;
|
|
248
|
+
databaseUrl: z.ZodOptional<z.ZodString>;
|
|
249
|
+
install: z.ZodOptional<z.ZodBoolean>;
|
|
250
|
+
generate: z.ZodOptional<z.ZodBoolean>;
|
|
251
|
+
schemaPreset: z.ZodOptional<z.ZodEnum<{
|
|
252
|
+
empty: "empty";
|
|
253
|
+
basic: "basic";
|
|
254
|
+
}>>;
|
|
255
|
+
}, z.core.$strip>;
|
|
256
|
+
type CreateCommandInput = z.infer<typeof CreateCommandInputSchema>;
|
|
257
|
+
//#endregion
|
|
258
|
+
//#region src/index.d.ts
|
|
259
|
+
declare const router: {
|
|
260
|
+
create: _orpc_server0.Procedure<_orpc_server0.MergedInitialContext<Record<never, never>, Record<never, never>, Record<never, never>>, Record<never, never>, zod.ZodOptional<zod.ZodObject<{
|
|
261
|
+
yes: zod.ZodOptional<zod.ZodBoolean>;
|
|
262
|
+
verbose: zod.ZodOptional<zod.ZodBoolean>;
|
|
263
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
264
|
+
template: zod.ZodOptional<zod.ZodEnum<{
|
|
265
|
+
hono: "hono";
|
|
266
|
+
next: "next";
|
|
267
|
+
}>>;
|
|
268
|
+
force: zod.ZodOptional<zod.ZodBoolean>;
|
|
269
|
+
provider: zod.ZodOptional<zod.ZodEnum<{
|
|
270
|
+
postgresql: "postgresql";
|
|
271
|
+
mysql: "mysql";
|
|
272
|
+
sqlite: "sqlite";
|
|
273
|
+
sqlserver: "sqlserver";
|
|
274
|
+
cockroachdb: "cockroachdb";
|
|
275
|
+
}>>;
|
|
276
|
+
packageManager: zod.ZodOptional<zod.ZodEnum<{
|
|
277
|
+
npm: "npm";
|
|
278
|
+
pnpm: "pnpm";
|
|
279
|
+
bun: "bun";
|
|
280
|
+
}>>;
|
|
281
|
+
prismaPostgres: zod.ZodOptional<zod.ZodBoolean>;
|
|
282
|
+
databaseUrl: zod.ZodOptional<zod.ZodString>;
|
|
283
|
+
install: zod.ZodOptional<zod.ZodBoolean>;
|
|
284
|
+
generate: zod.ZodOptional<zod.ZodBoolean>;
|
|
285
|
+
schemaPreset: zod.ZodOptional<zod.ZodEnum<{
|
|
286
|
+
empty: "empty";
|
|
287
|
+
basic: "basic";
|
|
288
|
+
}>>;
|
|
289
|
+
}, zod_v4_core0.$strip>>, Schema<void, void>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
290
|
+
init: _orpc_server0.Procedure<_orpc_server0.MergedInitialContext<Record<never, never>, Record<never, never>, Record<never, never>>, Record<never, never>, zod.ZodOptional<zod.ZodObject<{
|
|
291
|
+
yes: zod.ZodOptional<zod.ZodBoolean>;
|
|
292
|
+
verbose: zod.ZodOptional<zod.ZodBoolean>;
|
|
293
|
+
provider: zod.ZodOptional<zod.ZodEnum<{
|
|
294
|
+
postgresql: "postgresql";
|
|
295
|
+
mysql: "mysql";
|
|
296
|
+
sqlite: "sqlite";
|
|
297
|
+
sqlserver: "sqlserver";
|
|
298
|
+
cockroachdb: "cockroachdb";
|
|
299
|
+
}>>;
|
|
300
|
+
packageManager: zod.ZodOptional<zod.ZodEnum<{
|
|
301
|
+
npm: "npm";
|
|
302
|
+
pnpm: "pnpm";
|
|
303
|
+
bun: "bun";
|
|
304
|
+
}>>;
|
|
305
|
+
prismaPostgres: zod.ZodOptional<zod.ZodBoolean>;
|
|
306
|
+
databaseUrl: zod.ZodOptional<zod.ZodString>;
|
|
307
|
+
install: zod.ZodOptional<zod.ZodBoolean>;
|
|
308
|
+
generate: zod.ZodOptional<zod.ZodBoolean>;
|
|
309
|
+
schemaPreset: zod.ZodOptional<zod.ZodEnum<{
|
|
310
|
+
empty: "empty";
|
|
311
|
+
basic: "basic";
|
|
312
|
+
}>>;
|
|
313
|
+
}, zod_v4_core0.$strip>>, Schema<void, void>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
314
|
+
};
|
|
315
|
+
declare function createCreatePrismaCli(): trpc_cli0.TrpcCli;
|
|
316
|
+
declare function init(input?: InitCommandInput): Promise<void>;
|
|
317
|
+
declare function create(input?: CreateCommandInput): Promise<void>;
|
|
318
|
+
//#endregion
|
|
319
|
+
export { type CreateCommandInput, CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, DatabaseUrlSchema, type InitCommandInput, InitCommandInputSchema, PackageManagerSchema, SchemaPresetSchema, create, createCreatePrismaCli, init, router };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { a as DatabaseProviderSchema, c as PackageManagerSchema, i as CreateTemplateSchema, l as SchemaPresetSchema, n as runInitCommand, o as DatabaseUrlSchema, r as CreateCommandInputSchema, s as InitCommandInputSchema, t as runCreateCommand } from "./create-Dz9GFGFQ.mjs";
|
|
3
|
+
import { os } from "@orpc/server";
|
|
4
|
+
import { createCli } from "trpc-cli";
|
|
5
|
+
|
|
6
|
+
//#region src/index.ts
|
|
7
|
+
const CLI_VERSION = "0.1.4";
|
|
8
|
+
const router = os.router({
|
|
9
|
+
create: os.meta({
|
|
10
|
+
description: "Create a new project with Prisma setup",
|
|
11
|
+
default: true,
|
|
12
|
+
negateBooleans: true
|
|
13
|
+
}).input(CreateCommandInputSchema.optional()).handler(async ({ input }) => {
|
|
14
|
+
await runCreateCommand(input ?? {});
|
|
15
|
+
}),
|
|
16
|
+
init: os.meta({
|
|
17
|
+
description: "Initialize Prisma in your current project",
|
|
18
|
+
negateBooleans: true
|
|
19
|
+
}).input(InitCommandInputSchema.optional()).handler(async ({ input }) => {
|
|
20
|
+
await runInitCommand(input ?? {});
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
function createCreatePrismaCli() {
|
|
24
|
+
return createCli({
|
|
25
|
+
router,
|
|
26
|
+
name: "create-prisma",
|
|
27
|
+
version: CLI_VERSION
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async function init(input = {}) {
|
|
31
|
+
await runInitCommand(input);
|
|
32
|
+
}
|
|
33
|
+
async function create(input = {}) {
|
|
34
|
+
await runCreateCommand(input);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, DatabaseUrlSchema, InitCommandInputSchema, PackageManagerSchema, SchemaPresetSchema, create, createCreatePrismaCli, init, router };
|
package/package.json
CHANGED
|
@@ -1,6 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-prisma",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "Create and initialize Prisma 7 projects with first-party templates and great DX.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/prisma/create-prisma"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/prisma/create-prisma",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/prisma/create-prisma/issues"
|
|
12
|
+
},
|
|
13
|
+
"private": false,
|
|
14
|
+
"type": "module",
|
|
15
|
+
"bin": {
|
|
16
|
+
"create-prisma": "dist/cli.mjs"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.mjs",
|
|
19
|
+
"types": "./dist/index.d.mts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.mts",
|
|
23
|
+
"import": "./dist/index.mjs"
|
|
24
|
+
},
|
|
25
|
+
"./cli": {
|
|
26
|
+
"import": "./dist/cli.mjs"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"templates",
|
|
32
|
+
"README.md",
|
|
33
|
+
"CHANGELOG.md"
|
|
34
|
+
],
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=18.0.0",
|
|
37
|
+
"bun": ">=1.3.0"
|
|
38
|
+
},
|
|
39
|
+
"packageManager": "bun@1.3.9",
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsdown",
|
|
42
|
+
"dev": "tsdown --watch",
|
|
43
|
+
"start": "bun run ./dist/cli.mjs",
|
|
44
|
+
"typecheck": "tsc --noEmit",
|
|
45
|
+
"bump": "bun run scripts/bump-version.ts",
|
|
46
|
+
"release": "bun run bump",
|
|
47
|
+
"release-notes": "bunx changelogithub"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@clack/prompts": "^1.0.1",
|
|
51
|
+
"@orpc/server": "^1.13.5",
|
|
52
|
+
"execa": "^9.6.1",
|
|
53
|
+
"fs-extra": "^11.3.3",
|
|
54
|
+
"handlebars": "^4.7.8",
|
|
55
|
+
"trpc-cli": "^0.12.4",
|
|
56
|
+
"zod": "^4.3.6"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/bun": "^1.3.9",
|
|
60
|
+
"@types/fs-extra": "^11.0.4",
|
|
61
|
+
"@types/node": "^25.3.0",
|
|
62
|
+
"changelogithub": "^14.0.0",
|
|
63
|
+
"tsdown": "^0.20.3",
|
|
64
|
+
"typescript": "^5.9.3"
|
|
65
|
+
}
|
|
6
66
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# {{projectName}}
|
|
2
|
+
|
|
3
|
+
Generated by `create-prisma` with the Hono template.
|
|
4
|
+
|
|
5
|
+
## Scripts
|
|
6
|
+
|
|
7
|
+
{{#if (eq packageManager "bun")}}
|
|
8
|
+
- `bun run dev` - start local dev server
|
|
9
|
+
- `bun run build` - typecheck and compile
|
|
10
|
+
- `bun run start` - run compiled server from `dist/`
|
|
11
|
+
{{else}}
|
|
12
|
+
{{#if (eq packageManager "pnpm")}}
|
|
13
|
+
- `pnpm dev` - start local dev server
|
|
14
|
+
- `pnpm build` - typecheck and compile
|
|
15
|
+
- `pnpm start` - run compiled server from `dist/`
|
|
16
|
+
{{else}}
|
|
17
|
+
{{#if (eq packageManager "npm")}}
|
|
18
|
+
- `npm run dev` - start local dev server
|
|
19
|
+
- `npm run build` - typecheck and compile
|
|
20
|
+
- `npm run start` - run compiled server from `dist/`
|
|
21
|
+
{{else}}
|
|
22
|
+
- `npm run dev` or `pnpm dev` or `bun run dev` - start local dev server
|
|
23
|
+
- `npm run build` or `pnpm build` or `bun run build` - typecheck and compile
|
|
24
|
+
- `npm run start` or `pnpm start` or `bun run start` - run compiled server from `dist/`
|
|
25
|
+
{{/if}}
|
|
26
|
+
{{/if}}
|
|
27
|
+
{{/if}}
|
|
28
|
+
|
|
29
|
+
## Prisma
|
|
30
|
+
|
|
31
|
+
1. Make sure dependencies are installed.
|
|
32
|
+
2. Generate Prisma Client:
|
|
33
|
+
|
|
34
|
+
{{#if (eq packageManager "bun")}}
|
|
35
|
+
`bun run db:generate`
|
|
36
|
+
{{else}}
|
|
37
|
+
{{#if (eq packageManager "pnpm")}}
|
|
38
|
+
`pnpm db:generate`
|
|
39
|
+
{{else}}
|
|
40
|
+
{{#if (eq packageManager "npm")}}
|
|
41
|
+
`npm run db:generate`
|
|
42
|
+
{{else}}
|
|
43
|
+
`npm run db:generate` or `pnpm db:generate` or `bun run db:generate`
|
|
44
|
+
{{/if}}
|
|
45
|
+
{{/if}}
|
|
46
|
+
{{/if}}
|
|
47
|
+
|
|
48
|
+
3. Run your first migration:
|
|
49
|
+
|
|
50
|
+
{{#if (eq packageManager "bun")}}
|
|
51
|
+
`bun run db:migrate`
|
|
52
|
+
{{else}}
|
|
53
|
+
{{#if (eq packageManager "pnpm")}}
|
|
54
|
+
`pnpm db:migrate`
|
|
55
|
+
{{else}}
|
|
56
|
+
{{#if (eq packageManager "npm")}}
|
|
57
|
+
`npm run db:migrate`
|
|
58
|
+
{{else}}
|
|
59
|
+
`npm run db:migrate` or `pnpm db:migrate` or `bun run db:migrate`
|
|
60
|
+
{{/if}}
|
|
61
|
+
{{/if}}
|
|
62
|
+
{{/if}}
|
|
63
|
+
{{#if (eq schemaPreset "basic")}}
|
|
64
|
+
|
|
65
|
+
The template includes a basic `User` model and a sample `GET /users` endpoint.
|
|
66
|
+
{{/if}}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "tsx watch src/index.ts",
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"start": "tsx dist/src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@hono/node-server": "^1.19.9",
|
|
12
|
+
"hono": "^4.12.2"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/node": "^20.11.17",
|
|
16
|
+
"tsx": "^4.7.1",
|
|
17
|
+
"typescript": "^5.8.3"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { serve } from "@hono/node-server";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
{{#if (eq schemaPreset "basic")}}
|
|
4
|
+
import { prisma } from "../prisma";
|
|
5
|
+
{{/if}}
|
|
6
|
+
|
|
7
|
+
const app = new Hono();
|
|
8
|
+
|
|
9
|
+
app.get("/", (c) => {
|
|
10
|
+
return c.json({
|
|
11
|
+
message: "hello from create-prisma + hono",
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
{{#if (eq schemaPreset "basic")}}
|
|
15
|
+
|
|
16
|
+
app.get("/users", async (c) => {
|
|
17
|
+
const users = await prisma.user.findMany({
|
|
18
|
+
take: 10,
|
|
19
|
+
orderBy: {
|
|
20
|
+
createdAt: "desc",
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return c.json(users);
|
|
25
|
+
});
|
|
26
|
+
{{/if}}
|
|
27
|
+
|
|
28
|
+
const port = 3000;
|
|
29
|
+
serve({
|
|
30
|
+
fetch: app.fetch,
|
|
31
|
+
port,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
console.log(`Server running at http://localhost:${port}`);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"verbatimModuleSyntax": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"outDir": "dist",
|
|
12
|
+
"rootDir": "."
|
|
13
|
+
},
|
|
14
|
+
"include": ["src/**/*.ts", "prisma/**/*.ts", "prisma.config.ts"]
|
|
15
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# {{projectName}}
|
|
2
|
+
|
|
3
|
+
Generated by `create-prisma` with the Next.js template.
|
|
4
|
+
|
|
5
|
+
## Scripts
|
|
6
|
+
|
|
7
|
+
{{#if (eq packageManager "bun")}}
|
|
8
|
+
- `bun dev` - start local dev server
|
|
9
|
+
- `bun run build` - production build
|
|
10
|
+
- `bun run start` - run production server
|
|
11
|
+
{{else}}
|
|
12
|
+
{{#if (eq packageManager "pnpm")}}
|
|
13
|
+
- `pnpm dev` - start local dev server
|
|
14
|
+
- `pnpm build` - production build
|
|
15
|
+
- `pnpm start` - run production server
|
|
16
|
+
{{else}}
|
|
17
|
+
{{#if (eq packageManager "npm")}}
|
|
18
|
+
- `npm run dev` - start local dev server
|
|
19
|
+
- `npm run build` - production build
|
|
20
|
+
- `npm run start` - run production server
|
|
21
|
+
{{else}}
|
|
22
|
+
- `npm run dev` or `pnpm dev` or `bun dev` - start local dev server
|
|
23
|
+
- `npm run build` or `pnpm build` or `bun run build` - production build
|
|
24
|
+
- `npm run start` or `pnpm start` or `bun run start` - run production server
|
|
25
|
+
{{/if}}
|
|
26
|
+
{{/if}}
|
|
27
|
+
{{/if}}
|
|
28
|
+
|
|
29
|
+
## Prisma
|
|
30
|
+
|
|
31
|
+
Prisma setup is scaffolded automatically in:
|
|
32
|
+
|
|
33
|
+
- `prisma/schema.prisma`
|
|
34
|
+
- `prisma/index.ts`
|
|
35
|
+
- `prisma.config.ts`
|
|
36
|
+
|
|
37
|
+
Database helper scripts are added to `package.json`:
|
|
38
|
+
|
|
39
|
+
- `db:generate`
|
|
40
|
+
- `db:push`
|
|
41
|
+
- `db:migrate`
|
|
42
|
+
{{#if (eq schemaPreset "basic")}}
|
|
43
|
+
|
|
44
|
+
The starter page reads from a basic `User` model so you can verify queries quickly.
|
|
45
|
+
{{/if}}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
color-scheme: dark;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
* {
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
body {
|
|
10
|
+
margin: 0;
|
|
11
|
+
font-family: "Geist", ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
|
|
12
|
+
background: #0b0d10;
|
|
13
|
+
color: #e8edf2;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
main {
|
|
17
|
+
width: min(860px, 100%);
|
|
18
|
+
margin: 0 auto;
|
|
19
|
+
padding: 4rem 1.25rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
h1 {
|
|
23
|
+
margin: 0;
|
|
24
|
+
font-size: clamp(1.9rem, 4vw, 2.8rem);
|
|
25
|
+
letter-spacing: -0.02em;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
h2 {
|
|
29
|
+
margin-top: 2rem;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
p,
|
|
33
|
+
li {
|
|
34
|
+
line-height: 1.65;
|
|
35
|
+
color: #c7ced8;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ul {
|
|
39
|
+
padding-left: 1.15rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
code {
|
|
43
|
+
padding: 0.12rem 0.4rem;
|
|
44
|
+
border-radius: 6px;
|
|
45
|
+
background: #171b21;
|
|
46
|
+
color: #dbe5f4;
|
|
47
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Metadata } from "next";
|
|
2
|
+
import "./globals.css";
|
|
3
|
+
|
|
4
|
+
export const metadata: Metadata = {
|
|
5
|
+
title: "{{projectName}}",
|
|
6
|
+
description: "Generated by create-prisma",
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default function RootLayout({
|
|
10
|
+
children,
|
|
11
|
+
}: Readonly<{
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}>) {
|
|
14
|
+
return (
|
|
15
|
+
<html lang="en">
|
|
16
|
+
<body>{children}</body>
|
|
17
|
+
</html>
|
|
18
|
+
);
|
|
19
|
+
}
|