JavaScript::Dependency::Manager - Manage your JavaScript dependencies
version 0.001002
First, annotate your javascript files with provides and/or requires:
provides
requires
// provides: Ack // requires: underscore var Ack = _.throttle(function(foo) { alert('ACK! ' + foo) }, 100) // etc, etc
Now you can use JavaScript::Dependency::Manager to automatically create a list of files needed for a given "provision".
JavaScript::Dependency::Manager
use JavaScript::Dependency::Manager; my $mgr = JavaScript::Dependency::Manager->new( lib_dir => ['root/js/lib'], provisions => { underscore => ['root/js/lib/underscore/underscore.js'], }, ); my @files = $mgr->file_list_for_provisions(['Lynx.ui.form.MWHY']);
Note that I manually set a provision above. That's because underscore is an external library, so I shouldn't edit it's source to set it's provisions.
underscore
This module simply helps you automatically create a list of necessary files based on a list of "modules", which are merely your way of identifying functions, objects, classes, or whatever else that you would like to load. It will correctly order the list of files to load based on your defined requirements.
A requirement is simply a module that a given file needs to run.
requirement
A provision is simply a module that a given file has within it.
provision
my @files = $mgr->file_list_for_provisions(['Foo', 'Bar'])
This method returns a list of files needed to load a list of provisions.
required. An ArrayRef of directories to scan to create the list of "requirement"s and "provision"s.
ArrayRef
False by default. Set to true if you want the tool to recurse into subdirectories of the "lib_dir".
True by default. Set to false if you want the tool not to scan files at all, but instead use a provided list of "requirement"s and "provision"s.
JavaScript::Dependency::Manager module is dedicated to my namesake, Arthur Dale Schmidt. He was my grandfather as well as the inventor of a chemical called Sand Control 60 (SC60,) which was used in oil fields to reduce the need to redrill entire wells due to sand clogging.
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
This software is copyright (c) 2012 by Arthur Axel "fREW" Schmidt.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install JavaScript::Dependency::Manager, copy and paste the appropriate command in to your terminal.
cpanm
cpanm JavaScript::Dependency::Manager
CPAN shell
perl -MCPAN -e shell install JavaScript::Dependency::Manager
For more information on module installation, please visit the detailed CPAN module installation guide.