{"_id":"@amir-bagjani/loc-counter","name":"@amir-bagjani/loc-counter","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@amir-bagjani/loc-counter","version":"0.1.0","description":"CLI to count lines of code in frontend projects","main":"dist/loc-counter.js","types":"dist/loc-counter.d.ts","bin":{"loc-counter":"dist/loc-counter.js"},"publishConfig":{"access":"public"},"scripts":{"build":"tsc -p tsconfig.json","prepack":"npm run build","test":"echo \"no tests\"","prepare":"npm run build"},"repository":{"type":"git","url":"git+https://github.com/amir-bagjani/loc-counter.git"},"keywords":["cli","loc","lines-of-code","typescript"],"author":{"name":"Amir Bagjani","email":"amirbagjani@gmail.com"},"license":"MIT","engines":{"node":">=16"},"_id":"@amir-bagjani/loc-counter@0.1.0","gitHead":"b388f48188b830b420feaafb2a0803bd6cfdf68f","bugs":{"url":"https://github.com/amir-bagjani/loc-counter/issues"},"homepage":"https://github.com/amir-bagjani/loc-counter#readme","_nodeVersion":"22.9.0","_npmVersion":"11.0.0","dist":{"integrity":"sha512-RZEktu3hK7Wc30K4xRiP9BOKsZjpIzhPXASIt9/DiLALR6I3aIIOG+rL9uwriQhcsZy2Xmewst5tFz6+2B0YfQ==","shasum":"14a883bba9875f5ebcc0fbac8239773049cc68e3","tarball":"https://registry.npmjs.org/@amir-bagjani/loc-counter/-/loc-counter-0.1.0.tgz","fileCount":6,"unpackedSize":21377,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICXnVPGnc/9mx+KEK91QmUoM15Xl8CHhBkKGV+JzD1cFAiEA20MzVvtzdU+O/+emCYiIVi/fB+Zi/tiwpdZLkLOU1h4="}]},"_npmUser":{"name":"amir-bagjani","email":"amirbagjani@gmail.com"},"directories":{},"maintainers":[{"name":"amir-bagjani","email":"amirbagjani@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/loc-counter_0.1.0_1758716673196_0.8853199969362004"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-24T12:24:33.128Z","0.1.0":"2025-09-24T12:24:33.386Z","modified":"2025-09-24T12:24:33.636Z"},"maintainers":[{"name":"amir-bagjani","email":"amirbagjani@gmail.com"}],"description":"CLI to count lines of code in frontend projects","homepage":"https://github.com/amir-bagjani/loc-counter#readme","keywords":["cli","loc","lines-of-code","typescript"],"repository":{"type":"git","url":"git+https://github.com/amir-bagjani/loc-counter.git"},"author":{"name":"Amir Bagjani","email":"amirbagjani@gmail.com"},"bugs":{"url":"https://github.com/amir-bagjani/loc-counter/issues"},"license":"MIT","readme":"# loc-counter\n\n[![npm version](https://img.shields.io/npm/v/@amir-bagjani/loc-counter.png)](https://www.npmjs.com/package/@amir-bagjani/loc-counter)\n[![npm downloads](https://img.shields.io/npm/dm/@amir-bagjani/loc-counter.png)](https://www.npmjs.com/package/@amir-bagjani/loc-counter)\n\nA simple CLI tool written in **TypeScript** that counts lines of code in your project.  \nDesigned for frontend projects, it ignores non-code files (Markdown, images, lockfiles, etc.) and provides per-extension breakdowns.\n\n---\n\n## ✨ Features\n\n- Count total lines, non-empty lines, and comment-only lines\n- Per-extension statistics\n- Top N largest files by line count\n- JSON or text output\n- Optional file count mode\n- Ignores common non-code files (`.md`, `.json`, images, etc.)\n\n---\n\n## 📦 **Installation**\n\n```bash\n# install globally\nnpm install -g @amir-bagjani/loc-counter\n\n# or use with npx (no install required)\nnpx @amir-bagjani/loc-counter ./my-project\n```\n\n---\n\n## 🚀 Usage\n\n```bash\nloc-counter <path> [options]\n```\n\n### Examples\n\n```bash\n# Count lines in current folder\nloc-counter .\n\n# Show top 5 largest files\nloc-counter ./src --top 5\n\n# Output results in JSON format\nloc-counter ./app --format json\n\n```\n\n---\n\n## ⚙️ Options\n\n| Flag              | Description                                                                 | Default |\n|-------------------|-----------------------------------------------------------------------------|---------|\n| `--top <N>`       | Show the N largest files by line count                                      | 10      |\n| `--format <type>` | Output format: `text` or `json`                                             | text    |\n---\n\n## 📊 Example Output\n\n### Text format\n\n```\nLOC Counter report\nTarget: ./src\nFiles counted: 124\nTotal lines: 13842\nNon-empty lines: 11239\nComment-only lines (heuristic): 2123\n\nPer-extension breakdown:\n  ts     files:   34  lines:    7200  non-empty:   5800  comments:   900\n  js     files:   20  lines:    3000  non-empty:   2500  comments:   200\n\nTop largest files:\n   1024 lines  src/App.tsx\n    900 lines  src/components/BigComponent.tsx\n```\n\n### JSON format\n\n```json\n{\n  \"target\": \"./src\",\n  \"total\": {\n    \"lines\": 13842,\n    \"nonEmpty\": 11239,\n    \"comments\": 2123\n  },\n  \"perExtension\": {\n    \".ts\": { \"files\": 34, \"lines\": 7200, \"nonEmpty\": 5800, \"comments\": 900 },\n    \".js\": { \"files\": 20, \"lines\": 3000, \"nonEmpty\": 2500, \"comments\": 200 }\n  },\n  \"topLargest\": [\n    { \"file\": \"src/App.tsx\", \"stats\": { \"lines\": 1024, \"nonEmpty\": 800, \"comments\": 120, \"extension\": \".ts\" } }\n  ]\n}\n```\n\n---\n\n## 🛠 Development\n\nClone and build locally:\n\n```bash\ngit clone https://github.com/amir-bagjani/loc-counter.git\ncd loc-counter\nnpm install\nnpm run build\n```\n\nRun with ts-node (development mode):\n\n```bash\nnpx ts-node src/loc-counter.ts ./my-project\n```\n\n---\n\n## 🤝 Contributing\n\nContributions, issues, and feature requests are welcome!  \nFeel free to check the [issues page](https://github.com/amir-bagjani/loc-counter/issues).\n\n---\n\n## 📄 License\n\nMIT © [Amir Bagjani](https://github.com/amir-bagjani)","readmeFilename":"README.md","_rev":"1-1933803e07d37d66cc659b6d31955e2d"}