avvio icon indicating copy to clipboard operation
avvio copied to clipboard

Pretty Print Plugin Tree

Open StarpTech opened this issue 6 years ago • 3 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.

StarpTech avatar May 31 '18 09:05 StarpTech

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

mcollina avatar May 31 '18 10:05 mcollina

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.

delvedor avatar May 31 '18 10:05 delvedor

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.

StarpTech avatar May 31 '18 10:05 StarpTech

Resolved in #81

climba03003 avatar Dec 01 '22 06:12 climba03003