Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Dec 8, 2025

Description

Refs: Customer issue (Payabli)

Fixes an issue where package.json metadata (name, version, repository, private) was being lost during local TypeScript SDK generation when using non-self-hosted GitHub configuration with npm output. The customer's SDK went from having proper metadata to only having "name": "test-package".

Link to Devin run: https://app.devin.ai/sessions/18a5ef103b3e4a71a5a433cba9770f81
Requested by: Niels Swimberghe (@Swimburger)

Changes Made

  • Added a new code path in getPublishConfig to create a filesystem publishConfig with the publish target when a non-self-hosted github config has output info
  • Updated AbstractGeneratorCli.ts to fall back to publishConfig when constructNpmPackage returns undefined (e.g., in downloadFiles mode)
  • Extracted npmPackageInfoFromPublishConfig to its own module for better testability
  • Added handling for all three publishConfig types (github, direct, filesystem) in npmPackageInfoFromPublishConfig
  • Updated versions.yml for TypeScript SDK (3.39.3)

Root Cause

When running local generation (fern generate without mode flags), the output mode is downloadFiles. The getPublishConfig function was returning undefined for non-self-hosted github configs, even when they had output info with npm package details. This caused ir.publishConfig to be undefined, and the generator fell back to name: "test-package".

Updates Since Last Revision

  • Added comprehensive unit tests for npmPackageInfoFromPublishConfig covering:
    • GitHub publishConfig with npm target (including owner/repo and uri fallback)
    • Filesystem publishConfig with npm publishTarget
    • Direct publishConfig with npm target
    • Non-npm publish targets (maven, pypi)
    • Undefined publishConfig handling
    • License config preservation
    • isPackagePrivate flag handling
  • Refactored npmPackageInfoFromPublishConfig into its own file for better modularity
  • Fixed TypeScript compilation errors in tests (removed branch property not present in npm package version of @fern-fern/ir-sdk)

Human Review Checklist

  • Verify the fallback logic in AbstractGeneratorCli.ts for self-hosted IR scenarios (now falls back to constructNpmPackage if constructNpmPackageFromArgs returns undefined)
  • Check if the new code path in getPublishConfig handles edge cases correctly (e.g., what if github is set but output is not npm?)
  • Review the visitor pattern in getRepoUrl for handling different publishConfig types
  • Note: Tests use @fern-fern/ir-sdk@^61.7.0 which lacks branch property on GithubPublish (local packages/ir-sdk has it)

Testing

  • Lint checks pass (pnpm run check)
  • TypeScript compilation passes (pnpm run compile)
  • Unit tests added for npmPackageInfoFromPublishConfig (11 tests passing)
  • Manual testing with customer's configuration

…eration

When using non-self-hosted GitHub configuration with npm output, the
package.json metadata (name, version, repository, private) was being
lost during local TypeScript SDK generation.

The issue was that getPublishConfig returned undefined for non-self-hosted
github configs, causing the generator to fall back to 'test-package' as
the package name.

This fix:
1. Updates getPublishConfig to create a filesystem publishConfig with
   the publish target for non-self-hosted github configs with output info
2. Updates the TypeScript generator to fall back to publishConfig when
   the output mode doesn't provide npm package info

Co-Authored-By: Niels Swimberghe <[email protected]>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@Swimburger Swimburger closed this Dec 12, 2025
@Swimburger Swimburger deleted the devin/1765232321-fix-package-json-metadata branch December 12, 2025 18:59
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