Skip to content
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

📝 [RUM-158] Add jscdoc to public APIs #2775

Merged
merged 5 commits into from
May 28, 2024

Conversation

amortemousque
Copy link
Contributor

Motivation

JSDoc annotations are visible through the IDE, providing developers with immediate and comprehensive documentation as they integrate with our SDK.

Changes

  • Document all public APIs
  • Add links to the public doc in browser SDK warnings when useful

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@amortemousque amortemousque requested a review from a team as a code owner May 23, 2024 10:31
@codecov-commenter
Copy link

codecov-commenter commented May 23, 2024

Codecov Report

Attention: Patch coverage is 92.85714% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 93.33%. Comparing base (5cf9e60) to head (f956c13).
Report is 8 commits behind head on main.

Files Patch % Lines
packages/logs/src/boot/logsPublicApi.ts 87.50% 1 Missing ⚠️
packages/rum-core/src/boot/rumPublicApi.ts 93.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2775   +/-   ##
=======================================
  Coverage   93.33%   93.33%           
=======================================
  Files         242      242           
  Lines        7077     7077           
  Branches     1562     1562           
=======================================
  Hits         6605     6605           
  Misses        472      472           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@BenoitZugmeyer BenoitZugmeyer left a comment

Choose a reason for hiding this comment

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

When:

  • running yarn build
  • then opening test/app/app.ts in your IDE
  • then hovering datadogRum.init or datadogRum.setUser

Do you have the documentation showing up? I don't, and I think this is because typescript drops JSDoc comments in the output .d.ts files in our case.

I managed to make them appear by declaring RumPublicApi explicitely: instead of

type RumPublicApi = ReturnType<typeof makeRumPublicApi>

we might have to do:

interface RumPublicApi {
  /**
   * doc
   */
  init(...): void
  // etc.
}
function makeRumPublicApi(...): RumPublicApi {}

It might be a bit more verbose as we need to repeat function signatures in that type, but it should offer a nicer developer experience.

packages/core/src/domain/configuration/tags.ts Outdated Show resolved Hide resolved
Copy link

cit-pr-commenter bot commented May 27, 2024

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 158.27 KiB 158.41 KiB 139 B +0.09%
Logs 56.42 KiB 56.58 KiB 163 B +0.28%
Rum Slim 104.76 KiB 104.91 KiB 152 B +0.14%
Worker 25.21 KiB 25.21 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
adderror 0.032 N/A N/A
addaction 0.016 N/A N/A
logmessage 0.005 N/A N/A
startview 0.868 N/A N/A
startstopsessionreplayrecording 0.690 N/A N/A
addtiming 0.001 N/A N/A
addglobalcontext 0.002 N/A N/A

@amortemousque amortemousque merged commit f551f53 into main May 28, 2024
20 checks passed
@amortemousque amortemousque deleted the aymeric/js-doc-on-public-api branch May 28, 2024 07:08
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.

4 participants