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 🙏

© 2025 – Pkg Stats / Ryan Hefner

this_is_a_test_module

v0.1.5

Published

组件

Readme

组件README

Wait for your magic hand!

构建

如果能够确定运行环境仅会在node端,那么可以直接使用es6的源码。

如果运行环境是不确定的,例如同时支持浏览器和node端,则需要进行构建

构建的方式有两种:

方式1: 打包为一个bundle

npm run build

构建结果会输出到 ./dist 目录下,如果需要自定义目录,请修改 ./builder/webpack.config.prod.js;

构建之后, 将 ./package.jsonmain 修改为你打包后的文件,例如

{
  "main": "./dist/bundle.js"
}

方式2: 使用babel进行compile,不打包

这种场景适合 Preact, React, lodash 作为 peerDependencies 的组件, 如果按照 方式1 打包为一个文件的话,会产生冗余,所以仅使用 babel 将es6 的代码转为es5。

npm run compile

编译结果会输出到 ./lib 目录下, 如果需要自定义目录,请修改 package.json 文件中的 script 脚本, 默认为 babel src -d lib

构建之后, 将 ./package.jsonmain 修改为打包后的入口文件,并添加对应的 peerDependencies 例如

{
  "main": "./lib/index.js",
  "peerDependencies": {
    "preact": "^6.0.2",
    "preact-redux": "^1.2.0",
    "redux": "^3.5.2"
  }
}

组件发布规范

基础组件需要完善的测试用例

基础组件影响面大,一旦出现问题,会有连锁效应。所以,一定要有完善的测试用例。另外,发布前一定要测试例通过才能发布。

不兼容的版本一定要发布major版本

比如当前版本号为 v1.3.4, 修改了一个不向后兼容的功能,发miror 和 patch 版本都会导致依赖的项目出现问题,为了避免对线上项目造成影响,需要升 major 版本,直接升级到 v2.0.0