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

generate-donate-buttons

v1.0.2

Published

Generate donation buttons for your website - supports Paypal, Venmo, Stripe, GitHub, Coinbase (bitcoin, ethereum, Solana, etc), patreon, Buy Me Coffee, and many more

Downloads

6

Readme

generate-donate-buttons

Install package

npm install generate-donate-buttons

How To Use

import { generateDonateButtons } from "generate-donate-buttons";

To render the buttons, you can specify an existing DIV element on the page or you can add a new DIV with any ID you want to use. Example would be

<div id='donateButtons'></div>

Then to render a set of donation buttons, you need the following javascript code:

  generateDonateButtons({
    payments: [
      {
        url: 'https://paypal.me/designlook'
      },
      {
        url: 'https://account.venmo.com/u/designlook'
      },
      {
        text: "crypto",
        icon: '<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 48 48"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M24 45.5A21.5 21.5 0 1 1 39.21 8.81L32 16.05A11.25 11.25 0 1 0 32 32h0l7.24 7.24A21.43 21.43 0 0 1 24 45.5Z"/></svg>',
        url: 'https://commerce.coinbase.com/checkout/0534ae26-a703-4c27-9622-835fdf76f189'
      },
    ],
    // REQUIRED - an existing DIV element with an ID on your page
    // Example: <div id='donateButtons'></div>
    targetDiv: document.getElementById("donateButtons"), 

    // DROPDOWN MENU - OPTIONAL //
    menuType: 'dropdown', // options are 'dropdown' or leave blank for buttons
    menuText: 'Donate', // the text to display in the menu
    menuWidth: '100px', // the width of the menu
    menuClass: 'btn btn-sm btn-info', // the class to apply to the menu button
    menuStyle: 'background:#ae3cbf;color:#fff;border:1px solid #ccc;', // the style to apply to the menu button
    // UI SETTINGS - OPTIONAL //
    hideName: false,
    hideIcon: false,
    iconColor: "black", // "white" or "#fff"
    textColor: "black", // "white" or "#fff"
    orientation: "horizontal",  // horizontal or vertical (for vertical you need to make sure the target div element has narrow width like 200px or 300px)
    btnWrapperStyle: "font-size:.9rem;", // inline css styles
    btnStyle: "border: 1px solid #ccc;",
    btnClass: "", // "btn-sm" or "btn-primary"
  })

Useful Links

Icons https://icon-sets.iconify.design/ Heart Icon: https://github.com/artcoholic/akar-icons Down Arrow: https://github.com/atisawd/boxicons Paypal Icon: https://github.com/krystonschwarze/coolicons Stripe Icon: https://github.com/coreui/coreui-icons Github Icon: https://github.com/ant-design/ant-design-icons Venmo Icon: https://github.com/atisawd/boxicons Patreon Icon: https://github.com/michaelampr/jam

Running NPM package locally

The following was helpful to me in developing this NPM package. Running verdaccio allows you to import a local npm package and use it within JS app locally.

https://verdaccio.org/docs/installation/

  1. Create .npmrc file on npm project root content should be 'registry=http://localhost:4873'
  2. Create .npmrc file on app project you want to test your new npm package and content should be 'registry=http://localhost:4873'
  3. npm unpublish [email protected]
  4. npm publish --registry http://localhost:4873

The unpublish is useful so you don't have to keep changing the version # in the package.json. You can stick with the same version and publish it.