fastify/avvio

Pretty Print Plugin Tree

StarpTech opened this issue · 4 comments

Hi @mcollina, @smartiniOnGitHub has a neat idea to illustrate the plugin tree for diagnostic purposes as in find-my-way WDYT?

e.g

console.log(avvio.prettyPrint())
// └── /
//   ├── root (fastify v1.0.0) 44ms
//   │   └── /fastify-auth (v0.0.4) 2ms
//   │   └── /fastify-swagger (v0.4.4) 23ms
//   │   └── /fastify-custom (v1.0.0) 19ms
//   │   	└── /fastify-a (v1.0.0) 9ms
//   │   	└── /fastify-b (v1.0.0) 10ms

The tree would illustrate the loading order and other useful informations like plugin name, version, loading-time. Dependencies across different plugins could be marked in different colors. There are many options 😄.

avvio.prettyPrint([updates=false])

Should be able to call it before everything is bootsrapped. The cli can update itself so it's possible to see which plugin has issues to bootstrap.

Note that avvio does not anything about prefixes, those are fastify thing.
Other than that, go for it.

I like it!
I suggest to use node-archy, in find-my-way we are using a way to complex method :P

We should think how to handle unnamed plugins.

Note that avvio does not anything about prefixes, those are fastify thing.

Good note. This must be enriched in a different way. I leave it open so anybody can start a try.

Resolved in #81