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

zhpub

v0.0.6

Published

适合于react和vue和uniapp以及web端

Readme

ZPub

综合性JavaScript工具库,适用于React、Vue、UniApp及Web端开发,提供基础工具、数据库管理、服务调用、UI组件等功能。

特性

  • 🛠️ 基础工具类: 数组、日期、字符串、对象等常用工具方法
  • 🗄️ 数据库管理: 实体管理、字段管理、配置管理等
  • 🌐 服务调用: HTTP请求、数据服务、登录服务等
  • 🎨 UI组件: 属性表单、地图组件、3D地图等
  • 📱 跨平台: 支持React、Vue、UniApp及Web端
  • 🎯 TypeScript: 完整的类型定义支持

打包构建

本项目支持三种方式将源码打包为单个 JS 文件,产物输出至 dist/ 目录。

打包命令

npm install

把package-cli.json复制到package.json中去然后执行如下命令:

| 命令 | 工具 | 产出文件 | 说明 | |------|------|----------|------| | npm run build:lib | Webpack 5 | dist/zhpub.min.js | 压缩、去 console、变量混淆(保留 ZPub),推荐 H5 直接使用 | | npm run build:rollup | Rollup | dist/zhpub.jsdist/zhpub.min.jsdist/zhpub.esm.js | 同时输出 UMD / 压缩 / ESM 三种格式 | | npm run build:obfuscate | javascript-obfuscator | 混淆版 | 代码混淆保护 |

安装

npm install zhpub

快速开始

ES6 模块导入

import { ZPub } from 'zhpub'
uni.cxapp = zhpub.ZPub

// 使用基础工具类
const isEmpty = uni.cxapp.CxArrayUtil.isEmpty([])
const formattedDate = uni.cxapp.CxDateUtil.format(new Date(), 'YYYY-MM-DD')

// 使用服务调用
uni.cxapp.Http.get('/api/data').then(response => {
  console.log(response)
})

CommonJS 导入

const { ZPub } = require('zhpub')

// 全局注册(适用于UniApp)
uni.cxapp = ZPub

Vue项目中使用

import { ZPub } from 'zhpub'

// 在Vue组件中使用
export default {
  mounted() {
    // 使用工具类
    const result = ZPub.CxStrUtil.trim('  hello world  ')
    
    // 使用数据服务
    ZPub.DataSvr.query('tableName', {}).then(data => {
      console.log(data)
    })
  }
}

HTML 中引入

<!-- 引入打包文件 -->
<script src="dist/zhpub.min.js"></script>
<!-- 引入第三方依赖(Webpack/Rollup 已配置为 external,需单独引入) -->
<script src="https://cdn.jsdelivr.net/npm/dayjs"></script>
<script src="https://cdn.jsdelivr.net/npm/lodash"></script>
<script src="https://cdn.jsdelivr.net/npm/crypto-js"></script>

<script>
  // 全局变量 ZPub 即可使用
  uni.cxapp = ZPub;
</script>

外部依赖说明

dayjslodashcrypto-js 已配置为 external,不会被打包进 JS 文件。使用时需要在 HTML 中引入对应的 CDN 或通过 npm 安装。

上传方法

1:npm login

Username: zhengchaojun Password: ****lovewl123 Email: (this IS public) [email protected]

2:npm publish :如果报错则换个名称

系统要求

  • Node.js >= 16.0.0
  • 建议使用 Node.js v20.0.7 以上版本

git commit提交说明

  git commit -m "type: 提交说明"
  如: git commit -m "fix: 修复bug2135中不能删除用户"
 type说明提交的性质,后面的英文冒号和“提交说明”间留一-个空格,type值如下:

 feat: 添加新特性
 fix: 修复bug
 docs: 仅仅修改了文档
 style: 仅仅修改了空格、格式缩进、逗号等等,不改变代码逻辑
 refactor: 代码重构,没有加新功能或者修复bug
 perf: 优化相关,比如提升性能、体验
 test: 增加测试用例
 chore: 改变构建流程、或者增加依赖库、工具等
 revert: 回滚到上一个版本