Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

fix job to publish ts sdk

Type of Change

  • Bug fix

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Oct 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs Building Building Preview Comment Oct 8, 2025 7:45am
sim Building Building Preview Comment Oct 8, 2025 7:45am

@waleedlatif1 waleedlatif1 merged commit 9d45b8d into staging Oct 8, 2025
3 of 5 checks passed
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

This PR fixes the TypeScript SDK publishing job by addressing module system compatibility issues in a monorepo environment. The changes convert the ts-sdk package from CommonJS to ES modules and fix dependency installation in the publishing workflow.

The core issue was a mismatch between the package's module system declarations and its actual configuration. The workflow fix changes the dependency installation step to run bun install from the repository root instead of the package directory, which is essential for proper workspace dependency resolution in monorepos. This follows the established pattern used in the publish-cli.yml workflow.

The package configuration changes ensure consistency across the module system: package.json now declares "type": "module", tsconfig.json compiles to ES2020 modules instead of CommonJS, and vitest.config.ts includes proper module resolution conditions for the testing environment. These changes align the TypeScript compilation output with the package's ES module declaration, ensuring compatibility with modern JavaScript environments and npm publishing requirements.

The ts-sdk package maintains backward compatibility through its dual export configuration, supporting both import and require statements while internally using ES modules. This fix resolves publishing pipeline failures that were preventing the SDK from being distributed to npm.

Changed Files
Filename Score Overview
.github/workflows/publish-ts-sdk.yml 4/5 Removes working directory constraint from dependency installation to fix monorepo workspace resolution
packages/ts-sdk/package.json 4/5 Adds ES module type declaration to match the package's module system configuration
packages/ts-sdk/tsconfig.json 4/5 Changes TypeScript compilation target from CommonJS to ES2020 modules for consistency
packages/ts-sdk/vitest.config.ts 4/5 Adds module resolution conditions to fix testing environment compatibility with ES modules

Confidence score: 4/5

  • This PR is safe to merge with low risk as it addresses clear module system compatibility issues
  • Score reflects well-coordinated changes across multiple files that work together to resolve the publishing problem
  • Pay attention to the workflow change to ensure it properly resolves workspace dependencies in the monorepo

Sequence Diagram

sequenceDiagram
    participant Dev as "Developer"
    participant Git as "Git Repository"
    participant GHA as "GitHub Actions"
    participant Bun as "Bun Runtime"
    participant Node as "Node.js"
    participant NPM as "NPM Registry"
    participant GitHub as "GitHub Releases"

    Dev->>Git: "Push changes to main branch"
    Note over Dev,Git: "Changes in packages/ts-sdk/**"
    
    Git->>GHA: "Trigger workflow: Publish TypeScript SDK"
    GHA->>GHA: "Checkout repository"
    GHA->>Bun: "Setup Bun (latest version)"
    GHA->>Node: "Setup Node.js v18 with npm registry"
    
    GHA->>Bun: "Install dependencies (bun install)"
    GHA->>Bun: "Run tests (bun run test)"
    Note over GHA,Bun: "Execute vitest in packages/ts-sdk"
    
    GHA->>Bun: "Build package (bun run build)"
    Note over GHA,Bun: "TypeScript compilation to dist/"
    
    GHA->>Node: "Get package version from package.json"
    Node->>GHA: "Return version (0.1.0)"
    
    GHA->>NPM: "Check if simstudio-ts-sdk@0.1.0 exists"
    NPM->>GHA: "Return existence status"
    
    alt Version doesn't exist
        GHA->>NPM: "Publish package (npm publish --access=public)"
        Note over GHA,NPM: "Using NODE_AUTH_TOKEN secret"
        NPM->>GHA: "Publish confirmation"
        
        GHA->>GitHub: "Create GitHub Release"
        Note over GHA,GitHub: "Tag: typescript-sdk-v0.1.0"
        GitHub->>GHA: "Release created"
    else Version already exists
        GHA->>GHA: "Log skipped publish message"
    end
Loading

Additional Comments (1)

  1. .github/workflows/publish-ts-sdk.yml, line 82 (link)

    logic: The README link points to 'simstudio/sim' but the actual repository is 'simstudioai/sim' - this will result in a broken documentation link

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

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