Skip to main content

Google Summer of Code'21 Khushal Agarwal

ยท 4 min read
google-summer-of-code

Automatically generate documentation out of React/React Native Component

This summer, I was pleased to get selected for Google Summer of Code'21 under the organization React Native Elements. Working under the organization, my project was to generate documentation automatically out of the UI components and present it in the Docusaurus website.

enter image description here

The purpose of creating this repository is to maintain a report summary of my GSoC work and this may also serve as a guide for future GSoC aspirants and a reference to the developers and contributors to the project.

๐Ÿ“™ Abstract#

React Native Elements is a cross-platform UI toolkit built on/for React Native. With a weekly download by 90k+ users and backed by a huge community, it provides UI components that can be used in your native application for the platform of Android/iOS/Web.

The documentation of the project was maintained manually previously i.e., suppose I want to change/add/remove a prop or a new component to the project the markdown file had to be changed manually. The process is tiring and new contributors may often forget to do so. So, during the summers I took the change this process and make a workflow such that the generation is automatic. This should be fast and maintainable.

๐Ÿ“ Deliverables#

The deliverables of the project are as follows:

  • Efficient Development Setup
  • Re-structure and Refactor code to have a common pattern.
  • Maintain the Usage/Examples of the component as they are needed to be updated manually.
  • Refactor and rename the directory structure such that Autogen is successful.
    • Convert the code-base to have all the functional components.
  • Commenting on all the components and props.
    • Adding descriptions.
    • Adding prop descriptions.
    • Ensuring a common pattern is followed.
  • Writing scripts to extract data out(in JS/TS) of it in the form of JSON.
  • Converting the JSON data to Markdown.
  • Automating the process such that the workflow works automatically whenever there is a change in the prop/definition or component code.

All of the listed deliverables were completed within the GSoC period. ๐ŸŽ‰

๐Ÿ“ฆ Working product#

The work can be found here - Official Website of React native elements. Please refer to the component docs.

I have also written a blog on how it works attached here.

๐Ÿš€ Contributions#

Pull requests#

PR LinkDescriptionStatus
#3071[Refactor] Documentation directory structureMerged โœ…
#3081[Refactor] Directory structure of componentsMerged โœ…
#3112[Add] props description, descriptions to the component.Merged โœ…
#3126[Docs] Added demos and snack for the documentationMerged โœ…
#3136[Add] Docgen auto generation of docs scriptsMerged โœ…
#3142[Docs] Added generate-markdown scriptsMerged โœ…
#3143, #3144[Fix] Issues related to auto-generation of documentationMerged โœ…
#3145[Fix, Improve] Doc-gen issues and automationOpen(to be merged) ๐Ÿ•’

Issues#

Issue linkDescription
#3171[Docs] Auto-generation of documentation for class based components

Apart from these contributions, I have contributed to other React native elements projects. They can be summarized as:

ProjectReference
React Native Elements - main repoPull requests
React Native Elements AppPull requests
PlaygroundPull requests

๐Ÿ‘จ Mentors#

I would like to thank my mentors for helping me reach this milestone. ๐Ÿ˜„๐Ÿ˜„

I have not only learned about the Open Source culture and how to write good code but also, learned how the industry works and the import

I would also like to thank Arpit Bhalla for being an amazing partner in this amazing journey.

๐Ÿ”— Links#