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

hls-doc

v1.0.0

Published

a simple comand line tool to generate api doc

Readme

hls-doc

Installation

$ npm install -g hls-doc

原理

通过启动一个本地代理的服务器,并修改项目中app请求url为此服务器地址,实现对app请求的拦截,因此可以记录其请求的url、参数以及真实的服务器返回的结果

配置

配置文件命名:doc.config.js,使用commonjs标准导出一个对象

example:

{
    rootPath:"http://172.16.100.107:8093/core/r/api",//基础url
    loginPath:"http://172.16.100.107:8093/core/oauth/token?client_id=client2&client_secret		        =secret&grant_type=password&username=CTAPP&password=CTAPPCTAPP",//中台获取token的url
    basePath: "http://172.16.100.107:8093/core/r/api?sysName=HLS_CT&apiName=",//带查询参数的url
    origin:"http://172.16.100.107:8093",//中台地址
    totalCount:2,//接口列表每页数量为50时的总页数
    headerId:"6ad30e7b-9daa-4836-b634-5c97c7371110",//头表id,可从中台接口返回的值获取
    cookie:'SESSIONID_HAP=36f6f90f-0a99-4a09-be2b-1efb1662b02e; loginKey=e25338c1-84ac-40b7-99eb-      243e321ee23b',//验证的cookie,可从中台接口返回的值获取
    token:'6559fa80-a624-46fb-80f9-a5cfd4ac1621'//防止csrf攻击的token,可从中台接口返回的值获取

}

使用

在所需文件夹下新建doc.config.js,完成上述配置(需保证配置文件中cookie、token的实效性),在当前目录下开启命令行,执行以下命令:

$ hlsDoc

此时服务器会监听本地3000端口,找到项目app/scripts/util.service.js,在hlsHttp服务的post方法体最前部增加url="http://localhost:3000"+url.split("?")[1],用于本地服务器代理所有app请求

在app中,浏览所有页面,输入必要信息,完成数据的交互。所有需要记录的接口均访问后,在浏览器中访问

"http://localhost:3000/end"提示服务器接口请求结束,此时,脚本将在本目录下生成需要的交接文档,格式为doc