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

ha-server

v1.0.0

Published

develop tool

Readme

ha-server - 前端定制代理服务工具

ha-server是一款基于nodejs环境编写的CLI工具,核心部分使用gulp完成,用于定制化请求/资源的代理转发,实现开发环境前后端分离。

特性

  • 转发静态资源(htmlcssjs等)至命令运行当前目录
  • 转发请求至指定Url(默认手机后台79测试环境)

安装

需要基于nodejs环境,使用npm进行安装:

npm install -g ha-server

或者使用cnpm进行安装,等待安装完成后无报错,即可正常使用

使用

使用该工具前,需要通过终端进入到所在项目的webapp目录下:

cd project/src/main/webapp

下一步,直接运行命令启动:

ha-server

启动后无报错的话,可以看到端口监听状态等

命令参数

ha-server支持如下命令:

| 命令 | 默认值 | 描述 | | ----- | ----- | ----- | | --target | http://**.**.**.79:9080/hrbmbank_07,默认手机后台79环境 | 后端请求转发目标地址,使用如:ha-server --target=http://**.**.**.79:9080/hrbmbank_07 | | --port | 9000,默认使用9000端口 | 当前工具启动占用的端口号,使用如:ha-server --port=8888 | | --router | /hrbmbank | 默认本地服务根路由,村行使用如:ha-server --router=/czmbank |

手机/PC端使用

ha-server启动时,务必确认--target参数,如需与后端开发联调,则需要填写对应后端服务的地址。如只需连接测试环境,则填写对应测试环境服务地址。如需连接手机后台79环境,则参数可省略
ha-server启动后,即默认启动一个web server,监听对应端口,服务地址为:你的ip:端口/hrbmbank(端口为,启动服务时设置的端口)
这时,手机端配置本地服务时,注意修改ip端口为当前启动服务对应的值
修改完毕后,即可使用手机App调试本地代码。具体启动及配置用例如下:

#首先进入项目webapp目录下
cd project/src/main/webapp

#手机后台(服务端79环境,9000端口,根路由为/hrbmbank)
ha-server #启动
http://你的ip:9000/hrbmbank #手机端配置

#手机后台(服务端223环境,8888端口,根路由为/hrbmbank)
ha-server --target=http://130.1.9.223:9080/hrbmbank_07/ --port=8888 #启动
http://你的ip:8888/hrbmbank #手机端配置

#手机后台(服务端本地环境,9000端口,根路由为/hrbmbank)
ha-server --target=http://服务端ip:服务端端口/服务端根路由 #启动
http://你的ip:9000/hrbmbank #手机端配置

#村行手机(服务端216环境,9000端口,根路由为/czmbank)
ha-server --target=http://130.1.11.216:9080/czmbank_04/ --router=/czmbank #启动
http://你的ip:9000/czmbank #手机端配置

#村行手机(服务端本地环境,8888端口,根路由为/czmbank)
ha-server --target=http://服务端ip:服务端端口/服务端根路由 --port=8888 --router=/czmbank #启动
http://你的ip:8888/czmbank #手机端配置

#个网(服务端111环境,9000端口,根路由为/perbank)
ha-server --target=http://130.1.11.111:8080/perbank/ --router=/perbank #启动
http://你的ip:9000/perbank #手机端配置

其中,--router参数,村行固定为/czmbank,手机后台固定为/hrbmbank,其他系统以此类推(该约定为手机客户端约定,如果不这样传手机客户端解析会有问题。非手机端最好也依照此约定,如个网固定为/perbank

安装注意事项

Windows系统

windows下,全局安装ha-server后,运行时提示在此系统无法运行脚本,需要以管理员身份打开终端,运行如下命令:

set-executionpolicy remotesigned

更改可执行策略为

OSX系统

mac系统下,全局安装时,推荐使用cnpm进行安装,安装过程可能出现如下问题:

  1. gyp: No Xcode or CLT version detected!报错
    由于gulp依赖node-gyp模块,node-gyp模块又需要xcode工具包,故需要安装xcode工具:
    xcode-select --install
    也可以手动下载xcode工具包,点击下载,前往官网登录并选择系统对应的Command Line Tools for Xcode工具安装
    更多node-gyp该问题解决方案,点击查看
  2. gyp WARN EACCES user "root" does not have permission to access the dev dir权限问题
    该问题发生原因可以点击这里进行了解
    解决方案为,全局安装工具时,添加如下参数:
    --unsafe-perm
    或使用cnpm进行安装