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

project-line-counter

v1.0.2

Published

A simple CLI tool to count lines of code by language.

Downloads

11

Readme

Count-Lines

A simple command-line tool that counts lines of code in your project, excluding comments. It supports TypeScript, JavaScript, and Python files.

Features

  • Counts non-comment lines of code in your project
  • Skips node_modules and hidden folders
  • Works with TypeScript (.ts, .tsx), JavaScript (.js, .jsx), and Python (.py) files
  • Interactive mode with easy language selection
  • Command-line flags for quick counting

Installation

npm install -g count-lines

Usage

Interactive Mode

Simply run the command without any flags to enter interactive mode:

count-lines

You'll be prompted to select which language you want to count or choose "All" to count all supported languages.

Command-line Flags

You can also use command-line flags to specify which language to count:

count-lines --typescript    # Count only TypeScript files
count-lines --javascript    # Count only JavaScript files
count-lines --python        # Count only Python files
count-lines --all           # Count all supported languages

How It Works

Count-Lines works by:

  1. Scanning your project directory (excluding node_modules and hidden folders)
  2. Identifying files with the selected extensions
  3. Reading each file and removing comment lines:
  • For JavaScript/TypeScript: Removes both /_ block comments _/ and // line comments
  • For Python: Removes # line comments
  1. Counting the remaining lines of code
  2. Displaying a summary with files scanned and total lines count

Contributing

We welcome contributions to Count-Lines! Here's how you can help:

Setting Up for Development

  1. Fork the repository on GitHub
  2. Clone your fork to your local machine:
git clone https://github.com/TTibbs/project-line-counter
  1. Install dependencies:
cd count-lines
npm install

Making Changes

  1. Create a new branch for your changes:
git checkout -b your-feature-branch
  1. Make your changes to the code
  2. Test your changes thoroughly
  3. Commit your changes with a descriptive message:
git commit -m "Add support for new language"

Submitting a Pull Request

  1. Push your changes to your fork:
git push origin your-feature-branch
  1. Go to the original repository on GitHub
  2. Click "New Pull Request"
  3. Select your fork and branch
  4. Add a title and description explaining your changes
  5. Submit the pull request

Code Style

  1. Use consistent indentation (2 spaces)
  2. Follow TypeScript best practices
  3. Add comments for complex logic
  4. Update documentation for any new features

License

MIT