Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

226
Vistas
Building a CLI that needs to insert JSX elements at specific point in JSX tree

I'm looking for some direction on different tools I could use to update an existing JSX tree and insert new JSX elements / import statements via a CLI generator.

As an example, our CLI helps to build out dialog components and auto insert them into the tree so they are ready to use at the root of the project.

We have a tree that looks like this in the base of the app

<AppContainer>
  <Router routes={routeConfig} />
  <div id="dialog-holder">
    {/* LEAVE THIS IN PLACE FOR DIALOGS TO POPULATE INTO */}
  </div>
  <Snackbar />
</AppContainer>

Currently, I've used an AST walker to find this div element and insert a new line, something like this

<NewDialog />

And then add a new import statement at the top

import NewDialog from "dialogs/NewDialog"

We have a CLI working currently to do this, but we have more use cases where we would love to update files as we generate new components and other parts of our apps and working with the AST is not simple.

The CLI is built in node and currently, we are using Yeoman for the actual generator logic and functionality.

Are there any other Node tools that could be easier to work with that would allow us to do this fine file manipulation like this?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda