1.0.10 • Published 4 months ago

nextjs-unused-file-finder v1.0.10

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

Next.js Unused File Finder

Overview

nextjs-unused-file-finder is a powerful CLI tool designed to help developers find unused files, dependencies, and functions in Next.js 13+ (App Router and beyond). By identifying unnecessary code, this tool helps you keep your project lean, optimized, and maintainable.

Features

  • šŸ›  Find unused files across your Next.js project (excluding Next.js-specific files in src/app/**)
  • šŸ“¦ Detect unused dependencies in package.json
  • šŸ” Identify unused functions within JavaScript and TypeScript files
  • ⚔ Works with Next.js 13+ (App Router and above)

Installation

Install the package globally via NPM:

npm install -g nextjs-unused-file-finder

Usage

Scan Your Next.js Project

Run the following command in your project root:

unused-finder

Scan a Specific Directory

Specify a directory to analyze:

unused-finder /path/to/project

Run the File Directly

If needed, execute the tool directly via:

node /path/to/node_modules/unused-finder/file

How It Works

  1. šŸ“‚ Scans all JavaScript & TypeScript files in your Next.js project
  2. šŸ“‘ Extracts imported dependencies and functions
  3. šŸ“Š Compares against package.json & function calls to detect unused items
  4. šŸš€ Lists out unused files, excluding Next.js routing files under `src/app/`**

Example Output

Scanning directory: /your/nextjs/project

Unused dependencies found:
- lodash
- moment

Unused functions found:
- formatDate in utils/date.ts
- fetchUserData in services/api.ts

Unused files found:
- src/components/OldComponent.tsx
- src/utils/unusedHelper.ts

Ignored Files

By default, nextjs-unused-file-finder automatically ignores certain Next.js-specific files:

  • middleware.ts
  • layout.tsx
  • global.css
  • template.tsx
  • All files inside `src/app/`** (since they may be used via Next.js routing)

Why Use This Tool?

āœ… Improve Performance – Reduce unnecessary dependencies and files āœ… Optimize Build Times – Remove unused code for faster builds āœ… Enhance Maintainability – Keep your Next.js 13+ project clean and structured āœ… Easy to Use – Just run a single command to detect unused code

Contributing

We welcome contributions! Feel free to open issues or submit pull requests to improve the tool. šŸš€

License

Released under the MIT License.


šŸ“¢ Get started now and optimize your Next.js 13+ project with nextjs-unused-file-finder!

1.0.10

4 months ago

1.0.9

4 months ago

1.0.8

4 months ago

1.0.7

4 months ago

1.0.6

4 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago