Prettier for File Structures
Video explanation: https://www.youtube.com/watch?v=rGYbrIf-y58
- Scans a folder for all the files in it
- Creates a directed graph based on how the JavaScript/TypeScript files import each other
- Creates a fractal representation of the graph
- Moves existing files into the fractal structure
- Fixes imports
- Removes all empty folders
- Prints files that are "unused" (not imported by anyone and doesn't import anything)
The end result is a "prettified" file structure.
- This is a work in progress and 100% has bugs of some kind in it
- BEFORE running this tool on your codebase, make sure you have commited to git or made a backup (I don't expect the tool to destroy your work (although it's possible), but just in case you don't like the results)
- Haven't tested this on Windows so idk if it'll work, but I'm using the
path
module so it might. - Snapshot tests don't format correctly
npx butler-cli path/to/src
It might be better to just name your folders.
pull requests are welcome :)