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:
Dotta
2026-03-03 15:30:50 -06:00
parent 4e9c1d83be
commit fa4a40ebc3
2 changed files with 9 additions and 3 deletions

View File

@@ -106,9 +106,15 @@ async function importServerEntry(): Promise<void> {
try {
await import("@paperclipai/server");
} 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(
`Could not locate a Paperclip server entrypoint.\n` +
`Tried: ${devEntry}, @paperclipai/server\n` +
`Paperclip server failed to start.\n` +
`${formatError(err)}`,
);
}

View File

@@ -25,7 +25,7 @@
"dist"
],
"scripts": {
"build": "tsc",
"build": "tsc && cp -r src/migrations dist/migrations",
"clean": "rm -rf dist",
"typecheck": "tsc --noEmit",
"generate": "tsc -p tsconfig.json && drizzle-kit generate",