Package Exports
- project-line-counter
- project-line-counter/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (project-line-counter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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:
- Scanning your project directory (excluding node_modules and hidden folders)
- Identifying files with the selected extensions
- Reading each file and removing comment lines:
- For JavaScript/TypeScript: Removes both /_ block comments _/ and // line comments
- For Python: Removes # line comments
- Counting the remaining lines of code
- 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
- Fork the repository on GitHub
- Clone your fork to your local machine:
git clone https://github.com/TTibbs/project-line-counter
- Install dependencies:
cd count-lines
npm install
Making Changes
- Create a new branch for your changes:
git checkout -b your-feature-branch
- Make your changes to the code
- Test your changes thoroughly
- Commit your changes with a descriptive message:
git commit -m "Add support for new language"
Submitting a Pull Request
- Push your changes to your fork:
git push origin your-feature-branch
- Go to the original repository on GitHub
- Click "New Pull Request"
- Select your fork and branch
- Add a title and description explaining your changes
- Submit the pull request
Code Style
- Use consistent indentation (2 spaces)
- Follow TypeScript best practices
- Add comments for complex logic
- Update documentation for any new features
License
MIT