Skip to content

Conversation

@Uzlopak
Copy link
Contributor

@Uzlopak Uzlopak commented Jul 27, 2025

removes 7 MB of dependencies

@koush koush requested a review from Copilot September 3, 2025 15:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the date-fns dependency from the webrtc and dtls packages to reduce the bundle size by 7 MB. The dependency was only used for adding years to dates in certificate generation.

  • Removes date-fns from package.json dependencies in both webrtc and dtls packages
  • Replaces addYears function call with native JavaScript date manipulation

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/webrtc/package.json Removes date-fns dependency from webrtc package
packages/dtls/package.json Removes date-fns dependency from dtls package
packages/dtls/src/context/cipher.ts Replaces date-fns addYears function with native Date operations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

name: "C=AU, ST=Some-State, O=Internet Widgits Pty Ltd",
notBefore: new Date(),
notAfter: addYears(Date.now(), 10),
notAfter: new Date(new Date().setFullYear(new Date().getFullYear() + 10)),
Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

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

Creating multiple Date objects is inefficient. Consider creating a single Date object and reusing it: const now = new Date(); notAfter: new Date(now.setFullYear(now.getFullYear() + 10))

Suggested change
notAfter: new Date(new Date().setFullYear(new Date().getFullYear() + 10)),
notAfter: (() => { const now = new Date(); const after = new Date(now); after.setFullYear(now.getFullYear() + 10); return after; })(),

Copilot uses AI. Check for mistakes.
@koush koush merged commit 3028493 into shinyoshiaki:develop Sep 3, 2025
1 check passed
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