Skip to content

Conversation

Brooooooklyn
Copy link
Member

Description:

BREAKING CHANGE:

Related issue (if exists):

Copy link

changeset-bot bot commented Sep 13, 2025

⚠️ No Changeset found

Latest commit: 9bf70d8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

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

Copy link
Contributor

claude bot commented Sep 13, 2025

Claude finished @Brooooooklyn's task —— View job


PR Review: Fix npm publish workflow

I've completed my comprehensive review of this PR focusing on the npm publish workflow fix and NAPI-RS 3.0 upgrade.

Review Tasks:

  • Read repository guidelines (CLAUDE.md) - No repo-specific guidelines found
  • Review workflow file changes (.github/workflows/publish-npm-package.yml)
  • Analyze NAPI-RS 3.0 upgrade impact in bindings
  • Check package.json consistency across packages
  • Review Cargo.toml and lock file updates
  • Assess security and performance implications
  • Provide final recommendations

Code Quality & Architecture

The changes demonstrate solid technical decision-making:

Workflow Fix (Critical Fix):
The key change in publish-npm-package.yml:581 properly addresses the dual publishing issue:

(cd packages/${{ inputs.package }} && yarn workspaces foreach -Rt npm publish --tolerate-republish --tag $NPM_TAG)

This uses yarn workspaces foreach which correctly handles workspace-based publishing and avoids conflicts with napi prepublish.

NAPI-RS 3.0 Upgrade:

  • Clean migration from NAPI-RS 2.x to 3.x across all bindings
  • Updated napi, napi-derive, and napi-build dependencies consistently
  • Proper use of NAPI 3.0 APIs (e.g., bindgen_prelude, Task trait)

Security Assessment

No security concerns identified:

  • No secrets or sensitive data exposed
  • Provenance setting maintained: npm config set provenance true
  • Proper authentication flow with NPM_TOKEN and GITHUB_TOKEN
  • No unsafe Rust code patterns introduced

Performance Considerations

Performance impact is positive:

  • NAPI-RS 3.0 provides better performance and stability
  • Native binding loading improved in packages/minifier/src/binding.js with better error handling
  • Build optimizations maintained across all Cargo profiles

🔍 Potential Areas of Concern

  1. Large Scope: This PR combines workflow fixes with a major dependency upgrade (NAPI-RS 2→3). Consider splitting such changes in future.

  2. Test Coverage Gap: No explicit tests for the workflow changes. The author notes they cannot test publish CI.

  3. Missing Changeset: The changeset-bot correctly identifies no changeset was added. Since this fixes a CI issue rather than changing user-facing functionality, this may be intentional.


Code Consistency

Excellent consistency across the codebase:

  • All 70+ package.json files properly updated with version alignment
  • Cargo.toml workspace dependencies properly unified
  • NAPI-RS API usage consistent across all bindings
  • Build configurations maintained uniformly

📋 Recommendations

  1. Immediate Actions:

    • Ready to merge - the core fix addresses a critical publishing issue
    • Consider adding a changeset if this should trigger version bumps
    • Test the publish workflow on a staging environment if possible
  2. Future Improvements:

    • Split large upgrades (NAPI-RS) from workflow fixes in separate PRs
    • Add integration tests for publish workflows where feasible
    • Document the workspace publishing strategy
  3. Monitoring Post-Merge:

    • Watch the first publish after this change closely
    • Monitor for any binding loading issues across platforms
    • Verify provenance is properly set on published packages

🎯 Overall Assessment

✅ LGTM - Recommend Approval

This PR successfully addresses a critical npm publishing issue while cleanly upgrading to NAPI-RS 3.0. The technical execution is solid with proper error handling, security practices, and consistent implementation across the large codebase. The workflow fix using yarn workspaces foreach is the correct solution for the dual publishing problem.

The scope is large but the changes are methodical and well-executed. The author's note about needing testing is valid - this should be carefully monitored in the first publish cycle.


Copy link

socket-security bot commented Sep 13, 2025

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

Copy link

codspeed-hq bot commented Sep 13, 2025

CodSpeed Performance Report

Merging #11088 will not alter performance

Comparing fix-npm-publish (9bf70d8) with main (6b381c9)1

Summary

✅ 140 untouched

Footnotes

  1. No successful run was found on main (78e69b1) during the generation of this report, so 6b381c9 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@Brooooooklyn Brooooooklyn marked this pull request as ready for review September 13, 2025 08:14
@Brooooooklyn Brooooooklyn requested a review from a team as a code owner September 13, 2025 08:14
@kdy1 kdy1 added this to the Planned milestone Sep 13, 2025
@Brooooooklyn Brooooooklyn requested a review from a team as a code owner September 13, 2025 12:33
@Brooooooklyn
Copy link
Member Author

@kdy1 This should resolve the publishing issue. The root cause was that SWC added npm/* to the Yarn workspaces, which caused dual publishing with the napi prepublish command.

I’m unable to test the publish CI, so if you want to merge it, please ensure the publish CI has been tested beforehand.

@kdy1
Copy link
Member

kdy1 commented Sep 13, 2025

Thank you so much! I’ll take a look when I have some time.

swc_html_minifier = "32.0.0"
swc_malloc = "1.2.3"
swc_nodejs_common = "1.0.2"
swc_atoms = { path = "../crates/swc_atoms" }
Copy link
Member

Choose a reason for hiding this comment

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

Can you revert these changes? This breaks nodejs

Copy link
Member Author

Choose a reason for hiding this comment

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

I can't upgrade NAPI-RS independently in bindings/* because the crates/* also depend on napi and napi-derive.

Copy link
Member

Choose a reason for hiding this comment

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

I'll fix it

Copy link
Member

Choose a reason for hiding this comment

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

Thank you anyway!

@kdy1 kdy1 merged commit ae2ae30 into main Sep 15, 2025
181 checks passed
@kdy1 kdy1 deleted the fix-npm-publish branch September 15, 2025 02:53
@github-actions github-actions bot modified the milestones: Planned, 1.13.7 Sep 19, 2025
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