Currently the developers are doing this manually - they look at YUI documentation, use YUI Configurator or copy and paste from the examples. The downsides of this approach are:
- Leads to errors and misconfigurations - it is not easy to determine the right combination of modules and for that reason developers often add wrong modules or they add more modules than neeed which only increases the network traffic. This even happens with the modules inside YUI for example Dial
- It is time consuming - determining the right combination of modules requires time and efforts
- It matches these classes to the modules in which they exists looking in data.json file, produced by YUIDoc.
var overlay =srcNode: '#myContent'visible: falsewidth: '20em';
In this case only one YUI class is used - Y.Overlay. So, he required module should be "overlay".
var YP = YPlugin;var YPA = YPAutoComplete;Yone'#ac-input'plugYPAresultFilters : 'phraseMatch' 'phraseMatchCase'resultHighlighter: 'phraseMatchCase'source: 'foo' 'bar' 'baz';
The above is a relatively complex example, because we have:
- Aliases, constructed by declaring variables - "var YP = Y.Plugin;" and "var YPA = YP.AutoComplete;"
- Some modules should be resolved by matching the values of class attributes. In the above example, 'phraseMatch' and 'phraseMatchCase' require "autocomplete-filters" module in addition to "autocomplete-plugin".
Methods, directly attached to Y instance will be resolved too. For example:
will match "node-core".
- Install the module - "npm install -g yme"
- Run "yme" with some parameters (see below for the list of command line options)
$ yme -d ~/projects/yui/yui3/src
The following command will parse only one file:
$ yme -f demo/demo.js
You can specify more than one file by separating them with commas. See below the command line options for more information
-f, --file [file1,file2] - The file(s) to parse and extract YUI modules.
-d, --dir [directory name] - The directory to traverse and extract YUI modules.
-c, --classes [export classes] - Export class names in addition to modules
-o, --out [file name] - The ouput file in which the information about found modules should be stored
-e, --ext [file extensions] - The file extensions which should be parsed. Defaults to "js".
-j, --json [file name] - Path to YUI data.json file. If not specified, "./data/data.json" will be used.
-i, --ignorenode [node string] - Ignore node string in files. If not speficified, "#!/usr/bin/env node" will be used.
-y, --yui-variable [var1,var2] - The name of the global YUI variable(s). Defaults to Y. Might be single value or an array.
-h, --help - output usage information
-V, --version - output the version number
- Dependencies are now in 'requires' format Proposed by Satyam (https://github.com/ipeychev/yui-modules-explorer/issues/5)
- Created NPM Package
- Added option to ignore node string - like "#!/usr/bin/env node"
- Traverse whole directory
- Export modules in file
- Bug fixing
- Resolve modules from class attributes