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

comment-counter

v1.1.0

Published

- 前端项目注释率统计(支持国际化) - 目前仅支持英语和中文(Only English and Chinese are supported.) - 作者/Author: Neo ([email protected])

Readme

✨ 注释率统计工具(支持国际化)

  • 前端项目注释率统计(支持国际化)
  • 目前仅支持英语和中文(Only English and Chinese are supported.)
  • 作者/Author: Neo ([email protected])

⚙ 用法 Usage

标准运行 Common Run

// 引入包
const commentCount = require('commentCount');
// 标准运行
commentCount.run();

带参数运行 Run with arg

// 引入包
const commentCount = require('commentCount');
// 带参数运行
const filterList = [
    './node_modules',
];
// 指定统计某些类型的文件
const countType = ['.js', 'ts'];
const config = {
    filterList, countType
}
/**
 * @param dir 需要统计的项目目录, 统计当前目录:./
 * @param config 配置文件
 *  @param config.filterList 需要过滤的文件夹和文件,可以不提供,默认添加了javascript项目常见的过滤目录
 *  @param config.countType 需要统计的文件类型,默认为['.js','.jsx','.ts','.tsx','.vue']
 * @description 默认配置,请看包目录下的config.js
 * @description 支持国际化,请修改包目录下的i18n.js配置文件
 * **/
commentCount.run('./', config);

📝 默认过滤规则 Default filter rules

  • 当不提供过滤列表时,工具会默认使用以下过滤配置
  • 过滤了大部分的业务无关的文件
filterList = [
    './node_modules',
    './.vscode',
    './.idea',
    './husky',
    './.git',
    './.tscache',
    './.eslintrc.js',
    './.stylelintrc.js',
    './jest.config.js',
]

配置npm run count

  • 在package.json中添加scripts
{
    // ......
    scripts: {
        // 配置执行的脚本
        // 案例为: 统计当前目录下:./ 的所有.js .ts文件, 第一个参数为路径, 其余参数为文件类型 , 使用空格间隔
        "count": "node ./node_modules/commentcount/index.js ./ .js .ts"
    }
    // ......
}
  • 添加上述配置后,执行:
npm run count
  • 结果:Result

https://github.com/ethwillupto10000/comment-counter/blob/master/example.png