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

pkg-initor

v1.0.6

Published

npm包开发的脚手架

Downloads

7

Readme

npm包开发的脚手架

  1. 打包工具(rollup)
    模块化配置在rollup.config.base.js
  2. 代码风格(eslint+pretter)
    配合webstorm,在每次保存的时候自动校验
  3. git暂存区代码校验(lint-staged + husky + commitlint)
    使用npm run commit代替git commit,提交时会自动校验,并规范化commit
  4. 测试工具(jest)
    在__test__目录中写测试用例,用npm run test:c运行测试
  5. 各种发布地址
    package.json中配置:cdn地址、git仓库地址、github的readme地址、bug提交地址
  6. 本地测试(yalc)
    模拟发布,用来调试编写的代码
  7. npm发布
    在package.json中配置了对应命令

git提交方式

每次提交都会校验代码
使用npm run commit 代替 git commit

git add .
npm run commit # 根据提示编写commit

在本地调试库

使用工具:yalc

  1. 把库进行模拟发布
yalc publish # 发布到本地虚拟仓库
yalc push # 对库修改后,进行推送
  1. 项目中使用并调试库
    当库被yalc push后,需要重启项目环境
# 项目中安装库,类似npm i stcm-rw
yalc add stcm-rw
# package.json中会出现:"stcm-rw": "file:.yalc/stcm-rw"
# node_modules中会出现stcm-rw
  1. 测试结束,删除yalc包,才能正常使用

发布至npmjs

  1. 注册npm账号:https://www.npmjs.com/
  2. 切换到npm默认源
npm i nrm -g
nrm use npm
  1. 在终端登录npm
cd pkg-init # 切换到项目目录
npm login
# 输入用户名、密码、邮箱
# 输入邮箱中收到的一次性验证码
  1. 更新后发布
    运行命令后,会自动更新版本号,再更新或发布
    更新命令,只会上传新代码,但是外部不能访问
    发布命令,对外公开可用
npm run major,      // 只更新 大版本
npm run minor,      // 只更新 中版本
npm run patch,      // 只更新 小版本
npm run pub,        // 发布
npm run pub:major,  // 更新后发布
npm run pub:minor,  // 更新后发布
npm run pub:patch,  // 更新后发布