8000 fix: do not package `LinearWebhooks` in UMD module by guillaumelachaud · Pull Request #701 · linear/linear · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: do not package LinearWebhooks in UMD module #701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 13, 2025

Conversation

guillaumelachaud
Copy link
Contributor

The UMD module currently cannot be used in a browser directly as it imports nodejs's crypto module. This is used by LinearWebhooks to decode webhooks headers signatures when used in a nodejs context.

We could work with crypto-browserify and node-browserify polyfills to provide browser compatible version, but I'm not sure it's really worth it? The LinearWebhooks is meant to be used as an Express middleware, not in a browser environment. This PR provides a second entrypoint for rollup to build the UMD module without the LinearWebhooks export.

@charliecreates charliecreates bot requested a review from CharlieHelps May 12, 2025 22:00
Copy link
linear bot commented May 12, 2025

Copy link
changeset-bot bot commented May 12, 2025

🦋 Changeset detected

Latest commit: 64872cc

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

This PR includes changesets to release 1 package
Name Type
@linear/sdk 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

Copy link
@charliecreates charliecreates bot left a comment

Choose a reason for hiding this comment

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

The refactor effectively isolates LinearWebhooks from the UMD bundle, but the duplicated export lists in index.ts and index_umd.ts could lead to maintenance drift. Extracting shared exports into a common module would simplify future updates.

Additional notes (1)
  • Maintainability | packages/sdk/src/index_umd.ts:1-8
    There’s significant duplication between index.ts and index_umd.ts: they both list out the same core exports (minus webhooks). This can lead to drift and extra maintenance whenever you add or remove an export. Consider centralizing the shared exports in a new exports_base.ts and then re-exporting from it. This reduces duplication and makes it easier to keep both entrypoints in sync.
Summary of changes

Summary of Changes

  • Added a changeset (.changeset/cuddly-nights-leave.md) to document the patch release.
  • Modified rollup.config.js to switch the UMD build entry point from src/index.ts to a new src/index_umd.ts for both minified and non-minified outputs.
  • Updated src/index.ts to re-export everything from index_umd.ts and the ./webhooks module, removing the former flat export list.
  • Introduced a new src/index_umd.ts file that exports all core SDK components except LinearWebhooks (so that the UMD bundle has no dependency on Node’s crypto).

@charliecreates charliecreates bot removed the request for review from CharlieHelps May 12, 2025 22:01
@guillaumelachaud guillaumelachaud merged commit 426d39e into master May 13, 2025
2 checks passed
@guillaumelachaud guillaumelachaud deleted the gui/lin-36308-fix-sdk-umd-build branch May 13, 2025 20:54
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.

3 participants
0