armageddon
If you want to know what the heck is going on in your ridiculously bloated code base, this module is for you. However, use at your own risk.
Last updated a year ago by joeltok .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install armageddon 
SYNC missed versions from official npm registry.

Armageddon

Introduction

Inject a console.log marker into every single multi-line function of your JavaScript application, so that you can trace the flow of your program.

Especially useful for large, bloated and convoluted code bases.

WARNING: This module changes your code base directly (meaning actual files have their contents changed), be very very careful when using this module. The best thing to do before running this module would be to backup your code base and all its recent changes using some kind of version control system.

Note that only files with a .js suffix are changed.

Installation

npm install -g armageddon

Usage

Quick Start

cd path/to/directory/of/js/files
git stash
git checkout -b boom
armageddon ./
git stash save --keep-index
git stash drop
git branch -D boom

Breakdown of commands

Start at the directory of js files you want to trace flow through.

cd path/to/directory/of/js/files

Backup current code base. This uses git, but use whatever version control system you want.

git stash
git checkout -b boom

Run armageddon.

armageddon ./ # you may specify any relative path in place of "./"

This will:

  1. Trigger a recursive search for JavaScript files at the target location, by using the .js suffix of each file.
  2. Inject a console.log('ARMA[marker]') line into every single multi-line function in each of these files.

When the files are then run using node, ARMA[marker]s will then be printed into the logs as you move through the code base. This will allow you to trace the flow through your code base, something especially useful for code bases that are extremely convoluted.

After the problem has been identified, revert back to the original code base without the vandalism.

git stash save --keep-index
git stash drop
git branch -D boom

Result of using the module

Example of what happens to the code base.

Original:

// example.js

function x(arg1, arg2) {
	var x = 2
	return x + x
}

() => {
	return 'I am an anonymous function'
}

New:

// example.js

function x(arg1, arg2) {console.log('ARMA1');
	var x = 2
	return x + x
}

() => {

	console.log('ARMA2');

	return 'I am an anonymous function'
}

Testing

npm run test

Current Tags

  • 2.0.0                                ...           latest (a year ago)

10 Versions

  • 2.0.0                                ...           a year ago
  • 1.0.9                                ...           3 years ago
  • 1.0.8                                ...           3 years ago
  • 1.0.6                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 2
Dependencies (5)
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |