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

@navi-front/utils

v0.0.1

Published

## 本地调试

Readme

NEXT-FRONT 公共方法

本地调试

  "main": "./src/index.ts",

打包

"exports": {
    ".": {
      "cjs": "./dist/login.cjs.js",
      "import": "./dist/login.es.js",
      "require": "./dist/login.umd.js",
      "default": "./dist/login.es.js"
    },
    "./*": "./*"
  },

生成示例配置文件

npm run generate:config

功能说明

此命令调用 scripts/generateTestConfig.cjs 脚本,用于生成项目的测试配置文件 test-rules.json 。

工作原理

  1. 遍历 src 目录下的所有模块文件夹(排除 _test 、 _enums 、 _types 、 _hooks 等特殊目录)
  2. 读取每个模块中的 example.json 文件
  3. 解析这些配置文件中的函数定义和测试参数
  4. 将所有模块的配置整合到根目录的 test-rules.json 文件中

使用场景

  • 在开始编写测试之前,先生成测试配置文件
  • 当新增或修改了模块的 example.json 配置后,需要重新生成测试配置

生成测试文件

npm run generate:test

功能说明

此命令调用 scripts/generateTests.cjs 脚本,根据 test-rules.json 配置文件自动生成 Jest 测试文件。

工作原理

  1. 读取项目根目录下的 test-rules.json 文件
  2. 在 src/test 目录下为每个模块生成对应的测试文件(例如 dateUtils.test.ts )
  3. 根据配置自动生成测试用例,包括:
    • 模块导入语句
    • 测试套件定义(describe 块)
    • 函数测试用例(test 块)
    • 断言语句(expect)

注意事项

  • 必须先运行 generate:config 命令生成 test-rules.json 文件
  • 生成的测试文件包含基本结构,可能需要根据实际情况进行调整

一键生成配置和测试

npm run generate:all

测试运行命令

# 运行所有测试
npm test

# 运行特定测试文件
# npm test -- [模块名].test.ts
# 例如
npm test -- dateUtils.test.ts

# 监视模式运行测试
npm test -- --watch

发布构建

npm run publ