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 🙏

© 2024 – Pkg Stats / Ryan Hefner

zhlt-utils

v0.2.0

Published

Common utility methods for zhlt frontend projects

Downloads

2

Readme

zhlt-utils

一个前端公共函数库

Why?

之前前端没有做工程化,公共函数全部放在一个或几个.js文件中(可参考服务号及运营活动的代码)。虽然服务号和所有的活动使用的是同一份公共函数的代码,但是有很多代码并不是服务号和活动通用的,而且有些代码是某个活动才有的,但却在每个活动中都引入了。同时,因为除公众号和运营活动之外,其它的项目也都在往工程化的道路上走。因此,抽出一个公共的npm包也是顺理成章的事了。

Introduction

该项目希望可以尽量加入更多的工程化元素。当前已有的流程包括:

  • 单元测试
  • 统一的提交Message格式
  • 统一格式和代码风格(prettier & eslint)
  • 模块化

单元测试

使用jest(参考链接)。测试脚本放在__test__下,建议根据src的目录结构来阻止__test__下的目录结构。如果是之前已有的函数,在写单元测试时可以不用那么细致,如果是一个新的公共函数,请开发者尽可能详尽地写好单元测试。

Git Commit Message

Git的提交格式使用commitlint(参考链接)。配置信息请查看commitlint.config.js

格式和代码风格

统一各个编辑器的格式,使用的是prettier(参考链接)。配置信息请查看.prettierrc.js

代码风格使用eslint。配置信息请查看.eslintrc.js(该文件只配置了一些基础的规则,之后打算将各个配置文件集合成一个命令行工具,更便捷地管理和开发)

模块化

基于服务号使用的core.js和其它的常用公共函数文件,整理后在src目录下按模块管理。

Usage

安装和使用

  npm i zhlt-utils -S
  import zhltUtils from 'zhlt-utils'

开发,git clone之后

  npm run dev

Any question? Create an issue~