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

lf-npm-test

v0.0.3

Published

一个测试用npm包

Readme

发布npm包

项目托管地址

https://gitee.com/windRainCode/lf-npm-test

参考文章

手把手教你用npm发布包: https://blog.csdn.net/taoerchun/article/details/82531549

如何使用npm发布自己的npm包:https://blog.csdn.net/zyg1515330502/article/details/81112653

01-注册npm账户

地址:https://www.npmjs.com/

02-本地登录npm

命令

npm login

image-20220212115032640

查看npm

1.查看当前的镜像地址

npm get registry 

设成淘宝的

npm config set registry http://registry.npm.taobao.org/

将npm替换为cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org

安装yarn(全局安装yarn)

cnpm install yarn -g 

2.换成原来的

npm config set registry https://registry.npmjs.org/

针对mac 设置默认node版本

首先切换到 你的版本号

nvm use 8.10.0

之后设置微默认的版本

nvm alias default 8.10.0

03-创建项目

npm init

文件内容

{
  "name": "lf-npm-test",
  "version": "0.0.1",
  "description": "一个测试用npm包",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "lf"
  ],
  "repository": {
    "type": "git",
    "url": "https://gitee.com/windRainCode/lf-npm-test.git"
  },
  "author": "linFen",
  "license": "ISC"
}

04-编写代码

index.js

// 计算总数
sum = function () {
  let res = 0;

  for (let i = 0; i < arguments.length; i++) {
    res += arguments[i];
  }

  return res;
};


exports = {
  sum,
};

05-上传npm包

npm publish

上传完之后可以在npm中看到自己的包

image-20220212143759846

06-项目中使用包

安装包

npm install --save lf-npm-test

使用包

let { sum } = require('lf-npm-test');
console.log(sum(1, 2, 3, 4, 5));

image-20220212144539365

07-其他情况

07-A 更新已经发布的包

第一步、修改包的版本

npm version patch

该命令在原来的版本上自动加1,实际上是将package.json文件中的version值修改了。

第二步、重新发布包

npm publish

07-B 删除已发布的包

删除指定的版本

npm unpublish 包名@版本号

2、删除整个包

npm unpublish 包名 --force