DevSnicket Eunice is a toolkit based on the premise that unidirectional dependencies can be beneficial to structure and modularity in software. Eunice's approach isn't limited to direct dependencies, but includes indirect dependencies as well.
The package produces the following output files:
a YAML file containing processed analysis (eunice.yaml)
an SVG file containing a render scoped to the root directory (eunice.svg)
a HTML file containing an interactive render, where the scope can be set to sub-items (e.g. sub-directories, files, functions etc), and dependencies can be listed (eunice.html)
(runs renderer test harness)
Install and run using
npm install --save-dev @devsnicket/eunice npx eunice
yarn add --dev @devsnicket/eunice yarn eunice
From the processors available in eunice-processors, this package runs the following automatically, the same processing as Eunice uses when analyzing itself:
- The filename "index" is removed from identifiers.
- Optionally ensure there is a single root item with an identifier (e.g. the package's name).
- Items that are files have "type: file" added to them.
- Items are ordered by their identifiers.
- Items are grouped by their identifiers (this is requires the previous ordering step).
- Anonymous items (i.e. those without an identifier) are given the identifier of their parent.
- Variables that depend upon one item of the same name are removed (e.g. some CommonJS requires or ES6 imports).
- Items are ordered so parameters, variables and files are last.
- Any items with identifiers of "bin" and "test" are stacked in a level together above other items.
- Items that have identifiers starting with "test" have child items for the Jest methods "expect" and "test" added together in a level below the other items.
- Independent items (i.e. those that don't depend on each other) are unstacked into the same level.
- The source directory is scanned for any files named .devsnicket-eunice-stack.yaml. Any structure defined inside these files is applied to any files also in the directory.
- If there is a single root item, that is anonymous and has only items and type, its items are flattened out into the root
Only the current directory is included in analysis by default. Multiple sources of analysis can be specified:
npx @devsnicket/eunice --directories=directory1 --directories=directory2
An identifier for a root item can also be specified for each source directory to be used in processing step 2:
npx @devsnicket/eunice --directories=directory1 --rootItemIdentifiers=prefixForDirectory1 --directories=directory2 --rootItemIdentifiers=prefixForDirectory2
The following sub-directories are ignored by default:
A new list of sub-directories to be ignored can be specified:
npx @devsnicket/eunice --ignoreDirectoryNames=ignoreDirectory1 --ignoreDirectoryNames=ignoreDirectory2
Packages installed in the node_modules directory are not analysed by default. They can included using the "directories" option above or with:
npx @devsnicket/eunice --packageNames=package1 --packageNames=package2
To aid readability a package prefix and scope can also be specified that will not be visible in the rendered output:
// e.g. @scope/prefix-package npx @devsnicket/eunice --packageNames=package --packagePrefix=prefix- --packageScope=scope
When multiple sources of analysis are specified, processing step 12 can also be applied to the combined sources:
npx @devsnicket/eunice --directories=directory1 --directories=directory2 --directoryToCreateOrAddToStacksFrom=stacks-directory
To name the output files differently or in a different directory:
npx @devsnicket/eunice --outputBaseFileName=eunice-file --outputDirectoryPath=eunice-directory