nextjs-unused-file-finder v1.0.10
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
- š Scans all JavaScript & TypeScript files in your Next.js project
- š Extracts imported dependencies and functions
- š Compares against
package.json
& function calls to detect unused items - š 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
!