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

chore(deps): Add configuration to make website PWA-ready #326

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

yamadashy
Copy link
Owner

Checklist

  • Run npm run test
  • Run npm run lint

Copy link

cloudflare-workers-and-pages bot commented Jan 28, 2025

Deploying repomix with  Cloudflare Pages  Cloudflare Pages

Latest commit: a5523b3
Status: ✅  Deploy successful!
Preview URL: https://d0cf35c3.repomix.pages.dev
Branch Preview URL: https://feat-website-pwa.repomix.pages.dev

View logs

Copy link
Contributor

coderabbitai bot commented Jan 28, 2025

📝 Walkthrough

Walkthrough

The pull request introduces Progressive Web App (PWA) configuration to the VitePress project. This is accomplished by adding the vite-plugin-pwa dependency to the package.json and modifying the configShard.ts configuration file. The changes include defining a manifest with app details, adding meta tags for improved PWA compatibility, and configuring caching strategies using Workbox. The manifest specifies app properties like name, description, theme color, and includes icon definitions. The configuration also adds Apple-specific web app meta tags and sets up a PWA plugin with specific caching rules for resources like Google Fonts.

Sequence Diagram

sequenceDiagram
    participant Browser
    participant PWA Plugin
    participant Service Worker
    participant Cache

    Browser->>PWA Plugin: Initialize PWA
    PWA Plugin->>Service Worker: Register Service Worker
    Service Worker->>Cache: Set up caching strategies
    Browser->>Service Worker: Request resources
    Service Worker->>Cache: Check cached resources
    alt Resource in cache
        Cache-->>Browser: Return cached resource
    else Resource not in cache
        Service Worker->>Browser: Fetch from network
        Browser-->>Service Worker: Store in cache
    end
Loading

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.19%. Comparing base (27a3309) to head (a5523b3).
Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #326   +/-   ##
=======================================
  Coverage   90.19%   90.19%           
=======================================
  Files          48       48           
  Lines        2488     2488           
  Branches      514      514           
=======================================
  Hits         2244     2244           
  Misses        244      244           

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
website/client/.vitepress/config/configShard.ts (2)

13-38: Enhance PWA manifest configuration.

While the basic manifest configuration is good, consider adding these essential PWA properties:

  • start_url: Define the starting URL of the application
  • scope: Specify the navigation scope
  • orientation: Set preferred orientation for optimal mobile experience

Also, consider creating a dedicated maskable icon instead of reusing the regular icon, as maskable icons should be designed with safe zones in mind.

 const manifest: Partial<ManifestOptions> = {
   name: 'Repomix',
   short_name: 'Repomix',
   description: 'Pack your codebase into AI-friendly formats',
   theme_color: '#f97316',
   background_color: '#ffffff',
   display: 'standalone',
+  start_url: '/',
+  scope: '/',
+  orientation: 'any',
   icons: [
     {
       src: '/images/pwa/repomix-192x192.png',
       sizes: '192x192',
       type: 'image/png',
     },
     {
       src: '/images/pwa/repomix-512x512.png',
       sizes: '512x512',
       type: 'image/png',
     },
     {
-      src: '/images/pwa/repomix-512x512.png',
+      src: '/images/pwa/repomix-maskable-512x512.png',
       sizes: '512x512',
       type: 'image/png',
       purpose: 'any maskable',
     },
   ],
 };

141-173: Consider adding caching strategies for other static assets.

While the Google Fonts caching is well configured, consider adding specific caching strategies for:

  • Images (png, svg)
  • JavaScript and CSS files
  • API responses (if any)

This would improve offline capabilities and performance.

 workbox: {
   globPatterns: ['**/*.{js,css,html,ico,png,svg,woff,woff2}'],
   runtimeCaching: [
+    {
+      urlPattern: /\.(png|svg|ico)$/i,
+      handler: 'CacheFirst',
+      options: {
+        cacheName: 'images-cache',
+        expiration: {
+          maxEntries: 50,
+          maxAgeSeconds: 60 * 60 * 24 * 30, // 30 days
+        },
+      },
+    },
+    {
+      urlPattern: /\.(js|css)$/i,
+      handler: 'StaleWhileRevalidate',
+      options: {
+        cacheName: 'static-resources-cache',
+        expiration: {
+          maxEntries: 30,
+          maxAgeSeconds: 60 * 60 * 24, // 1 day
+        },
+      },
+    },
     // Existing Google Fonts caching configurations...
   ],
 },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 27a3309 and a5523b3.

⛔ Files ignored due to path filters (5)
  • website/client/package-lock.json is excluded by !**/package-lock.json
  • website/client/src/public/images/pwa/repomix-192x192.png is excluded by !**/*.png
  • website/client/src/public/images/pwa/repomix-512x512.png is excluded by !**/*.png
  • website/client/src/public/images/repomix-logo.png is excluded by !**/*.png
  • website/server/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • website/client/.vitepress/config/configShard.ts (4 hunks)
  • website/client/package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Test (windows-latest, 23.x)
  • GitHub Check: Test (windows-latest, 22.x)
  • GitHub Check: Test (windows-latest, 21.x)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (4)
website/client/package.json (1)

11-11: Verify the vite-plugin-pwa version compatibility.

The specified version ^0.21.1 seems unusual as it's higher than the current latest stable version. Let's verify the version compatibility with VitePress.

✅ Verification successful

Version ^0.21.1 is correct and up-to-date

The specified version is the latest available release and has proper peer dependency compatibility with Vite and related packages.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check latest version and compatibility
npm view vite-plugin-pwa versions --json | jq -r '.[]' | sort -V | tail -n 5
npm view vite-plugin-pwa@0.21.1 peerDependencies --json

Length of output: 325

website/client/.vitepress/config/configShard.ts (3)

107-111: LGTM! PWA meta tags are well configured.

The Apple-specific meta tags and icons are properly set up and consistent with the manifest configuration.


138-141: LGTM! VitePWA plugin configuration is well structured.

The auto-update registration strategy and static asset patterns are appropriately configured.


22-35: Verify that all PWA assets exist in the correct location.

Let's ensure all required PWA assets are present in the repository.

✅ Verification successful

PWA assets are present and properly configured

The required PWA assets exist in the correct location:

  • /images/pwa/repomix-192x192.png
  • /images/pwa/repomix-512x512.png
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if PWA assets exist
echo "Checking PWA assets..."
fd -t f "repomix-.*\.(png|svg)" "website/client/public/images/pwa"

# Verify image dimensions
echo -e "\nVerifying image dimensions..."
find website/client/public/images/pwa -name "repomix-*.png" -exec sh -c '
  for img; do
    dimensions=$(identify -format "%wx%h" "$img" 2>/dev/null)
    echo "$img: $dimensions"
  done
' sh {} +

Length of output: 584


Script:

#!/bin/bash
# First, let's understand the repository structure
echo "Repository structure:"
ls -la website/client/public || ls -la website/client || ls -la website

# Then search for PWA assets anywhere in the repository
echo -e "\nSearching for PWA assets:"
fd -t f "repomix.*\.(png|svg)"

Length of output: 1421


Script:

#!/bin/bash
echo "Checking PWA image properties:"
for img in website/client/src/public/images/pwa/repomix-*.png; do
    echo -n "$img: "
    file "$img" | grep -o "[0-9]* x [0-9]*"
done

Length of output: 830

@yamadashy yamadashy merged commit b4fe4f8 into main Jan 28, 2025
54 checks passed
@yamadashy yamadashy deleted the feat/website-pwa branch February 1, 2025 15:17
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.

1 participant