feat: auto-populate README fields from GitHub repository URL#175
Open
Shivangi1515 wants to merge 1 commit into
Open
feat: auto-populate README fields from GitHub repository URL#175Shivangi1515 wants to merge 1 commit into
Shivangi1515 wants to merge 1 commit into
Conversation
✅ Deploy Preview for makeareadme ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Author
|
Hi @Mohit-368 Kindly review the PR for the issue #167 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #167
Description
This PR implements the feature to automatically populate README fields from a GitHub repository URL.
Currently, users have to manually enter all details. With this feature, pasting a public GitHub repository URL fetches repository metadata using the GitHub REST API and pre-fills the form fields, making README generation faster and more efficient.
Proposed Improvements
1. GitHub API Utility
src/utils/githubApi.jsthat contains:parseGitHubUrl(url): Robust parser supporting various GitHub URL formats (HTTPS, HTTP, SSH,.gitsuffixes, subpages, etc.).fetchRepoData(owner, repo): Fetches repository metadata from the public GitHub REST API, returning clean mapped values (name, description, owner login, homepage URL, license, etc.).2. State & Fields Management
src/hooks/useReadmeState.js:updateMultipleFieldshelper function to set multiple fields of theformDatastate simultaneously in a single React state transaction, ensuring smooth auto-saving.3. Editor Panel UI
src/pages/ReadmeMaker/EditorPanel.jsx:4. Integration & Mapping
src/pages/ReadmeMaker/ReadmeMaker.jsx:handleGitHubImport(data): maps the fetched GitHub API response fields to the matching local state keys (projName,repoSlug,tagline,description,ghUser,authorGh,license,demoUrl).<EditorPanel>via theonGitHubImportprop.5. Styling
src/styles/index.css:.github-import-barlayout, header, form input field, fetch button, and status messages.Verification
Automated
npm run buildlocally to verify clean compilation without warnings or errors.