# butler-cli

> Prettier for File Structures

Latest version **0.0.11** (published 2020-02-14) · 0 weekly downloads

## Install

```sh
npm install butler-cli
pnpm add butler-cli
yarn add butler-cli
bun add butler-cli
```

Provides the command `butler-cli`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.11 |
| Published | 2020-02-14 |
| First published | 2020-02-13 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 59 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | benawad |

## Links

- npm: https://www.npmjs.com/package/butler-cli
- npm.io page: https://npm.io/package/butler-cli

## Dependencies (1)

- [mkdirp](https://npm.io/package/mkdirp.md) ^1.0.3

## Recent versions

- 0.0.11 (latest) — 2020-02-14
- 0.0.10 — 2020-02-14
- 0.0.9 — 2020-02-14
- 0.0.8 — 2020-02-14
- 0.0.7 — 2020-02-14
- 0.0.6 — 2020-02-13
- 0.0.5 — 2020-02-13
- 0.0.4 — 2020-02-13
- 0.0.3 — 2020-02-13
- 0.0.2 — 2020-02-13
- 0.0.1 — 2020-02-13

## README

# butler-cli

Prettier for File Structures

[![npm version](https://badge.fury.io/js/butler-cli.svg)](https://badge.fury.io/js/butler-cli)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/benawad/butler-cli/issues)

---

Video explanation: https://www.youtube.com/watch?v=rGYbrIf-y58

![example transformation](https://github.com/benawad/butler-cli/blob/master/assets/example.png)

## What does this do?

1. Scans a folder for all the files in it
2. Creates a directed graph based on how the JavaScript/TypeScript files import each other
   ![example directed graph](https://github.com/benawad/butler-cli/blob/master/assets/graph.png)
3. Creates a fractal representation of the graph (following similar rules outlined here: https://hackernoon.com/fractal-a-react-app-structure-for-infinite-scale-4dab943092af)
4. Moves existing files into the fractal structure
5. Fixes imports
6. Removes all empty folders
7. Prints files that are "unused" (not imported by anyone and doesn't import anything)

The end result is a "prettified" file structure.

## Disclaimer

- 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
- Only works on JavaScript/TypeScript codebases (althought this concept could probably be extended to any language)

## How to run it

```
npx butler-cli path/to/src
```

## This tool might be useless

It might be better to just name your folders.

## Contributing

pull requests are welcome :)

---
_Source: https://npm.io/package/butler-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
