Skip to content

Analyze build files for unused code#1346

Closed
fadi-george wants to merge 1 commit intomainfrom
cursor/analyze-build-files-for-unused-code-73f1
Closed

Analyze build files for unused code#1346
fadi-george wants to merge 1 commit intomainfrom
cursor/analyze-build-files-for-unused-code-73f1

Conversation

@fadi-george
Copy link
Copy Markdown
Contributor

@fadi-george fadi-george commented Aug 5, 2025

Description

1 Line Summary

Adds a detailed analysis of OneSignal SDK build files, identifying potential unused code and optimization opportunities.

Details

This PR introduces build/build.md, a new document containing a comprehensive analysis of the Dev-OneSignalSDK.page.js and Dev-OneSignalSDK.sw.js build outputs. The analysis identifies various categories of potentially unused or redundant code, such as:

  • Legacy Safari Push Support
  • Full Bowser Browser Detection Library
  • Multiple API Implementation Classes
  • Debug/Development Code (e.g., DebugNamespace, Log2)
  • Unused Subscription Types (Email, SMS)
  • TODO comments indicating incomplete features

The document also provides recommendations for code reduction and estimates potential bundle size savings, serving as a guide for future optimization efforts.

Systems Affected

  • WebSDK
  • Backend
  • Dashboard

Validation

Tests

Info

This PR only adds a documentation file (build/build.md) and does not modify any functional code. Therefore, no automated tests are applicable or required. The content of the markdown file is the primary output.

Checklist

  • All the automated tests pass or I explained why that is not possible: Explained why not possible.
  • I have personally tested this on my machine or explained why that is not possible: I have verified the build.md file content is as expected.
  • I have included test coverage for these changes or explained why they are not needed: Not needed as this is a documentation file.

Programming Checklist
Interfaces:

  • Don't use default export
  • New interfaces are in model files

Functions:

  • Don't use default export
  • All function signatures have return types
  • Helpers should not access any data but rather be given the data to operate on.

Typescript:

  • No Typescript warnings
  • Avoid silencing null/undefined warnings with the exclamation point

Other:

  • Iteration: refrain from using elem of array syntax. Prefer forEach or use map
  • Avoid using global OneSignal accessor for context if possible. Instead, we can pass it to function/constructor so that we don't call OneSignal.context

Screenshots

Info

Not applicable as this PR adds a markdown documentation file. The file itself is the output.

Checklist

  • I have included screenshots/recordings of the intended results or explained why they are not needed: Explained why not needed.

Related Tickets

N/A



Open in Cursor Open in Web

This change is Reviewable

@cursor
Copy link
Copy Markdown

cursor Bot commented Aug 5, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@fadi-george fadi-george closed this Aug 5, 2025
@fadi-george fadi-george deleted the cursor/analyze-build-files-for-unused-code-73f1 branch August 12, 2025 18:24
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