froatsnook:zombie-helpers

v1.0.1Published 9 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

During the development of a large meteor application, I noticed that many helpers were unused and hanging around until someone figured out it was time to delete them.

This package inserts itself between meteor and your helpers. It provides a function you can call to get a list of helpers that were never called.

Usage

Step 1: install

meteor add froatsnook:zombie-helpers

Step 2: use your application

Start your application and use all the features you can.

Step 3: call ZombieHelpers

1Package["froatsnook:zombie-helpers"].ZombieHelpers()
2// => ["Template.welcome.helper1", "Template.welcome.helper3", "Template.xyz.helper4"]

You can also provide a template name to just get a list of zombie helpers for that template:

1Package["froatsnook:zombie-helpers"].ZombieHelpers("xyz")
2// => ["Template.xyz.helper4"]

Debug Only

This package is debug only. That's why the ZombieHelpers function can't be accessed except through Package. It also means that it won't cause any slowdown when you run in production (not that it should ever cause a noticeable slowdown when not in production).

How it works

It overwrites Template.prototype.helpers and replaces each of your helpers with another function that increments a count for that helper before calling the original helper. That's it!

Future Work

  • Add a UI that displays helpers per template sorted by usage count.
  • Tests

License

MIT