npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

markus-diff

v1.0.10

Published

A tool to analyze and reconstruct project structures

Downloads

642

Readme

Markus-Diff

A powerful tool to analyze and reconstruct project structures. This tool helps you analyze existing projects and recreate them in different locations while preserving their structure and dependencies.

Features

  • 📊 Project Structure Analysis
  • 🔄 Project Recreation
  • 📁 Smart File Scanning
  • 🎯 Framework Detection
  • 📦 Dependencies Management
  • 🚫 Respects .gitignore
  • 🔍 Detailed Project Statistics
  • 🔄 Git-based Analysis

Installation

npm install -g markus-diff

Usage

Basic Analysis

markus-diff

This will analyze the current directory and generate code.json.

Advanced Analysis

markus-diff -d ./my-project -o ./analysis.json -n "My Project" -v "2.0.0"

Options:

  • -d, --dir <directory> - Project directory (default: current directory)
  • -o, --output <path> - Output file path (default: ./code.json)
  • -n, --name <name> - Project name
  • -v, --version-tag <version> - Version tag for the analysis (default: "1.0.0")

Project Recreation

markus-diff init -i ./analysis.json -d ./new-project

Options:

  • -i, --input <file> - Analysis JSON file (required)
  • -d, --dir <directory> - Target directory (default: current directory)

Git-based Analysis

markus-diff --git-master -o ./analysis.json

This command will:

  1. Safely stash any uncommitted changes
  2. Switch to master branch
  3. Create a temporary merge state with your current branch
  4. Generate the analysis from this merged state
  5. Clean up the merge and return to your original branch
  6. Restore any stashed changes

This is particularly useful for:

  • Analyzing changes before merging to master
  • Reviewing the impact of your branch changes
  • Generating documentation for pull requests
  • Validating project structure modifications

Note: Ensure your git working directory is clean or has changes that can be safely stashed.

Generated Output Structure

{
  "name": "project-name",
  "type": "project:analysis",
  "version": "1.0.1",
  "generatorVersion": "1.0.1",
  "timestamp": "2024-03-21T10:00:00.000Z",
  "git": {
    "sourceBranch": "feature/new-feature",
    "targetBranch": "master",
    "lastCommit": {
      "hash": "abc123...",
      "subject": "Add new feature",
      "author": "John Doe",
      "date": "Wed Mar 20 2024 10:00:00 GMT+0000"
    }
  },
  "structure": {
    "framework": "react",
    "hasTypescript": true,
    "hasSrcDir": true
  },
  "stats": {
    "totalFiles": 42,
    "filesByType": {
      "javascript": 15,
      "typescript": 20,
      "css": 5,
      "json": 2
    },
    "totalSize": 150000
  },
  "dependencies": {
    "react": "^18.0.0",
    "next": "^13.0.0"
  },
  "devDependencies": {
    "typescript": "^5.0.0"
  },
  "files": [...]
}

The output includes two version fields:

  • version: The schema version of the output JSON
  • generatorVersion: The version of markus-diff that generated the analysis

Supported Features

File Types

  • JavaScript (.js, .mjs, .cjs)
  • TypeScript (.ts, .tsx)
  • React (.jsx)
  • Vue (.vue)
  • Svelte (.svelte)
  • CSS/SCSS/LESS
  • JSON and configuration files

Frameworks

  • React
  • Next.js
  • Vue.js
  • Svelte
  • Angular

Excluded by Default

  • node_modules/
  • dist/
  • build/
  • .git/
  • Binary files
  • Lock files (package-lock.json, yarn.lock)

Quick Start Example

  1. Analyze a project:
cd my-project
markus-diff -o analysis.json
  1. Recreate it elsewhere:
markus-diff init -i analysis.json -d ../new-project
  1. Setup the new project:
cd ../new-project
npm install

Common Use Cases

  • Project templating
  • Structure analysis
  • Dependency auditing
  • Project migration
  • Creating snapshots

Limitations

  • Binary files not included
  • Some framework features need manual setup
  • Large projects generate large JSON files

Contributing

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

License

MIT License - see the LICENSE file for details.

Support

For issues or questions, please file an issue on the GitHub repository.