Git Product home page Git Product logo

destiny's Introduction

destiny

Prettier for File Structures

npm version contributions welcome Join the chat at https://gitter.im/destiny-dev/community


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

example transformation

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
  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)
  • 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

Dry run which will output what the resulting file structure will look like:

npx destiny "src/**/*.*"

This will actually move files around and fix imports:

npx destiny -w "src/**/*.*"

This tool might be useless

It might be better to just name your folders.

Why did you name it destiny?

The name could be "Destiny" maybe. Like the file was meant to be there.

Contributing

pull requests are welcome :)

destiny's People

Contributors

benawad avatar sqve avatar anatolelucet avatar danielpza avatar semantic-release-bot avatar waynevanson avatar moranje avatar gitter-badger avatar danielvdm2000 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.