fix: include migration files in @paperclipai/db and improve server error msg
- db build now copies src/migrations/ to dist/migrations/ after tsc,
so SQL + meta JSON files are included in the published package.
Without this, `import("@paperclipai/server")` fails at runtime with
ENOENT when scanning for migration files.
- CLI's importServerEntry() now distinguishes between "module not found"
and "server crashed during startup" for clearer error messages.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -106,9 +106,15 @@ async function importServerEntry(): Promise<void> {
|
|||||||
try {
|
try {
|
||||||
await import("@paperclipai/server");
|
await import("@paperclipai/server");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (isModuleNotFoundError(err)) {
|
||||||
|
throw new Error(
|
||||||
|
`Could not locate a Paperclip server entrypoint.\n` +
|
||||||
|
`Tried: ${devEntry}, @paperclipai/server\n` +
|
||||||
|
`${formatError(err)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Could not locate a Paperclip server entrypoint.\n` +
|
`Paperclip server failed to start.\n` +
|
||||||
`Tried: ${devEntry}, @paperclipai/server\n` +
|
|
||||||
`${formatError(err)}`,
|
`${formatError(err)}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc && cp -r src/migrations dist/migrations",
|
||||||
"clean": "rm -rf dist",
|
"clean": "rm -rf dist",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"generate": "tsc -p tsconfig.json && drizzle-kit generate",
|
"generate": "tsc -p tsconfig.json && drizzle-kit generate",
|
||||||
|
|||||||
Reference in New Issue
Block a user