furniture-3d-system-Wu/furniture-3d-system/scripts/check-prisma-client-sync.js
WuYongJie 5821d73291 初始提交:3D家具安装展示系统
包含:
- furniture-3d-system:Next.js 16 全栈应用(资产中心、产品管理、3D装配动画)
- autocad-plugin:AutoCAD 家具导出插件源码
- 资产中心改造:编辑弹窗化、删除功能、Toast反馈、自定义Select组件

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 14:00:19 +08:00

38 lines
1.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const path = require('path')
function fail(message) {
console.error(`[prisma-check] ${message}`)
process.exit(1)
}
let prismaModulePath
let Prisma
try {
prismaModulePath = require.resolve('@prisma/client')
;({ Prisma } = require('@prisma/client'))
} catch (error) {
fail(`无法加载 @prisma/client:${error instanceof Error ? error.message : String(error)}`)
}
const panelScalarFields = Prisma?.PanelScalarFieldEnum
if (!panelScalarFields || typeof panelScalarFields !== 'object') {
fail('未找到 PanelScalarFieldEnum,请先执行 npm run prisma:generate')
}
if (!Object.prototype.hasOwnProperty.call(panelScalarFields, 'assemblySemantic')) {
fail(
[
'检测到 Prisma Client 与 schema 不一致:缺少 Panel.assemblySemantic 字段。',
'请先执行:npm run prisma:generate',
`当前加载路径:${prismaModulePath}`,
].join(' '),
)
}
console.log(
`[prisma-check] ok: Panel.assemblySemantic 已存在(@prisma/client: ${path.normalize(
prismaModulePath,
)})`,
)