内容简介:Prettier for File StructuresMotivation:
destiny
Prettier for File Structures
Motivation: https://www.youtube.com/watch?v=rGYbrIf-y58
Disclaimer
Destiny is in early development so you might encounter bugs or miss important features. If you find a bug or miss a feature, please don't hesitate to reach out via a pull request or issue .
What does this do?
- 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 (following similar rules outlined here: https://hackernoon.com/fractal-a-react-app-structure-for-infinite-scale-4dab943092af )
- 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.
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
npx destiny src/**/*.*
This tool might be useless
It might be better to just name your folders.
Why did you name it destiny?
Contributing
pull requests are welcome :)
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
JavaScript设计模式
Ross Harmes、Dustin Diaz / 谢廷晟 / 人民邮电出版社 / 2008 / 45.00元
本书共有两部分。第一部分给出了实现具体设计模式所需要的面向对象特性的基础知识,主要包括接口、封装和信息隐藏、继承、单体模式等内容。第二部分则专注于各种具体的设计模式及其在JavaScript语言中的应用,主要介绍了工厂模式、桥接模式、组合模式、门面模式等几种常见的模式。为了让每一章中的示例都尽可能地贴近实际应用,书中同时列举了一些JavaScript 程序员最常见的任务,然后运用设计模式使其解决方......一起来看看 《JavaScript设计模式》 这本书的介绍吧!