js ecosystem, I was considering
Posted: Sun Dec 22, 2024 8:45 am
js The Node.js ecosystem offers us a huge amount of useful tools and libraries to build CLI experiences. It can be a good starting point for anyone who wants to build CLIs . Twilio CLI already had a library named inquirer to handle user input. For most of the CLIs I write, I use this library or a similar one like prompts or enquirer. But we wanted to make it more like a classic GUI, to make it accessible to beginners and also to group all the functionality in one place. For the Node.
two options that could be used. The first being , a cursesblessed -like library which is ideal but unfortunately no longer maintained. The other alternative is a React-based CLI framework called ink. It's actually used by a few CLIs you may have used before like Gatsby , Parcel , or Yarn 2 . Using React with a CLI? Running React in a CLI may seem strange at first (or even after philippines whatsapp number some thought, for that matter). The way it works is similar to React Native. React itself is not really a browser-specific library.
If you've written React for the web in the past, you may have noticed that you're using two dependencies, react and react-dom. The only time you run react-dom is to call the function render that will render your application to the browser's DOM. ink is basically react-dom but instead of being the bridge between React and the browser, it's what connects it to the terminal. There are a few reasons why it's ink ideal for our CLI experience. One of our values at Twilio is “Draw the Owl” which advocates resourcefulness without instructions: this is what allows us to sometimes learn by ourselves.
Our situation fell into this framework. Ink gives us an interface that does not limit us to a set of components that we can use. In fact, it is quite the opposite, it only gives us a limited but powerful choice of components. A component <Text> that works like a <span/> in the browser and a component <Box> that is like a <div/> in the search engine with the parameter display: flex . From there, there were no limits to building our UI. We were able to create our own reusable UI components and use them in multiple places.
two options that could be used. The first being , a cursesblessed -like library which is ideal but unfortunately no longer maintained. The other alternative is a React-based CLI framework called ink. It's actually used by a few CLIs you may have used before like Gatsby , Parcel , or Yarn 2 . Using React with a CLI? Running React in a CLI may seem strange at first (or even after philippines whatsapp number some thought, for that matter). The way it works is similar to React Native. React itself is not really a browser-specific library.
If you've written React for the web in the past, you may have noticed that you're using two dependencies, react and react-dom. The only time you run react-dom is to call the function render that will render your application to the browser's DOM. ink is basically react-dom but instead of being the bridge between React and the browser, it's what connects it to the terminal. There are a few reasons why it's ink ideal for our CLI experience. One of our values at Twilio is “Draw the Owl” which advocates resourcefulness without instructions: this is what allows us to sometimes learn by ourselves.
Our situation fell into this framework. Ink gives us an interface that does not limit us to a set of components that we can use. In fact, it is quite the opposite, it only gives us a limited but powerful choice of components. A component <Text> that works like a <span/> in the browser and a component <Box> that is like a <div/> in the search engine with the parameter display: flex . From there, there were no limits to building our UI. We were able to create our own reusable UI components and use them in multiple places.