Skip to content

fix(typegen): move fmdapi/fmodata from optional peerDeps to dependencies#200

Merged
eluce2 merged 3 commits intoproofsh:mainfrom
chriscors:fix/typegen-optional-peer-deps
Mar 23, 2026
Merged

fix(typegen): move fmdapi/fmodata from optional peerDeps to dependencies#200
eluce2 merged 3 commits intoproofsh:mainfrom
chriscors:fix/typegen-optional-peer-deps

Conversation

@chriscors
Copy link
Copy Markdown
Collaborator

@chriscors chriscors commented Mar 21, 2026

Bug

Running npx @proofkit/typegen (v1.1.0-beta.21) fails immediately with:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@proofkit/fmodata'

Root cause

In the published typegen package, @proofkit/fmdapi and @proofkit/fmodata are declared as optional peer dependencies (with peerDependenciesMeta.optional: true). They are also listed in devDependencies, which means they're available during local development and CI — but are not included when a user installs the package.

When npx runs typegen, it creates an isolated environment and installs only dependencies. Optional peer dependencies are not auto-installed, so both @proofkit/fmdapi and @proofkit/fmodata are missing at runtime.

However, both packages are imported unconditionally via static import statements:

  • src/fmodata/downloadMetadata.tsimport { FMServerConnection } from "@proofkit/fmodata"
  • src/server/createDataApiClient.tsimport { Database, FMServerConnection } from "@proofkit/fmodata"
  • src/fmodata/generateODataTypes.ts → generates code referencing @proofkit/fmodata

These imports are pulled in through the main typegen.ts entry point, meaning the CLI crashes on startup before any user code runs — regardless of whether the user's project actually uses fmodata.

Fix

Moved @proofkit/fmdapi and @proofkit/fmodata from optional peerDependencies + devDependencies into regular dependencies. This ensures they are always installed alongside typegen, matching the fact that they are unconditionally imported at runtime.

Removed the now-unnecessary peerDependencies and peerDependenciesMeta sections entirely.

Test plan

  • Built all three packages (fmdapi, fmodata, typegen)
  • Packed tarballs and installed into an isolated /tmp directory to simulate npx behavior
  • Verified npx typegen --help runs successfully without ERR_MODULE_NOT_FOUND

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue causing the typegen command to fail with a module-not-found error when run via npx; required modules are now bundled so typegen runs reliably.
  • Chores
    • Published as a patch release with dependency adjustments to ensure the typegen tool works out of the box.

When run via npx, the isolated environment doesn't auto-install optional
peer dependencies, causing ERR_MODULE_NOT_FOUND for @proofkit/fmodata.
Both packages are imported unconditionally at runtime, so they must be
regular dependencies.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 21, 2026

🦋 Changeset detected

Latest commit: dc9b29a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@proofkit/typegen Patch
@proofkit/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 21, 2026

@chriscors is attempting to deploy a commit to the Proof Geist Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 21, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 76e5a9d4-0f1b-4457-88d2-69ceb2c6d60f

📥 Commits

Reviewing files that changed from the base of the PR and between 0643ddd and dc9b29a.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • packages/typegen/package.json

📝 Walkthrough

Walkthrough

@proofkit/fmdapi and @proofkit/fmodata were moved from peer/dev dependencies into dependencies in packages/typegen/package.json; a patch changeset documenting the dependency change was added and @tanstack/intent was added to devDependencies.

Changes

Cohort / File(s) Summary
Package manifest
packages/typegen/package.json
Moved @proofkit/fmdapi and @proofkit/fmodata out of peerDependencies, peerDependenciesMeta, and devDependencies into runtime dependencies ("workspace:*"). Added @tanstack/intent (^0.0.19) to devDependencies.
Release metadata
.changeset/fix-typegen-optional-peer-deps.md
Added a patch changeset for @proofkit/typegen describing the dependency move to fix runtime module resolution when running typegen (e.g., via npx).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Version Packages #33 — Updates packages/typegen/package.json dependency declarations for @proofkit/fmdapi, related to dependency handling changes.
  • Make typegen peers optional #198 — Adjusts @proofkit/typegen handling of @proofkit/fmodata/@proofkit/fmdapi (makes their import lazy), addressing similar runtime availability concerns.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: moving fmdapi/fmodata from optional peer dependencies to regular dependencies in the typegen package.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chriscors chriscors requested a review from eluce2 March 21, 2026 10:54
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 21, 2026

Open in StackBlitz

@proofkit/better-auth

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/better-auth@200

@proofkit/cli

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/cli@200

create-proofkit

pnpm add https://pkg.pr.new/proofgeist/proofkit/create-proofkit@200

@proofkit/fmdapi

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/fmdapi@200

@proofkit/fmodata

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/fmodata@200

@proofkit/typegen

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/typegen@200

@proofkit/webviewer

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/webviewer@200

commit: 0643ddd

- Move entry-point guidance to package-specific skills
- Drop obsolete typegen skill and bin export
- Refresh skill tree and changelog
@eluce2 eluce2 merged commit 034caf4 into proofsh:main Mar 23, 2026
4 of 6 checks passed
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.

2 participants