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 🙏

© 2026 – Pkg Stats / Ryan Hefner

egg-cluster-script

v0.1.20

Published

egg cluster start bin

Readme

eggjs 部署脚本

仿造 egg-script 的集群热部署方案,支持单机集群的热部署平滑重启更新

支持 egg-script 启动日志

installation

npm install egg-cluster-script --save-dev

usage

npx egg-cluster-bin <command> [...options]

Command

|command|description| |-------|-----------| |start|启动服务| |stop|终止服务| |reload|重启集群,平滑模式| |startOrReload|启动/重启服务,自动根据 title 判断|

Options

参数在作用于服务启动的时候

|option|description|value type| |------|-----------|-----| |'-i, --instances <n>'|worker 进程数, default 1|Number| |'-p, --port <p>'|egg 应用启动监听端口|Number| |'-t, --title <t>'|egg 应用名称|String| |'-d, --daemon'|守护进程模式,添加此参数后,服务启动后会进入后台守护进程模式|不需要参数值| |'-l, --logDir <d>'|日志保存目录|String| |'-b, --baseDir <d>'|项目启动目录|String| |'--ignore-stderr'|忽略错误信息启动|不需要参数值|

title 参数使用在所有的命令中

closehook

在 worker 重启的过程中,应该及时切走流量,让正在重启的 worker 不再接收新的请求,并在超时时间内处理好已经连接的请求,

如果正在连接的请求超过了超时时间,那么 worker 就已经被关闭了,这些请求会返回错误

//app.js

module.exports = app => {

    app.beforeClose(async() => {
        const server = app.server;
        // 在worker重启的时候,禁止新的请求访问
        server.close();
        // 访问请求超时
        await new Promise(resolve => setTimeout(resolve, 5000));
    });

}

app-worker 在接收到关闭命令的时候,会触发这个钩子,终止新的请求,并在 5s 后被关闭,如果 5s 内已请求的连接没有完成,会被释放

todo

  • ✅ 添加command: startOrReload 自动判断是否需要启动或重启
  • 支持所有egg-script参数
  • 🔥 添加更多参数
  • 🔥 优化ipc
  • 想要什么,提issue吧