Skip to content

Conversation

@Swimburger
Copy link
Member

Summary

Standardizes build scripts across all generator packages by consolidating disparate build approaches into a unified build.mjs system. This PR eliminates custom build.cjs files and direct tsup calls in favor of the centralized @fern-api/configs/build-utils.mjs utilities.

Changes

Build Script Standardization

  • Replaced custom builds with build.mjs files using buildGenerator() helper across:
    • C# (model, sdk)
    • Go v2 (model, sdk)
    • Java v2 (sdk)
    • PHP (model, sdk)
    • OpenAPI generator
    • Postman generator
    • Python v2 (codegen, model, sdk)
    • Ruby v2 (codegen, model, sdk)
    • Rust v2 (model, sdk)
    • Swift (codegen, model, sdk)
    • TypeScript MCP (model, sdk)

Dynamic Snippets Cleanup

  • Removed legacy build files (build.cjs) from dynamic-snippets packages:
    • C# dynamic-snippets
    • Go v2 dynamic-snippets
    • Java v2 dynamic-snippets
    • PHP dynamic-snippets
    • Python v2 dynamic-snippets
  • Removed dist scripts from dynamic-snippets package.json files
  • Cleaned up dependencies: Removed tsup, @esbuild-plugins/node-globals-polyfill, and @esbuild-plugins/node-modules-polyfill from packages that no longer need them

Base Package Cleanup

  • Removed unused scripts from base packages:
    • dist:cli and publish:cli scripts from go-v2/base, java-v2/base, and php/base
    • Removed tsup dependency from these base packages

Protoc-gen Package Cleanup

  • Removed unused build configuration from protoc-gen-fern:
    • Deleted build.tsconfig.json (custom TypeScript config for dist builds)
    • Removed dist script from package.json
    • Note: The dist script was creating a dist/cjs/ folder with compiled code. This was being incorrectly picked up by pnpm because it contained a dist/cjs/package.json, when it should have been using the root package.json instead. Since the script wasn't being used in the standard build flow, it was safe to remove.

Updated Build Commands

All affected package.json files now use:

"dist:cli": "node build.mjs"

Instead of inline tsup commands or custom build.cjs scripts.

Benefits

  1. Consistency: All generators now follow the same build pattern
  2. Maintainability: Build logic centralized in @fern-api/configs/build-utils.mjs
  3. Reduced duplication: Eliminated ~500+ lines of duplicated build code across packages
  4. Cleaner dependencies: Removed unused build dependencies from 15+ packages
  5. Easier updates: Future build improvements only require changes to the central utility

Testing

  • All existing tests continue to pass
  • Build commands (pnpm dist:cli, pnpm dockerTagLatest) work correctly for all affected generators
  • No changes to generated output or runtime behavior

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants