Skip to content

fix(build): align Next.js, Docusaurus, and Node TS builds across the monorepo - #343

Open
vijay11149 wants to merge 1 commit into
Adamantine-guild:mainfrom
vijay11149:fix/build-compatibility-monorepo
Open

fix(build): align Next.js, Docusaurus, and Node TS builds across the monorepo#343
vijay11149 wants to merge 1 commit into
Adamantine-guild:mainfrom
vijay11149:fix/build-compatibility-monorepo

Conversation

@vijay11149

Copy link
Copy Markdown

Description

This PR audits and repairs build compatibility across the three build systems in the monorepo (Next.js 14, Docusaurus 3, and the Node.js TypeScript services), resolves the Docusaurus v3 deprecation warning, fixes the dashboard's monorepo-package transpilation, and makes apps/access-api emit a correct, runnable ESM build. It also adds a single source of truth for dependency versions (VERSIONS.md) and a CI workflow that builds every app across Node 18 and 20 so future major-version drift is caught automatically.

The headline fix is a previously-silent next build failure: the dashboard tsconfig.json mapped @guildpass/env to its raw TypeScript source, whose NodeNext .js-extension imports webpack cannot resolve. The workspace packages already ship compiled dist, so the dashboard now resolves them through their exports.

Linked Issue

Closes #342

Type of Change

  • 🐛 Bug fix
  • 📝 Documentation update
  • 🔧 Chore / refactor
  • 🧪 Tests only (minor: corrected two test call signatures)

Changes Made

Docusaurus (deprecation)

  • apps/docs/docusaurus.config.js — migrated onBrokenMarkdownLinks from the deprecated root-level option to the v3.9+ markdown.hooks.onBrokenMarkdownLinks form.

Next.js dashboard (transpilation)

  • apps/dashboard/next.config.mjs — added @guildpass/metrics to transpilePackages (its entry is index.ts).
  • apps/dashboard/tsconfig.json — removed the @guildpass/env (and unused @guildpass/integration-client/*, @guildpass/mock-repositories) paths mappings that pointed at TypeScript source. Packages now resolve via their compiled exports.

access-api (TypeScript / ESM / build output)

  • apps/access-api/tsconfig.jsontarget: ES2022, rootDir: "src", include: ["src"]. Previously rootDir: "." emitted dist/src/index.js while pnpm start and the Dockerfile expect dist/index.js.
  • apps/access-api/prisma/schema.prisma — added the previousState column on ProcessedEvent and the FailedEvent model that src/workers/indexer.ts already referenced (this was blocking tsc).
  • apps/access-api/src/utils/backfill-lock.ts — removed an incorrect liveHead: Date | null annotation (the column is BigInt?).
  • apps/access-api/src/workers/indexer.ts — annotated applyEventApplication's return type so the previousState write type-checks.
  • apps/access-api/README.md — new "TypeScript, ESM & Node.js" section clarifying it is a plain Node http server (not Fastify), targets Node 18+, and emits dist/index.js.

Tests (typecheck blockers)

  • apps/dashboard/test/activity-hash-chain.test.ts and activity-hash-chain-durable.test.ts — passed the required guildId argument to DurableActivityRepository.append().

Version + CI documentation

  • VERSIONS.md (new) — Node/pnpm/TypeScript/app framework matrix plus an update policy for major versions.
  • .github/workflows/ci.yml (new) — [18.x, 20.x] matrix running install → prisma generate → build packages → typecheck → build apps.
  • README.md, CONTRIBUTING.md — prerequisites now link to VERSIONS.md.

Lint (small, pre-existing)

  • eslint.config.js — registered Node 18+ Web/fetch globals (Response, fetch, …) so the .js tests lint correctly.
  • packages/integration-client/src/contracts/contract.types.ts — replaced an empty interface with a type alias.
  • apps/discord-bot — removed one unused import, one unused helper, and a letconst.

Test Evidence

$ pnpm typecheck
apps/docs typecheck: No TypeScript typecheck for docs site yet
packages/contracts typecheck: Done
packages/env typecheck: Done
packages/integration-client typecheck: Done
packages/webhook-utils typecheck: Done
apps/access-api typecheck: Done
apps/dashboard typecheck: Done
apps/discord-bot typecheck: Done
$ pnpm -r --filter "./packages/*" build
packages/contracts build: Done
packages/env build: Done
packages/integration-client build: Done
packages/webhook-utils build: Done
$ pnpm -r --filter "./apps/*" build
apps/access-api build: Done
apps/discord-bot build: Done
apps/docs build: [SUCCESS] Generated static files in "build".   # no deprecation warnings
apps/dashboard build: ✓ Generating static pages (27/27)         # Next.js build succeeds
$ ls apps/access-api/dist
index.d.ts  index.js  index.js.map  services/  utils/  workers/   # dist/index.js (not dist/src/)

Checklist

  • I have read CONTRIBUTING.md
  • This PR is linked to an open issue
  • pnpm typecheck passes with no errors
  • pnpm lint passes (or issues are pre-existing and documented) — see Additional Notes
  • pnpm test passes (all existing tests still pass) — see Additional Notes
  • The dashboard starts and renders correctly (if UI or API code changed) — verified via next build
  • The Discord bot still starts and responds to commands (if bot code changed) — verified via tsc
  • Docs site renders correctly (if docs changed): pnpm build:docs
  • No secrets, tokens, or API keys are included in this PR
  • Environment variable changes are reflected in .env.example (no env changes)
  • I have updated documentation if new behaviour was introduced

Screenshots / Recordings

N/A — build/CI changes only; terminal evidence above.

Additional Notes

Pre-existing issues intentionally left out of this PR (not build-compatibility, and unrelated to #342):

  1. pnpm lint still reports 26 pre-existing errors in apps/dashboard (unused imports/variables, prefer-const, one no-useless-assignment) spread across ~15 files. This PR fixed the same class of trivial errors in integration-client and discord-bot, but the dashboard debt is large enough to warrant its own cleanup. CI is scoped to typecheck + build, which is what this issue's acceptance criteria require.

  2. pnpm test requires a live Postgres. apps/access-api/test/leader-election.test.ts (and the durable-hash-chain dashboard tests) instantiate a real PrismaClient/pg pool and fail on DATABASE_URL not found, despite the access-api README claiming tests are "fully mocked". Wiring a Postgres service into CI (plus migrations) is a separate follow-up.

Note on Fastify: the issue title mentions Fastify, but apps/access-api does not use it — it's a plain Node http server. VERSIONS.md and the access-api README now state this explicitly so the misconception doesn't propagate.

…monorepo

- Migrate Docusaurus onBrokenMarkdownLinks to markdown.hooks (v3 deprecation)
- Fix dashboard monorepo-package transpilation by removing the @guildpass/env
  source path mapping and adding @guildpass/metrics to transpilePackages
- Emit apps/access-api dist/index.js (ES2022, rootDir src) and document its
  Node http + ESM setup
- Add the previousState column and FailedEvent model referenced by the indexer
  so access-api type-checks and builds
- Document Node/pnpm/TypeScript/app versions in VERSIONS.md and add a
  Node 18/20 build matrix to CI

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@Lakes41

Lakes41 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

This PR cannot be merged automatically because one or more workflow checks failed.

Please review the failed checks, push a fix, and wait for the workflows to pass.

After the checks pass and there are no merge conflicts, the automation can review it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Audit and fix Next.js, Docusaurus, and Fastify build compatibility in monorepo

2 participants