Meet Agrippa, the React CLI for component generation
Nitzan Hen
Posted on August 10, 2021
Finally, after over two years of writing the boilerplate of React components by hand, I'd decided to make snippets for them. However, I find myself working in quite a number of different environments (Typescript or JavaScript, different styling solutions, etc.), and it quickly became apparent that to accommodate for each and every reasonable combination, I'd be writing at least as much boilerplate as I'd sought to avoid.
To this end (as well as the desire to do something cool), I wrote a small CLI - Agrippa.
As the documentation reads,
"[Agrippa's] purpose is to assist React developers in creating components without the boilerplate. It can easily generate templates for React components of different compositions (styling solutions, prop validations, etc.) and in different environments."
Agrippa's leading features are:
π Ease of use in both new and existing projects.
π Flexibility - agrippa strives to be useful in many different circumstances.
π§ Smart defaults - agrippa can detect and set defaults based on your environment's configuration, with no extra steps.
βοΈ Configurability - by using a plain old JSON file.
Usage
To get started with Agrippa, install it using npm i -g agrippa
(or yarn global add agrippa
).
Once installed, components can be generated using agrippa gen <name> [options]
!
Some of the options supported by agrippa gen
are:
-
--styling
: which styling solution to use (e.g. CSS, SCSS, JSS, Material-UI). -
--props
: which prop validation/definition solution to use (e.g. Typescript interfaces, prop-types, JSDoc comments). -
--children
: whether the components is meant to have children or not.
Also, Agrippa automatically detects and sets other, important defaults for you, such as whether to use Typescript or Javascript, and whether to import React or not.
An exhaustive list of options and defaults, as well as more information, can be found in the GitHub repo or the npm page.
Community
My ambition is that Agrippa would become a tool that makes the lives of React developers easier, but perhaps more importantly one that they enjoy using. The tool's ease-of-use at the practical level is one aspect of that, but just as important is the cultivation of an active, positive community around it that developers feel welcome in.
Therefore, I invite you - yes, you - to become part of Agrippa's community. Your thoughts, suggestions and collaboration are most welcome.
Posted on August 10, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.