entropic-dev / entropic

🦝 :package: a package registry for anything, but mostly javascript 🦝 🦝 🦝

Home Page:https://discourse.entropic.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ink for CLI

olingern opened this issue · comments

Ink is a super neat project that allows command line development using React-like components. I think using this could make the CLI more approachable for newcomers as well as providing a nice layer of visual abstraction.

TIL. That looks so cool and I already want to rewrite half of my own projects to use it.

It's super interesting. Yoga layout ( how Ink positions ) turns out to be really useful.

Selfishly, I've been wanting to use this so I'm all for it.

I'd kind of like to see the CLI separate into an API client layer (a la common/boltzmann/client/index.js), display layer (in ink, potentially) and dispatch/command layer (what we have now), with our various utility methods getting absorbed into the client or the command layer.

Ink looks super rad and I've also been looking for an opportunity to try it out and can help out porting stuff over.

ink is neat but it isn’t without overhead. aside from the tooling, it will incur a noticeable startup penalty. maybe this is the heaviness of React itself—haven’t looked closely at where the bottleneck is.

If anyone is interested in alternatives I will plug https://github.com/neat-log/neat-log which we use in the Dat command line. It is still somewhat minimal but I would love any critical but kind eyes on it. I have also been eyeing Ink too and it has much wider set of prebuilt components and what not.

Folks have written a chat client with it and mostly works =) https://github.com/cabal-club/cabal#cabal-cli

Another alternative: oclif

@boneskull If the bottleneck is in React itself, I wonder if it would be viable to use Preact in its place?

@ChrisBrownie55 I don't think so. Ink uses yoga; preact does not.

@boneskull I was referring to using Preact in place of React, this would still be in conjunction with Ink. But I've tried to test using preact/compat by aliasing react to it but it would appear that Ink relies too heavily on the internal systems/variables of React making it impossible to just switch to Preact.

You should take a look at pasterl. It uses ink under the hood but is a replacement for things like yargs, meow, ...