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

Write TSDoc to document frontend fields #4025

Closed
dhruvkb opened this issue Apr 3, 2024 · 2 comments · Fixed by #4313
Closed

Write TSDoc to document frontend fields #4025

dhruvkb opened this issue Apr 3, 2024 · 2 comments · Fixed by #4313
Assignees
Labels
📄 aspect: text Concerns the textual material in the repository ✨ goal: improvement Improvement to an existing user-facing feature 🟨 priority: medium Not blocking but should be addressed soon 🧱 stack: frontend Related to the Nuxt frontend ⌨️ tech: typescript Involves TypeScript

Comments

@dhruvkb
Copy link
Member

dhruvkb commented Apr 3, 2024

Description

For fields with complications, or edge cases, or noteworthy details, write descriptions in the frontend interfaces that can be parsed by the documentation generation script from #4023.

Also document what the frontend expects from the API, what it wrangles and generates automatically.

Instructions

A quick primer about the media documentation pipeline for the frontend: the just recipe frontend/generate-docs calls pnpm script doc:media-props which runs frontend/scripts/document-media.js. This JS script parses frontend/types/media.ts and writes a Markdown file that's served by the docs.

So to do this, you'll need to follow these steps.

  • Start the docs server just s, let it run in the background.
  • Edit the sole file frontend/types/media.ts.
    • Add documentation comments /** */ for properties of the interfaces Media, ImageDetail and AudioDetail.
    • You can write Markdown, you can use TSDoc features like @see.
    • You can also see refer to pre-written docstrings (e.g. id and title) as examples.
  • Run just frontend/generate-docs media-props false.
  • Check the running docs @ /meta/media_properties/frontend.html to see your updates on the page.
@dhruvkb dhruvkb added 🟨 priority: medium Not blocking but should be addressed soon ✨ goal: improvement Improvement to an existing user-facing feature 📄 aspect: text Concerns the textual material in the repository ⌨️ tech: typescript Involves TypeScript 🧱 stack: frontend Related to the Nuxt frontend labels Apr 3, 2024
@zackkrida
Copy link
Member

@WordPress/openverse-frontend I am not confident what this work entails. Is there more information anywhere? To start, what files is it meant to touch? I see the work done in frontend/src/types/media.ts but am not sure how everything connects.

@dhruvkb
Copy link
Member Author

dhruvkb commented May 2, 2024

@zackkrida I've updated the PR description to add section "Instructions" that provides more info on what need to be changed and how the changes can be seen locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📄 aspect: text Concerns the textual material in the repository ✨ goal: improvement Improvement to an existing user-facing feature 🟨 priority: medium Not blocking but should be addressed soon 🧱 stack: frontend Related to the Nuxt frontend ⌨️ tech: typescript Involves TypeScript
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants