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

utils-fun-description

v1.0.12

Published

💡 读书笔记正是帮助你记录和回顾的工具,不必拘泥于形式,其核心是:记录、翻看、思考

Readme

💡 读书笔记正是帮助你记录和回顾的工具,不必拘泥于形式,其核心是:记录、翻看、思考

| 书名 | 纯js发布npm包 | | --- | --- | | 作者 | 王哈哈哈 | | 状态 | 完成 | | 简介 | 其他项目中直接安装npm包引入js工具函数 |

文件截图

用思维导图,结构化的核心观点。

代码片段

安装以及发布事项

安装使用

发布

  1. 创建文件夹
    1. mkdir xxxxx
  2. 创建package.json
    1. npm init -y( y指自动创建 )
  3. 设置入口文件
    1. main:"index.js"
  4. 包名
    1. 这个不能重复,你可以现在npm仓库里搜索下你想创建的包,没有才可以创建
  5. 描述、版本等等之类
    1. 版本是每发一次包都要加个版本
  6. 发布
    1. 需要npm login 登录了才可以发布
    2. 登录了执行npm publish
    3. 注意下 有不有报错
    4. 至此 发布成功

添加ts类型

你如果在vue3里引入包的话,会提示类型丢失

  1. 跟index.js 同目录添加了index.d.ts 类型
export declare function getCurrentMonth(type: string,isShowHour: boolean): string;
export declare function numberCapitalize(money: number): string;
  1. 这样没的工具函数引入的时候都有提示,但你偷懒的话,可以全部工具写any
declare module '你的包名' {  // 替换为你的包名(如 utils-fun)
  // 导出所有模块(类型为 any,仅解决报错,无类型提示)
  const content: any;
  export default content;
}
  1. 最后需要在package.json里添加types: 'index.d.ts', 然后重新发布就有了

后续出vue发布npm版本,敬请期待