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

github-trigger

v1.0.2

Published

[日本語の説明はこちら](#日本語-japanese) # GitHub Trigger You can create a webhook for your GitHub repository.

Downloads

209

Readme

日本語の説明はこちら

GitHub Trigger

You can create a webhook for your GitHub repository.

Usage

Code Example

import { GitHubWebhook } from './lib/GitHubWebhook';

// These are the default values, and you can omit the config as well.
const github = new GitHubWebhook({
  port: 42022,
  path: "/webhook"
});

github.trigger('push', async (payload) => {
  console.log(`Push to ${payload.ref}`);
});

// Start session
github.start();

Public Example

It is recommended to use a reverse proxy like Apache for public access. You can also use ngrok for public access.

Apache

  1. Install the required modules
sudo a2enmod proxy
sudo a2enmod proxy_http
  1. Create the config
<VirtualHost *:80> # Change the port as needed
  ServerName yourdomain.com  # Change this to the appropriate domain name

  ProxyRequests Off
  ProxyPreserveHost On

  # Reverse proxy settings
  ProxyPass / http://localhost:42022/
  ProxyPassReverse / http://localhost:42022/

  # Error log and access log settings
  ErrorLog ${APACHE_LOG_DIR}/myapp_error.log
  CustomLog ${APACHE_LOG_DIR}/myapp_access.log combined
</VirtualHost>
  1. Enable the configuration
sudo a2ensite mywebhook.conf

sudo systemctl restart apache2

Nginx

  1. Create the config
server {
  listen 80;  # Change the port as needed
  server_name yourdomain.com;  # Change this to the appropriate domain name

  location / {
    proxy_pass http://localhost:42022;  # Reverse proxy settings
    proxy_set_header Host $host;  # Set the host header
    proxy_set_header X-Real-IP $remote_addr;  # Set the client's IP address
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  # Set the X-Forwarded-For header
    proxy_set_header X-Forwarded-Proto $scheme;  # Set the protocol
    }

    # Error log and access log settings
    error_log /var/log/nginx/myapp_error.log;
    access_log /var/log/nginx/myapp_access.log;
}
  1. Enable the configuration
sudo ln -s /etc/nginx/sites-available/myapp /etc/nginx/sites-enabled/

sudo systemctl restart nginx

日本語 (Japanese)

GitHub Trigger

GitHubのリポジトリのWebhookを作成することができます。

使い方

コード例

import { GitHubWebhook } from './lib/GitHubWebhook';

// These are the default values, and you can omit the config as well.
const github = new GitHubWebhook({
  port: 42022,
  path: "/webhook"
});

github.trigger('push', async (payload) => {
  console.log(`Push to ${payload.ref}`);
});

// Start session
github.start();

公開例

Apache等のリバースプロキシを使用して公開することを推奨します。 ngrokを使用して公開することもできます。

Apache

  1. 必要なモジュールをインストール
sudo a2enmod proxy
sudo a2enmod proxy_http
  1. configの作成
<VirtualHost *:80> # 必要に応じてポートを変更
  ServerName yourdomain.com  # ここを適切なドメイン名に変更

  ProxyRequests Off
  ProxyPreserveHost On

  # リバースプロキシの設定
  ProxyPass / http://localhost:42022/
  ProxyPassReverse / http://localhost:42022/

  # エラーログとアクセスログの設定
  ErrorLog ${APACHE_LOG_DIR}/myapp_error.log
  CustomLog ${APACHE_LOG_DIR}/myapp_access.log combined
</VirtualHost>
  1. 設定を有効化
sudo a2ensite mywebhook.conf

sudo systemctl restart apache2

Nginx

  1. configを作成
server {
  listen 80;  # 必要に応じてポートを変更
  server_name yourdomain.com;  # ここを適切なドメイン名に変更

  location / {
    proxy_pass http://localhost:42022;  # リバースプロキシの設定
    proxy_set_header Host $host;  # ホストヘッダーを設定
    proxy_set_header X-Real-IP $remote_addr;  # クライアントのIPアドレスを設定
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  # X-Forwarded-Forヘッダーを設定
    proxy_set_header X-Forwarded-Proto $scheme;  # プロトコルを設定
    }

    # エラーログとアクセスログの設定
    error_log /var/log/nginx/myapp_error.log;
    access_log /var/log/nginx/myapp_access.log;
}
  1. 設定を有効化
sudo ln -s /etc/nginx/sites-available/myapp /etc/nginx/sites-enabled/

sudo systemctl restart nginx