npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gera

v1.0.4

Published

Gera CLI

Readme

Gera - CLI

NPM version

Uma CLI que permite facilitar o processo de desenvolvimento de código dentro de um projeto.

Instale o Gera - CLI no seu computador globalmente:

  npm i -g gera

Principais comandos:

  • start (s) Inícia o Gera CLI no diretório atual (ex. gera start).
  • list (l) Lista todos os comandos criados para o projeto, presentes na pasta .gera (ex. gera list).
  • new (n) Crie um novo comando para o projeto (ex. gera new <comando_name>).
  • gera Executa um comando criado para o projeto (ex. gera <comando_name>).
  • help (h) Lista os comandos principais da CLI.
  • version (v) Versão da CLI.

Começo rápido

Após instalação da CLI no seu computador:

  // Inície o Gera CLI em um projeto.
  gera start
  
  // Executa comando de exemplo criado
  gera exemple Teste
  
  // Será criado um arquivo `Teste.ts` no diretório `teste` dentro do seu projeto.

🚨Documentação das dependências importantes:

  • Documentação toolbox: https://infinitered.github.io/gluegun/#/toolbox-api
  • Documentação ejs: https://ejs.co/#docs

Exemplo 1

Automatizar a criação de classes para um projeto .Net

  1. Inície o Gera CLI no seu projeto (caso ainda não tenha iníciado).
gera start
  1. Crie um novo comando para o seu projeto, com o nome de domain:models.
gera new domain:models
  1. Altere o arquivo .gera/domain:models.js referente ao comando criado:
module.exports  = {
    name:'domain:models',
    description:'Cria uma nova classe de modelo em src/Teste.Co.Domain/Models',
    run:run
}

function run(toolbox){
    const classe_name = toolbox.parameters.first;

    if(typeof classe_name !== "string"){
        toolbox.print.error('Nome da classe não informado!')
        return;
    }


    toolbox.gera.generate({
        template: 'domain:models.ejs',
        target: `src/Teste.Co.Domain/Models/${classe_name}.cs`,
        props: { 
            classe_name:classe_name,
        }
    })
}
  1. Altere o template .gera/templates/domain:models.ejs.
using System;

namespace Teste.Co.Domain.Models
{
    public class <%= props.classe_name %>
    {
        public string Id { get; private set; }
        public DateTime CreatedIn { get; private set; }
        public DateTime? UpdatedIn { get; private set; }
    }
}
  1. Execute o comando criado
gera domain:models Usuario

Resultado:

using System;

namespace Teste.Co.Domain.Models
{
    public class Usuario
    {
        public string Id { get; private set; }
        public DateTime CreatedIn { get; private set; }
        public DateTime? UpdatedIn { get; private set; }
    }
}

Exemplo 2

Automatizar a implementação do padrão de projeto Repository

  1. Inície o Gera CLI no seu projeto (caso ainda não tenha iníciado).
gera start
  1. Crie um novo comando para o seu projeto, com o nome de domain:models.
gera new infra:repositories
  1. Altere o arquivo .gera/infra:repositories.js referente ao comando criado:
module.exports  = {
    name:'infra:repositories',
    description:'',
    run:run
}

function run(toolbox){

    //Pega e valida o nome do repository
    const nome = toolbox.parameters.first;

    if(typeof nome !== "string"){
        toolbox.print.error('First parameter not entered!')
        return;
    }

    //Cria o arquivo de interface da repository
    toolbox.gera.generate({
        template: 'infra:irepositories.ejs',
        target: `src/LeilaoFake.Me.Infra/Datas/Repositories/I${nome}Repository.cs`,
        props: { 
            nome:nome,
        }
    })

    //Cria o arquivo referente a repository
    toolbox.gera.generate({
        template: 'infra:repositories.ejs',
        target: `src/LeilaoFake.Me.Infra/Datas/Repositories/${nome}Repository.cs`,
        props: { 
            nome:nome,
        }
    })
    
    //Adiciona a injeção de dependência na classe Startup.cs
    const addTransient = `services.AddTransient<I${nome}Repository,${nome}Repository>();`;

    toolbox.patching.patch('src/LeilaoFake.Me.Api/Startup.cs', { 
        insert: `\n${addTransient}`, 
        after: 'GERA-COMMANDS-ADD-REPOSITORY' 
    })

}
  1. Altere o template .gera/templates/infra:repositories.ejs.
using Dapper;
using LeilaoFake.Me.Core.Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LeilaoFake.Me.Infra.Datas.Repositories
{
    public class <%= props.nome %>Repository : I<%= props.nome %>Repository
    {
        private readonly IDbConnection _dbConnection;

        public <%= props.nome %>Repository(IDbConnection dbConnection)
        {
            _dbConnection = dbConnection;
        }
    }
}
  1. Cria o template referente a interface .gera/templates/infra:irepositories.ejs.
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using LeilaoFake.Me.Core.Models;

namespace LeilaoFake.Me.Infra.Datas.Repositories
{
    public interface I<%= props.nome %>Repository
    {
    }
}
  1. Execute o comando criado
gera infra:repositories Teste

Resultado interface Repository:

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using LeilaoFake.Me.Core.Models;

namespace LeilaoFake.Me.Infra.Datas.Repositories
{
    public interface ITesteRepository
    {
    }
}

Resultado Repository:

using Dapper;
using LeilaoFake.Me.Core.Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LeilaoFake.Me.Infra.Datas.Repositories
{
    public class TesteRepository : ITesteRepository
    {
        private readonly IDbConnection _dbConnection;

        public TesteRepository(IDbConnection dbConnection)
        {
            _dbConnection = dbConnection;
        }
    }
}

Resultado Startup:

      //GERA-COMMANDS-ADD-REPOSITORY
      services.AddTransient<ITesteRepository,TesteRepository>(); //Injeção de dependência adicionada.
      services.AddTransient<ILeilaoRepository,LeilaoRepository>();
      services.AddTransient<IUsuarioRepository, UsuarioRepository>();
      services.AddTransient<ILanceRepository, LanceRepository>();
      services.AddTransient<ILeilaoImagemRepository, LeilaoImagemRepository>();

😍 Obrigado Gluegun (https://www.npmjs.com/package/gluegun)

License

MIT - see LICENSE