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

lbhook

v0.1.24

Published

Git webhook tool.

Downloads

4

Readme

lbhook

WebHook 触发执行 Shell 脚本

安装

npm install -g lbhook

使用说明

输入 lbhook 即可得到帮助

Usage:  lbhook <command> [options]

Options:
  -V, --version       output the version number
  -h, --help          output usage information

Commands:
  start               start lbhook server
  stop                stop lbhook server
  list                show all hooks
  add <name> <shell>  add hook
  rm <name>           remove hook
  init <type>         initializes a shell script in the current directory

  Run lbhook <comman> --help for detailed usage of given command.

示例

启动 lbhook

lbhook start

lbhook start 执行后,会开启 lbhook 服务,服务启动在 11333 端口。

添加 hook

# 创建触发的脚本
touch test.sh
# 添加脚本内容:hook 触发时创建 test 文件夹
echo "mkdir test" > test.sh
# 添加 hook
lbhook add test test.sh
# 查看 hook 是否添加
lbhook list
# 输出:address 需要添加到 git 仓库的 WebHook 去
Name            Shell                                      address                                   
--------------  -----------------------------------------  ------------------------------------------   
test            /root/pro/lbhook/test.sh                 http://119.23.215.213:11333/test 

在 git 仓库添加 WebHook

将刚刚 list 输出的 address 添加到 Git 仓库的 WebHook 中去

http://119.23.215.213:11333/test 

对仓库发起 push 请求后将触发 webhook,webhook 会触发服务器添加的 hook , shell脚本执行,test 文件夹被创建。 hook 执行 shell 脚本的日志会输出在 ./.lbhook/ 文件夹下。

自动部署

借由此功能可以实现 Push 到 Git 仓库,触发服务器 Hook,Shell脚本执行,来完成一个简单的自动部署。

init 命令

lbhook 已经内置了一些初始模板:

  • egg Egg.js 的更新与启动
  • up 仅从拉取最新的 commit
  • vue Vue 的更新与构建

使用方法:

# 到仓库目录执行以下一条命令,他们会在当前目录创建其对应的 lbhook.sh 脚本
lbhook init egg
lbhook init up
lbhook init vue
# 添加到 hook
lbhook add egg-test lbhook.sh
# 查看地址
lbhook list

将地址添加到 git 仓库的 webhook 完成。