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

gitpayd

v0.2.4

Published

Github Workflows + BTC / LND, gitpayd watches your repo for new commits and sends payments to contributors

Downloads

30

Readme

gitpayd

Build gitpayd CodeQL

Github Workflows + BTC / LND, gitpayd watches your repo for new commits and sends payments to contributors

image

[INFO]  2021-04-05T00:34:10.007Z => found lnd version: 0.12.0-beta.rc1 
[INFO]  2021-04-05T00:34:10.010Z => gitpayd started in 849ms on SERVER:7777
[INFO]  2021-04-05T00:36:41.376Z => x.x.x.x connected to gitpayd/health
[INFO]  2021-04-05T00:36:41.598Z => x.x.x.x connected to gitpayd/noops
[INFO]  2021-04-05T00:36:41.707Z => processing issue #13...
[INFO]  2021-04-05T00:36:41.779Z => attempting to settle pull request #14 for 150 sats
[INFO]  2021-04-05T00:36:41.890Z => payment amount decoded: 100 sats
[ERROR] 2021-04-05T00:36:41.892Z => decoded amount does not match bounty!
[INFO]  2021-04-05T00:38:07.507Z => x.x.x.x connected to gitpayd/health
[INFO]  2021-04-05T00:38:07.590Z => x.x.x.x connected to gitpayd/noops
[INFO]  2021-04-05T00:38:07.702Z => processing issue #13...
[INFO]  2021-04-05T00:38:07.772Z => attempting to settle pull request #14 for 100 sats
[INFO]  2021-04-05T00:38:07.869Z => payment amount decoded: 100 sats
[INFO]  2021-04-05T00:38:07.944Z => gitpayd channel balance is: 484976 sats
[INFO]  2021-04-05T00:38:08.926Z => Pull Request successfully merged
[INFO]  2021-04-05T00:38:13.092Z => payment pre-image: L2wHWnourzWsAsH0F3f2GKxDYilTUzNEavdhk6MKqF8=

*** Caution: This application is beta and breaking changes may occur. Use mainnet at your own risk!

Proposal

  1. End user opens issue (generates invoice) and pays amount that becomes a bounty.
  2. Developer picks up issue on first-come, first-serve basis
    • Pull request is opened to resolve the issue
    • aggressive build, testing and security analysis completes
    • PR is merged and % of bounty is paid to the developer
  3. Payment is sent for production deployment to bots deploying and / maintaining infrastructure
    • end user gets feedback
    • issue is resolved

Project Layout

gitpayd/
├── src                # Directory of source code
   ├── test              # Test files
   ├── config.ts         # Configuration properties
   ├── gitpayd.ts        # Entry point for the app
   ├── noops.ts          # NoOps / DevOps script for processing CI / CD payments
   ├── setup.ts          # Creates configuration, connects to LND, helper functions, etc.
   ├── logging.ts        # In house logger, since TS hates console.log()
   ├── util.ts           # General purpose functions and logic for CI / CD

Building

  1. cd gitpayd/ and run npm i to install modules
  2. Run npm run clean && npm run build
  3. Output is in /dist

Development

  1. Set environment variable export GITPAYD_ENV=DEV for development if needed
  2. Run node dist/gitpayd.js to run server *--help for help
  3. Test health check at http://hostname:7778/gitpayd/health (*port 7777 is default secure port)
  4. Verify configuration files at ~/.gitpayd/config.json
Options:
      --help                     Show help                             [boolean]
      --version                  Show version number                   [boolean]
      --key-path, --kp           Path to SSL private key                [string]
      --cert-path, --cep         Path to the server certification       [string]
      --ca-path, --cap           Path to the CA intermediate certification
                                                                        [string]
      --root-path, --rp          Path to the root intermediate certification
                                                                        [string]
  -p, --port                     port to run the server                 [number]
      --dev-port, --dvp          dev port to run the server             [number]
  -o, --owner                    owner of the repo NoOps is running
                                                             [string] [required]
  -r, --repo                     name of the repo NoOps is running
                                                             [string] [required]
      --max-pay, --mp            maximum allowable payment              [string]
      --payment-threshold, --pt  minimum channel balance to maintain    [string]
      --log-level, --ll          comma separated list of log levels to maintain
                                                                        [string]

Missing required arguments: owner, repo

Security

  1. API key is generated at setup, protect or configure your own
  2. Pull Requests are validated against OWNER and COLLABORATOR author associations.
  3. Payment thresholds are configured in command line.
  4. SSL certs / passphrase is required to start the https server (self-signed should be fine).
  5. GITHUB_TOKEN runs at the repo level. Only authorized contributors are allowed.
  6. It is possible to run dev server on http as fallback mechanism with export GITPAYD_ENV=DEV set
prompt: Enter SSL passphrase or press Enter for DEV mode 
        Hint: for DEV mode export GITPAYD_ENV=DEV
:  
[ERROR] 2021-04-03T00:30:49.164Z => https is not configured, check ssl certs location or passphrase
[user@server gitpayd]$ 

Notes

  1. This application runs on the latest Node 12.x+
  2. Currently, only battle tested on Fedora 34 Beta
  3. Secrets can be configured in your repository settings => secrets
  4. Sample Github workflow .yml is located in gitpayd/.github/workflows/build.yml

Required Secrets

GITHUB_TOKEN

Sample .gitpayd/config.json

{
  "macaroonPath": "/home/USER/path/to/macaroon",
  "lndHost": "localhost:10009",
  "internalApiKey": "xxx",
  "tlsPath": "/home/USER/path/to/tls.cert",
  "rpcProtoPath": "/home/USER/path/to/rpc.proto",
  "routerProtoPath": "/home/USER/path/to/routerrpc/router.proto"
}

Delimiters

Installation

  1. Run npm i -g gitpayd
  2. Execute gitpayd should start up the server
  3. Execute from workflow as curl or create your own action thingy!

Releasing

TODO: Automated release management via npm publish and workflows

Testing with Jest

npm test more tests are encouraged