npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cap-angular-schematic-webpush

v1.0.36

Published

CAP Schematics PWA WebPush

Downloads

2

Readme

cap-angular-schematic-webpush NPM version Build Status Generic badge

This repository is a basic Schematic implementation that serves as a starting point to create and publish Schematics to NPM.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

  • Have an Angular app install npm 6.13.7
nmp install 
  • Node 10.6 to the current.

Installation

To run the schematic, execute the following command.

ng add cap-angular-schematic-webpush 

The schematic will be configurated after you answer the following questions.

  • What is the API Url for Web Push End Points? : < http://domain:port >
  • What is the Vapid PublicKey? : < string >
  • What is the Vapid PrivateKey?: < string > ​ The Schematic will do the next:
  • Create a express server if not exist and ad the configuration and routes to use for add subscriptions and send notifictions to subscribers.
  • Create a Angular service to send the subcription to the server and register on providers on app.module.ts.
  • Add a example buttons to add the subscription event and for send notifications to subscribers.
  • Add to app.component.ts the logic for update the service worker, subscribe to web push notifications and for execute the events of the example buttons for subscribe and send notifications to subscribers.
  • Install web-push and if not exits a body-parser package.
  • Add to environments the Vapid Public Key for Web Push.

Touched files:

app
    |-- package.json
    |-- server.js
    |-- app.component.ts
    |-- app.module.ts
    |-- environments/environment.ts
    |-- environments/environment.prod.ts
	|-- shared/
	    |-- web-push.service.ts

How To show the Allow Notifications Dialog

If by accident we click "Deny" in the Allow Notifications dialog after hitting subscribe, In order to trigger again the Allow Notifications popup, we need first to clear localhost from this list - chrome://settings/content/notifications

Generating VAPID keys

In order to generate a public/private VAPID key pair, we first need to install the web-push library globally:

npm install web-push -g

We can then generate a VAPID key pair with this command:

web-push generate-vapid-keys --json

And here is a sample output of this command:

json
{
    "publicKey": "BF1BhDhSW89yKw6pWbLlzcDpCR3I3ViSCEiS_z0q_RP9-ablo5Up8HDIEP1-GauARtU7MxB6Yl_7FI8UvczPmaQ",
    "privateKey": "6XaIXj1cbSoaCpxSbOA-xYWHSISVSMCPUcSvEcczxkg"
}

On Heroku

Once in the Heroku app the web-push package is installed, we must open the Heroku console and execute the next command: "web-push generate-vapid-keys --json"

After that:

  • On Heroku config app create Settings -> Config Vars "publicKey" and "privateKey".
  • Replace the publickKey in te environments files of the Angular app and deploy again.

Usage

angular 8

Built With

Schematic

Version

1.0.30

Authors

Software Allies - Software Allies

Contributor

César Alonso Magaña Gavilanes -cesaralonso

License

MIT © Software Allies