diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 224a1e43..2831d643 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -226,6 +226,13 @@ jobs: - name: Build mcp run: pnpm --filter @docmost/mcp build + # apps/server imports @docmost/token-estimate at runtime (history-budget.ts, + # #490); its dist/ is gitignored and `test:e2e` type-checks + runs the code, + # so build it here or tsc fails with TS2307 Cannot find module + # '@docmost/token-estimate' (mirrors the editor-ext / mcp build steps above). + - name: Build token-estimate + run: pnpm --filter @docmost/token-estimate build + - name: Run migrations run: pnpm --filter ./apps/server migration:latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 509ad6be..fef6b189 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -159,6 +159,14 @@ jobs: - name: Build prosemirror-markdown run: pnpm --filter @docmost/prosemirror-markdown build + # @docmost/token-estimate is a shared workspace package the client vitest + # suite resolves via its dist build (main: ./dist/index.js); dist/ is + # gitignored and `pnpm -r test` does NOT honour nx `dependsOn: ^build`, so + # build it before the recursive test run or the client suite fails with + # "Failed to resolve import '@docmost/token-estimate'" (#490). + - name: Build token-estimate + run: pnpm --filter @docmost/token-estimate build + - name: Run unit tests run: pnpm -r test diff --git a/Dockerfile b/Dockerfile index 280e5b55..792bf0e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,6 +59,14 @@ COPY --from=builder /app/packages/mcp/data /app/packages/mcp/data COPY --from=builder /app/packages/prosemirror-markdown/build /app/packages/prosemirror-markdown/build COPY --from=builder /app/packages/prosemirror-markdown/package.json /app/packages/prosemirror-markdown/package.json +# apps/server imports @docmost/token-estimate (workspace:*) at runtime +# (history-budget.ts, #490). tsc emits only dist/ and dist/ is gitignored, so the +# prod install would resolve a broken workspace symlink and the server would die +# with ERR_MODULE_NOT_FOUND on the first history-budget call. Ship the built +# package + its manifest, mirroring prosemirror-markdown above. +COPY --from=builder /app/packages/token-estimate/dist /app/packages/token-estimate/dist +COPY --from=builder /app/packages/token-estimate/package.json /app/packages/token-estimate/package.json + # Copy root package files COPY --from=builder /app/package.json /app/package.json COPY --from=builder /app/pnpm*.yaml /app/