@superinterface/server 1.0.4 → 1.0.6
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/fallback-build-manifest.json +2 -2
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +1 -1
- package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__27aadac9._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__27aadac9._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__29635e8e._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__29635e8e._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__315f084a._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__315f084a._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__3ba06f7c._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__441cee00._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__441cee00._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__464a4377._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__464a4377._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__51977f30._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__51977f30._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__5abf1160._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__5abf1160._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__5d09614a._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__5d09614a._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__62d958e7._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__62d958e7._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__7f9ca1e3._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__7f9ca1e3._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__83461316._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__83461316._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__9a611d42._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__9a611d42._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__a135e388._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__a135e388._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__c1629392._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__c1629392._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__eb816e13._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__eb816e13._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__09232d18._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__09232d18._.js.map +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__55cc8360._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__55cc8360._.js.map +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/trace +1 -1
- package/package.json +3 -2
- package/scripts/cli.ts +15 -0
- package/scripts/commands/prisma/deploy.ts +69 -0
- package/scripts/utils/loadPrisma.ts +76 -2
- /package/.next/static/{ro-bqrOxJSYzN3cJJHXYf → eIqLpUWXibF0G0ipW0IC-}/_buildManifest.js +0 -0
- /package/.next/static/{ro-bqrOxJSYzN3cJJHXYf → eIqLpUWXibF0G0ipW0IC-}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{ro-bqrOxJSYzN3cJJHXYf → eIqLpUWXibF0G0ipW0IC-}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process'
|
|
2
|
+
import { createRequire } from 'node:module'
|
|
3
|
+
import process from 'node:process'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
1
5
|
import type { PrismaClient } from '@prisma/client'
|
|
2
6
|
import { CliError } from './errors'
|
|
3
7
|
|
|
@@ -10,6 +14,12 @@ type PrismaModule = {
|
|
|
10
14
|
prisma?: PrismaClient
|
|
11
15
|
}
|
|
12
16
|
|
|
17
|
+
const packageRoot = fileURLToPath(new URL('../..', import.meta.url))
|
|
18
|
+
const schemaPath = fileURLToPath(
|
|
19
|
+
new URL('../../prisma/schema.prisma', import.meta.url),
|
|
20
|
+
)
|
|
21
|
+
const nodeRequire = createRequire(import.meta.url)
|
|
22
|
+
|
|
13
23
|
const isModuleNotFoundError = (error: unknown, modulePath: string) => {
|
|
14
24
|
if (!(error instanceof Error)) return false
|
|
15
25
|
|
|
@@ -30,10 +40,61 @@ const isModuleNotFoundError = (error: unknown, modulePath: string) => {
|
|
|
30
40
|
)
|
|
31
41
|
}
|
|
32
42
|
|
|
43
|
+
const isPrismaClientNotGeneratedError = (error: unknown) => {
|
|
44
|
+
if (!(error instanceof Error)) return false
|
|
45
|
+
return /prisma\s+client\s+did\s+not\s+initialize|Please\s+run\s+"prisma\s+generate"/i.test(
|
|
46
|
+
error.message,
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const generatePrismaClient = async () => {
|
|
51
|
+
let prismaCliPath: string
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
prismaCliPath = nodeRequire.resolve('prisma/build/index.js', {
|
|
55
|
+
paths: [packageRoot],
|
|
56
|
+
})
|
|
57
|
+
} catch (error) {
|
|
58
|
+
throw new CliError(
|
|
59
|
+
'Unable to resolve Prisma CLI. Install `prisma` dependency.',
|
|
60
|
+
{
|
|
61
|
+
cause: error,
|
|
62
|
+
},
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
await new Promise<void>((resolve, reject) => {
|
|
67
|
+
const child = spawn(
|
|
68
|
+
process.execPath,
|
|
69
|
+
[prismaCliPath, 'generate', '--schema', schemaPath],
|
|
70
|
+
{
|
|
71
|
+
cwd: packageRoot,
|
|
72
|
+
stdio: 'inherit',
|
|
73
|
+
env: process.env,
|
|
74
|
+
},
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
child.once('error', (error) => {
|
|
78
|
+
reject(new CliError('Failed to run `prisma generate`.', { cause: error }))
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
child.once('exit', (code) => {
|
|
82
|
+
if (typeof code === 'number' && code !== 0) {
|
|
83
|
+
reject(new CliError(`prisma generate exited with code ${code}.`))
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
resolve()
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
|
|
33
92
|
export const loadPrismaClient = async (): Promise<PrismaClient> => {
|
|
34
93
|
let lastError: unknown
|
|
94
|
+
let attemptedGenerate = false
|
|
35
95
|
|
|
36
|
-
for (
|
|
96
|
+
for (let index = 0; index < prismaModuleCandidates.length; index += 1) {
|
|
97
|
+
const candidate = prismaModuleCandidates[index]
|
|
37
98
|
try {
|
|
38
99
|
const module = (await import(candidate)) as PrismaModule
|
|
39
100
|
if (module?.prisma) {
|
|
@@ -44,6 +105,19 @@ export const loadPrismaClient = async (): Promise<PrismaClient> => {
|
|
|
44
105
|
`Module "${candidate}" does not export a prisma client.`,
|
|
45
106
|
)
|
|
46
107
|
} catch (error) {
|
|
108
|
+
if (isPrismaClientNotGeneratedError(error)) {
|
|
109
|
+
if (attemptedGenerate) {
|
|
110
|
+
throw new CliError('Prisma client failed to initialize.', {
|
|
111
|
+
cause: error,
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
await generatePrismaClient()
|
|
116
|
+
attemptedGenerate = true
|
|
117
|
+
index -= 1
|
|
118
|
+
continue
|
|
119
|
+
}
|
|
120
|
+
|
|
47
121
|
if (isModuleNotFoundError(error, candidate)) {
|
|
48
122
|
lastError = error
|
|
49
123
|
continue
|
|
@@ -54,7 +128,7 @@ export const loadPrismaClient = async (): Promise<PrismaClient> => {
|
|
|
54
128
|
}
|
|
55
129
|
|
|
56
130
|
throw new CliError(
|
|
57
|
-
'Prisma client module not found. Run `npm run build:lib` before using this command.',
|
|
131
|
+
'Prisma client module not found. Run `prisma generate` (after `npm run build:lib`) before using this command.',
|
|
58
132
|
{ cause: lastError },
|
|
59
133
|
)
|
|
60
134
|
}
|
|
File without changes
|
/package/.next/static/{ro-bqrOxJSYzN3cJJHXYf → eIqLpUWXibF0G0ipW0IC-}/_clientMiddlewareManifest.json
RENAMED
|
File without changes
|
|
File without changes
|