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

vicky-sparrow

v1.0.0

Published

- 基于webpack进行资源构建 - 使用es6语法进行开发 - 将包输出为umd规范的文件 - 使用mocha和chai进行测试 - 使用eslint来进行代码检查 - 基于npm scripts来集成开发命令 - 代码push到github - 将包发布到npm

Readme

如何开发一个属于自己的前端类库

  • 基于webpack进行资源构建
  • 使用es6语法进行开发
  • 将包输出为umd规范的文件
  • 使用mocha和chai进行测试
  • 使用eslint来进行代码检查
  • 基于npm scripts来集成开发命令
  • 代码push到github
  • 将包发布到npm

基于开发环境

  • 全局环境 node & npm
  • 命令行: terminal & shell
  • 版本管理: git
  • 编辑器: webstorm2016
  • 浏览器:chrome
  • 注册npm账号
  • 注册github账号

创建项目的基本结构

src  开发源代码
lib  编译后的资源
test 测试用例
.gitignore
LICENSE
README.md
package.json
webpack.config.js
.babelrc
.selint.js

##结合webpack跑通es6语法编译过程

  • webpack.config.js
npm install webpack webpack-dev-server --save-dev
  • babel及其相关preset、plugin、loader
npm install babel-loader babel-core babel-preset-es2015 babel-plugin-add-module-exports --save-dev

babel-preset-es2015-loose babel-preset-stage-0 babel-preset-es2016 ##umd

npm install babel-plugin-transform-es2015-modules-umd --save

##webpack几个小配置

  • resolve extension 拓展名,方便 root 添加默认搜索路径,但得是绝对路径,可以是数组和字符串
  • devtool开发工具配置 cheap-source-map ##区分开发环境和生产环境
  • sparrow.js(开发环境,未压缩校验,一些开发环境的配置和代码)
  • sparrow.min.js(生产环境)
process.env.WEBPACK_ENV
yargs
	npm i yargs --save-dev
	var mode = require('yargs').argv.mode;

##将用于生产环境的代码压缩

webpack.optimize.UglifyJsPlugin
  • 提供生产环境和开发环境的文件名需要区分 ##eslint
npm i eslint eslint-loader --save-dev
eslint --init

##测试

  • mocha测试框架
  • chai断言库

##代码push到github

将包发布到npm

npm adduser
npm publish