nash1111 / nash1111-tech-blog

0 stars 0 forks source link

feat: add post #98

Closed nash1111 closed 3 days ago

nash1111 commented 3 days ago

User description

Why

Closes none

What


PR Type

Enhancement, Tests, Documentation


Description


Changes walkthrough ๐Ÿ“

Relevant files
Enhancement
2 files
posts.ts
Add new blog posts to the posts array.                                     

app/lib/posts.ts
  • Added three new blog post imports.
  • Updated the posts array to include new blog posts.
  • +7/-0     
    about.tsx
    Remove the About component.                                                           

    app/routes/about.tsx - Removed the `About` component.
    +0/-12   
    Tests
    2 files
    playwright.config.ts
    Add Playwright configuration for multiple devices.             

    playwright.config.ts
  • Added Playwright configuration for different devices and color
    schemes.
  • +25/-0   
    task.spec.tsx
    Update screenshot paths and remove viewport size setting.

    tests/task.spec.tsx
  • Modified screenshot paths to include project name.
  • Removed viewport size setting for blog page test.
  • +4/-6     
    Miscellaneous
    2 files
    lastUpdated.ts
    Update lastUpdated timestamp.                                                       

    public/lastUpdated.ts - Updated the `lastUpdated` timestamp.
    +1/-1     
    currentIssues.json
    Update current issues list.                                                           

    public/currentIssues.json - Updated the current issues list.
    +1/-1     
    Documentation
    4 files
    about.mdx
    Add detailed About page content.                                                 

    app/routes/about.mdx
  • Added detailed content about technologies used in work and hobbies.
  • +60/-0   
    blog.e2ewithiphone.mdx
    Add blog post on mobile screenshots with Playwright.         

    app/routes/blog.e2ewithiphone.mdx
  • Added a new blog post about taking mobile screenshots with Playwright.

  • +56/-0   
    blog.gitsettingsonvsc.mdx
    Add blog post on git fetch and prune in VSCode.                   

    app/routes/blog.gitsettingsonvsc.mdx
  • Added a new blog post about configuring git fetch and prune in VSCode.

  • +26/-0   
    blog.shuttleaxum.mdx
    Add blog post on Shuttle for Rust frameworks.                       

    app/routes/blog.shuttleaxum.mdx - Added a new blog post introducing Shuttle for Rust frameworks.
    +151/-0 

    ๐Ÿ’ก PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    cloudflare-pages[bot] commented 3 days ago

    Deploying nash1111-tech-blog with  Cloudflare Pages  Cloudflare Pages

    Latest commit: 85c074d
    Status: โœ…  Deploy successful!
    Preview URL: https://16ccffcf.nash1111-tech-blog.pages.dev
    Branch Preview URL: https://add-about-page.nash1111-tech-blog.pages.dev

    View logs

    github-actions[bot] commented 3 days ago

    PR Reviewer Guide ๐Ÿ”

    โฑ๏ธ Estimated effort to review [1-5] 3
    ๐Ÿงช Relevant tests Yes
    ๐Ÿ”’ Security concerns No
    โšก Key issues to review Possible Bug:
    Ensure that the removal of the About component and its replacement with a new MDX page does not break existing functionality or links within the application.
    Performance Concern:
    The addition of multiple devices and color schemes in the Playwright configuration should be tested to ensure it does not introduce performance bottlenecks during testing.
    github-actions[bot] commented 3 days ago

    PR Code Suggestions โœจ

    CategorySuggestion                                                                                                                                    Score
    Reliability
    Add error handling to improve reliability and debugging of screenshot capture ___ **Consider adding error handling for the screenshot operations to ensure that failures in
    navigation or screenshot capture are gracefully managed and logged.** [tests/task.spec.tsx [5-6]](https://github.com/nash1111/nash1111-tech-blog/pull/98/files#diff-267b23c47783cce9f2ec506ab35728afd899f7b64c0a8a39ee429ca5fd2af106R5-R6) ```diff -await page.goto('http://localhost:5173/task'); -await page.screenshot({ path: `test-results/screenshots/task-page-${testInfo.project.name}.png` }); +try { + await page.goto('http://localhost:5173/task'); + await page.screenshot({ path: `test-results/screenshots/task-page-${testInfo.project.name}.png` }); +} catch (error) { + console.error('Failed to capture screenshot for task page:', error); +} ```
    Suggestion importance[1-10]: 9 Why: Adding error handling is crucial for reliability and debugging. It ensures that any issues during navigation or screenshot capture are logged, making it easier to diagnose problems.
    9
    Maintainability
    Simplify and automate the process of importing and adding new blog posts ___ **Consider using a loop or a map function to dynamically import and add posts to the posts
    array. This will reduce redundancy and make the code easier to maintain as more posts are
    added.** [app/lib/posts.ts [5-16]](https://github.com/nash1111/nash1111-tech-blog/pull/98/files#diff-e0d130593a72d881fed8ab93b4c88c4d41b875a9c0ee6133bfb307522d3ca794R5-R16) ```diff -import * as postGitSettingsOnVSCode from "~/routes/blog.gitsettingsonvsc.mdx"; -import * as postShuttleAxum from "~/routes/blog.shuttleaxum.mdx"; -import * as postE2EWithIphone from "~/routes/blog.e2ewithiphone.mdx"; -... -{ path: "/blog/gitsettingsonvsc", data: postGitSettingsOnVSCode }, -{ path: "/blog/shuttleaxum", data: postShuttleAxum }, -{ path: "/blog/e2ewithiphone", data: postE2EWithIphone }, +const postFiles = [ + "gitsettingsonvsc", "shuttleaxum", "e2ewithiphone" +]; +postFiles.forEach(postFile => { + const module = await import(`~/routes/blog.${postFile}.mdx`); + posts.push({ path: `/blog/${postFile}`, data: module }); +}); ```
    Suggestion importance[1-10]: 8 Why: This suggestion improves maintainability by reducing redundancy and making it easier to add new posts in the future. It automates the import process, which is beneficial as the number of posts grows.
    8
    Replace Windows-style line endings with Unix-style to enhance compatibility ___ **Replace the Windows-style line endings (\r\n) with Unix-style line endings (\n) to ensure
    consistency and compatibility across different operating systems and environments.** [public/currentIssues.json [1]](https://github.com/nash1111/nash1111-tech-blog/pull/98/files#diff-1a27d3828a7c20f8dc1d863aa066eae7d2e45873e77ccfa7cc636b42d9a6760bR1-R1) ```diff -"https://github.com/nash1111/nash1111-tech-blog/blob/master/ADD_SHADCNUI.md\r\nhttps://github.com/nash1111/nash1111-tech-blog/blob/master/ADD_SHADCN_AFTER_TW.md" +"https://github.com/nash1111/nash1111-tech-blog/blob/master/ADD_SHADCNUI.md\nhttps://github.com/nash1111/nash1111-tech-blog/blob/master/ADD_SHADCN_AFTER_TW.md" ```
    Suggestion importance[1-10]: 8 Why: Ensuring consistent line endings improves compatibility across different operating systems, which is important for maintainability.
    8
    Enhancement
    Enhance test configuration to handle timeouts and retries for better stability ___ **Consider adding a configuration for handling timeouts and retries for the browser tests to
    improve test stability in different network conditions.** [playwright.config.ts [20-21]](https://github.com/nash1111/nash1111-tech-blog/pull/98/files#diff-f679bf1e58e8dddfc6cff0fa37c8e755c8d2cfc9e6b5dc5520a5800beba59a92R20-R21) ```diff use: { ...devices["Desktop Chrome"], colorScheme: "dark", + timeout: 30000, + retries: 2 }, ```
    Suggestion importance[1-10]: 8 Why: This suggestion improves the stability of browser tests by handling timeouts and retries, which is particularly useful in varying network conditions. It enhances the robustness of the test suite.
    8
    Remove duplicate or redundant issue entries to streamline data ___ **Remove redundant or duplicate issue entries to clean up the data and improve data
    management. For example, multiple entries for adding a tweet button could be consolidated.** [public/currentIssues.json [1]](https://github.com/nash1111/nash1111-tech-blog/pull/98/files#diff-1a27d3828a7c20f8dc1d863aa066eae7d2e45873e77ccfa7cc636b42d9a6760bR1-R1) ```diff -{"body":"","number":69,"state":"OPEN","title":"add tweet button blog post","url":"https://github.com/nash1111/nash1111-tech-blog/issues/69"},{"body":"","number":67,"state":"OPEN","title":"tweet button(with blog title)","url":"https://github.com/nash1111/nash1111-tech-blog/issues/67"} +{"body":"","number":69,"state":"OPEN","title":"add tweet button blog post","url":"https://github.com/nash1111/nash1111-tech-blog/issues/69"} # Consolidated entry ```
    Suggestion importance[1-10]: 7 Why: Removing redundant entries improves data management and readability, although it is not critical for functionality.
    7
    Best practice
    Use a structured data format for skills and tools to facilitate future data manipulation ___ **Consider using a more structured format like JSON or YAML for the skills and tools section
    to make the data easier to manipulate or query programmatically in the future.** [app/routes/about.mdx [4-10]](https://github.com/nash1111/nash1111-tech-blog/pull/98/files#diff-1cd7b8e883895b16429b1b7d4a1427e120037cb191997d3c1cadac117b7bce4aR4-R10) ```diff -- Rust - - hyper - - diesel - - serde - - anyhow - - axum - - utoipa +skills: { + "Rust": ["hyper", "diesel", "serde", "anyhow", "axum", "utoipa"] +} ```
    Suggestion importance[1-10]: 6 Why: While using a structured format like JSON or YAML can be beneficial for future data manipulation, the current format is readable and sufficient for the present use case. This suggestion is more about future-proofing.
    6
    Data integrity
    Ensure all issue entries are complete and consistent ___ **Add missing fields or correct incomplete data entries to ensure all issues have consistent
    and complete information. For example, some issues have an empty body field which could be
    populated with relevant data or removed if unnecessary.** [public/currentIssues.json [1]](https://github.com/nash1111/nash1111-tech-blog/pull/98/files#diff-1a27d3828a7c20f8dc1d863aa066eae7d2e45873e77ccfa7cc636b42d9a6760bR1-R1) ```diff -{"body":"","number":94,"state":"OPEN","title":"blog page is too slow....","url":"https://github.com/nash1111/nash1111-tech-blog/issues/94"} +{"body":"Investigate and optimize page load times.","number":94,"state":"OPEN","title":"blog page is too slow....","url":"https://github.com/nash1111/nash1111-tech-blog/issues/94"} ```
    Suggestion importance[1-10]: 6 Why: Adding missing information improves data integrity, but the suggestion assumes what the missing data should be without specific context.
    6
    Possible issue
    Verify and correct the URLs to ensure they are valid and accessible ___ **Ensure that the URLs in the body fields are valid and accessible. The current URLs seem to
    point to non-existent or incorrect paths (e.g., missing directories or incorrect file
    names).** [public/currentIssues.json [1]](https://github.com/nash1111/nash1111-tech-blog/pull/98/files#diff-1a27d3828a7c20f8dc1d863aa066eae7d2e45873e77ccfa7cc636b42d9a6760bR1-R1) ```diff -"https://github.com/nash1111/nash1111-tech-blog/assets/35922853/a5eb6b3e-a0ab-4b2d-b6fc-d4a17cda4848" +"https://github.com/nash1111/nash1111-tech-blog/assets/35922853/a5eb6b3e-a0ab-4b2d-b6fc-d4a17cda4848.jpg" # Assuming the correct file extension is .jpg ```
    Suggestion importance[1-10]: 3 Why: While ensuring URLs are valid is important, the suggestion assumes the correct file extension without verification, which could lead to incorrect changes.
    3