Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

destiny

Package Overview
Dependencies
8
Maintainers
1
Versions
23
Issues
File Explorer

Advanced tools

destiny

Prettier for file structures

    0.7.1latest
    GitHub

Version published
Maintainers
1
Weekly downloads
783
increased by3.43%

Weekly downloads

Changelog

Source

0.7.1 (2020-08-19)

Bug Fixes

  • #115, fix #107 (8a4ea3e)
  • #136 (b194bbf)
  • #138 (54bd159)
  • add utils to spec fixture (9d75c93)
  • don't overwrite existing files (9a2c6c4)
  • handle edge cases where linked file is not found (3a139cd)
  • look for source file based on test file name first instead of first import (0544d61)
  • remove node_module test because git ignores that folder (6036bab)
  • treat story files like tests (16edcb7)
  • unused files (85543f4)

Bug Fixes

Features

Readme

Source

Destiny

example transformation

Prettier for File Structures

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


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

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 committed 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 (although this concept could probably be extended to any language)

How to run it

$ destiny --help destiny - Prettier for file structures. USAGE destiny [option...] [path] The path argument can consist of either a file path or a glob. OPTIONS -V, --version Output version number -h, --help Output usage information -w, --write Restructure and edit folders and files -S, --avoid-single-file Flag to indicate if single files in folders should be avoided --debug [?output file] Print debugging info

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/**/*.*"

Documentation

You can find the full documentation at this url.

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

Badge

file structure: destiny

[![file structure: destiny](https://img.shields.io/badge/file%20structure-destiny-7a49ff?style=flat)](https://github.com/benawad/destiny)

Keywords

FAQs

Last updated on 19 Aug 2020

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc