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

pgk-demo

v1.0.0

Published

package demo

Readme

plugin

    "rollup-plugin-alias": "^2.2.0", // alias 和 reslove 功能 给路径模块别名
    "rollup-plugin-babel": "^4.4.0", 
    "rollup-plugin-clear": "^2.0.7",
    "rollup-plugin-commonjs": "^10.1.0", // cjs => esm
    "rollup-plugin-json": "^4.0.0",  // 支持在源码中直接引入json文件
    "rollup-plugin-node-resolve": "^5.2.0", // 解析 node_modules 中的模块
    "rollup-plugin-replace": "^2.2.0",
    "rollup-plugin-terser": "^7.0.2",
    "rollup-plugin-eslint": "^7.0.0",

eslint验证代码是否符合定义的规范

● eslint-plugin-vue:vue.js的Eslint插件(查找vue语法错误,发现错误指令,查找违规风格指南)
● eslint-plugin-prettier:运行更漂亮的Eslint,使prettier规则优先级更高,Eslint优先级低
● eslint-config-prettier:让所有与prettier规则存在冲突的Eslint rules失效,并使用prettier进行代码检查
● @babel/eslint-parser:该解析器允许使用Eslint校验所有babel code

yarn add -D eslint 
// 生成配置文件,.eslintrc.js
npx eslint --init 

pretter格式化代码符合定义的规范

yarn -D eslint-plugin-prettier prettier eslint-config-prettier
main 是npm包的主要入口文件,当导入一个包时,实际上就是使用的main指向的地址文件。 
main是遵循commonjs规范的,使用module.exports 。 
module是ESM规范,是前端使用比较多的规范,使用import/export。

如果使用import导入库,最开始匹配module的文件,找不到则使用main指向的文件。 rollup打包工具提供了多种打包格式,可以在output中进行设置。
● amd – 异步模块定义,用于像RequireJS这样的模块加载器
● cjs – CommonJS,适用于 Node 和 Browserify/Webpack
● esm – 将软件包保存为 ES 模块文件,在现代浏览器中可以通过 
● iife – 一个自动执行的功能,适合作为 
● umd – 通用模块定义,以amd,cjs 和 iife 为一体
● system - SystemJS 加载器格式

files指定发布包的内容

开发过程中,项目文件比较多,包含了src、script、examples、dist等文件。在 npm 发包时,实际发包内容可以在 package.json 中 files 字段进行设置,只需将构建后资源dist(如果需要构建)进行发包,源文件最好不发,这样可以大大要锁安装包时需要下载包的大小。
devDependencies和dependencies的区别
进行日常业务开发时,这两个并无多大区别,因为当执行npm install或者yarn时,这两个配置的包都会进行下载。
对于库开发时,两者会有区别。
当安装一个库文件是 npm install react,就只会安装react项目下dependencies中的依赖,通俗的讲,react的运行是需要这些包的支持,如果不安装这些包,react的功能就无法实现。 devDependencies 下的依赖,只是进行开发是需要进行下载的。
homepage repository bugs等地址
● homepage: 设置git中的地址,如github.com/shenshuai89…
● repository: 设置仓库地址
● bugs:设置bugs的提交地址
    "major": "npm version major -m 'build: update major'", // 只更新 大版本
    "minor": "npm version minor -m 'build: update minor'", // 只更新 中版本
    "patch": "npm version patch -m 'build: update patch'", // 只更新 小版本
    "pub": "npm run build && npm publish --access=public", // 发布
    "pub:major": "npm run major && npm publish --access=public", // 更新后发布
    "pub:minor": "npm run minor && npm publish --access=public", // 更新后发布
    "pub:patch": "npm run patch && npm publish --access=public" // 更新后发布