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

@kphnhs/hap-test

v0.4.1

Published

A command line toolkit for developing Quick Apps.

Readme

开发指南

准备

必须需要使用 yarn 安装依赖

yarn install --registry https://registry.npmmirror.com/

cd examples/sample
yarn install --registry https://registry.npmmirror.com/

构建

基本

npm run build
# 推荐使用 npx (须在根目录执行)
npx gulp
# 查看所有任务
npx gulp --tasks

构建指定模块

# 构建全部
npx gulp # npm run build
npx gulp toolkit # npm run build -- toolkit
npx gulp toolkit packager # npm run build -- toolkit packager
npx gulp build # 不包含测试

开发和测试

以下满足大部分开发测试需求(希望),如果特殊需求,可自行修改 gulpfiles.

跳过minify

执行 gulpgulp {toolkit, debugger, packager, build} 这几个命令时,传入 --dev 将跳过 minify,方便开发时调试代码

watch 模式

监听文件,当文件修改时执行任务。

npx gulp watch                            # 监听全部
npx gulp watch --modules toolkit          # 监听 toolkit
npx gulp watch --modules toolkit,packager # 监听 toolkit 和 packager
npx gulp watch -m t,p                     # 同上
npm run dev                               # gulp watch --dev

单元测试

测试工具基于[jest],使用 npx gulp test 命令执行测试。运行单元测时前,先执行 npm run build 构建最新的产物

npx gulp test

项目测试/调试

npx gulp # 构建项目
node packages/hap-toolkit/bin/index.js init <testapp> # 创建一个测试项目
cd <testapp> # 进入测试项目
node ../bin/index.js server --watch # 启动服务
node inspect ../bin/index.js server --watch # 调试

项目测试

使用npm link 命令创建软链接。 假设有测试项目 testapp,则可以通过下面的方式 创建软链接。

cd <hap-toolkit-root>
[sudo] npm link
cd <path-to-testapp>
npm link hap-toolkit

cd <path-to-testapp>
npm link <hap-toolkit-root>

创建软链接后,hap-toolkit 中的修改都会映射到 testapp 项目下的hap-toolkit

jest-snapshot

测试使用了[jest snapshot],避免人工编写预期结果的繁琐。测试修改时,应认真对比 snapshot,确保它是正确的,还要记得提交snapshot

使用 -u 参数更新snapshot:

npx jest ./server/__tests__/server.js -u

代码检查

使用eslint做代码检查,基于standard 规则。配置了huskylint-staged,提交 代码时会自动做一次检查并尝试矫正(fix)