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

Convert Vue PWA (Progressive Web App) to a DWA (Decentralized Web App) #66

Closed
6 tasks
Tracked by #63
blackgirlbytes opened this issue Aug 28, 2024 · 2 comments · Fixed by #196
Closed
6 tasks
Tracked by #63

Convert Vue PWA (Progressive Web App) to a DWA (Decentralized Web App) #66

blackgirlbytes opened this issue Aug 28, 2024 · 2 comments · Fixed by #196

Comments

@blackgirlbytes
Copy link
Contributor

blackgirlbytes commented Aug 28, 2024

Convert Vue PWA to a Decentralized Web App (DWA)

🚀 Goal

Begin the process of transforming our Vue.js Progressive Web App (PWA) into a Decentralized Web App (DWA) by setting up the necessary Web5 infrastructure.

🤔 Background

A Decentralized Web App (DWA) is a Progressive Web App (PWA) that incorporates Web5 functionalities, providing offline capabilities and offline synchronization of Decentralized Web Nodes (DWNs). This task will initiate the conversion of our existing Vue PWA to a DWA by setting up the basic Web5 components.

This is part of our larger project to create a Vue.js DWA starter. See our main issue here for the full context and list of all related tasks.

Important: For reference, please see the DWA React Vite starter app. While the implementation details will differ for Vue, this example provides a good overview of the structure and functionalities of a DWA.

🔑 Tasks and Acceptance Criteria

🚫 You must not steal an issue assigned to another person. If you submit a PR for an issue not assigned to you, you will not receive points. 🚫

  • Install the @web5/api package https://www.npmjs.com/package/@web5/api
  • Import and implement activatePolyfills from @web5/api in the main application file
  • Update the service worker to include Web5 polyfills:
    • Import activatePolyfills in the service worker
    • Implement activatePolyfills with appropriate cache TTL settings
  • Verify that the app still functions as a PWA after these changes

🌟 Resources

💻 Code Snippets

Importing and Activating Polyfills

import { activatePolyfills } from '@web5/api';

// Activate Web5 Service Worker Polyfills
activatePolyfills({
  onCacheCheck() {
    return {
      ttl: 30000,
    };
  },
});

Service Worker Configuration (example)

/// <reference lib="webworker" />
import {
  cleanupOutdatedCaches,
  createHandlerBoundToURL,
  precacheAndRoute,
} from "workbox-precaching";
import { NavigationRoute, registerRoute } from "workbox-routing";
import { activatePolyfills } from "@web5/api";

declare let self: ServiceWorkerGlobalScope;

self.addEventListener("message", (event) => {
  if (event.data && event.data.type === "SKIP_WAITING") self.skipWaiting();
});

precacheAndRoute(self.__WB_MANIFEST);
cleanupOutdatedCaches();

let allowlist;
if (import.meta.env.DEV) allowlist = [/^\/$/];

registerRoute(
  new NavigationRoute(createHandlerBoundToURL("index.html"), { allowlist })
);

activatePolyfills({
  onCacheCheck() {
    return {
      ttl: 30000,
    };
  },
});

Getting Started

  1. Comment ".take" on this issue to get assigned
  2. Fork the repository and create a new branch for this task
  3. Follow the tasks outlined above
  4. Submit a pull request with your changes
  5. Respond to any feedback during the review process

Questions?

If you have any questions or need clarification, please comment on this issue or join our Discord community.

Happy coding! 🎉

@blackgirlbytes blackgirlbytes changed the title Convert Vue PWA to a DWA Convert Vue PWA (Progressive Web App) to a DWA (Decentralized Web App) Aug 28, 2024
@taniashiba taniashiba moved this to Todo in Hacktoberfest 2024 Oct 2, 2024
@Johnnyevans32
Copy link
Contributor

.take

Copy link

github-actions bot commented Oct 5, 2024

Thanks for taking this issue! Let us know if you have any questions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants