Skip to content

LMLK-seal/NodeOpti

NodeOpti

NPM Version License Downloads

NodeOpti

Intelligent dependency optimization and code refactoring for Node.js applications

NodeOpti is a comprehensive command-line tool that analyzes, optimizes, and refactors your Node.js projects. It automatically identifies unused dependencies, applies performance-focused code transformations, and provides detailed insights into your project's dependency graph.

Key Features

  • Automated dependency cleanup - Remove unused packages and optimize bundle size
  • Intelligent code refactoring - Apply performance-focused codemods to your source code
  • Dependency visualization - Interactive tree view with size and security annotations
  • Development acceleration - Mock heavy dependencies for faster local development
  • Security analysis - Identify and address known vulnerabilities

Installation

npm install -g nodeopti

Quick Start

# Analyze your project
nodeopti analyze

# Visualize dependencies
nodeopti tree

# Preview optimizations
nodeopti optimize

# Apply all optimizations
nodeopti optimize --apply

Commands

nodeopti analyze

Provides a comprehensive project health summary including unused dependencies, security vulnerabilities, and optimization opportunities.

nodeopti tree

Renders an interactive dependency tree with package sizes and security risk indicators.

nodeopti optimize

Identifies and applies code optimizations:

  • Dry run (default): Preview changes without modifying files
  • Apply mode (--apply): Automatically implement all optimizations

nodeopti install

High-performance package installer built on the pnpm engine.

# Install all dependencies
nodeopti install

# Add new packages
nodeopti install lodash express

Code Transformations

NodeOpti applies intelligent codemods to improve performance and reduce bundle size:

Lodash Optimizations

// Before
const _ = require('lodash');
if (_.isNil(value)) { ... }

// After
const isNil = require('lodash/isNil');
if (value == null) { ... }

Date Handling

// Before
moment().format('YYYY-MM-DD')

// After
new Date().toISOString().split('T')[0]

Development Features

Dependency Virtualization

Speed up local development by mocking heavy dependencies:

Configuration (package.json):

{
  "nodeOpti": {
    "virtualize": {
      "aws-sdk": { "mock": "./mocks/aws.mock.js" }
    }
  }
}

When you run nodeopti install, heavy packages are replaced with lightweight mocks, dramatically improving startup times.

Security & Performance

  • Built on the battle-tested pnpm engine
  • Disk-space efficient installations
  • Vulnerability scanning and reporting
  • Bundle size optimization

Requirements

  • Node.js 14.0.0 or higher
  • npm 6.0.0 or higher

Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support


Made with ❤️ by the NodeOpti team

About

Intelligent dependency optimization and code refactoring for Node.js applications.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published