markus-diff v1.0.10
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 JSONgeneratorVersion
: 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
- Analyze a project:
cd my-project
markus-diff -o analysis.json
- Recreate it elsewhere:
markus-diff init -i analysis.json -d ../new-project
- 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
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature
) - Commit changes (
git commit -m 'Add amazing feature'
) - Push to branch (
git push origin feature/amazing-feature
) - 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.