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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@eicrud/cli

v0.9.1

Published

cli for @eicrud framework

Downloads

372

Readme

CLI (Command line interface) package for the Eicrud framework.

Installation

npm i -g @eicrud/cli

Setup

Usage: eicrud setup [options] <type> <name>

Setup new project (adapt an existing nestjs application)

Arguments:
  type        mongo | postgre
  name        project name (will be used for db)

Options:
  -h, --help  display help for command

Initialise Eicrud on a Nestjs application.

cd project-name
eicrud setup mongo project-name

Generate

Usage: eicrud generate [options] <type> <serviceName> [cmdName]

Generate new files

Arguments:
  type                service, cmd
  serviceName
  cmdName

Options:
  -n, --non-crud      will not create a DB table for this service
  -ms, --ms <string>  a subfolder for the service to be created/modified in
  -h, --help          display help for command

Generate a new service.

eicrud generate service myService

Generate a new service in a subfolder (microservice architecture).

eicrud generate service myService -ms myFolder

Generate a new command for a service.

eicrud generate cmd myService myCmd (-ms myFolder)

Export

Usage: eicrud export [options] <type>

Export dtos, superclient or openapi schemas

Arguments:
  type                              dtos | superclient | openapi

Options:
  -kv, --keep-validators            will keep class-validator decorators when exporting dtos
  -cc, --convert-classes            will convert classes into interfaces when exporting dtos
  -o-sr, --oapi-separate-refs       keep DTOs schemas in separate files
  -o-jqs, --oapi-json-query-string  export openapi schema json query parameters with type string for      
                                    compatibility with tools that do not support application/json there   
  -h, --help                        display help for command

Copy all your .dto.ts and .entity.ts to the eicrud_exports directory and strip them of their decorators.

eicrud export dtos

Build a typed client class for each of your exported entities and instantiate them in a main SuperClient class.

eicrud export superclient

Export an OpenAPI schema based on your entities and commands.

eicrud export openapi

JSON config

You can specify ExportOptions in a eicrud-cli.json file at the root of your project.

export interface ExportOptions {
  /**
   * Exclude the given services from the export.
   * @example ['user-profile', 'Email']
   */
  excludeServices?: Array<string>;

  /**
   * Include files that match the given patterns into the output directory.
   * @example ['*.shared.ts', '*.md']
   */
  includePatterns?: Array<string>;

  /**
   * Exclude files that match the given patterns from the output directory.
   * @example ['*secret-ms*.dto.ts']
   */
  excludePatterns?: Array<string>;

  /**
   * Remove given imports from the exported files.
   * @example ['@mypackage/core', 'rxjs']
   */
  removeImports?: Array<string>;

  /**
   * Output directory
   * @default 'eicrud_exports'
   */
  outputDir?: string;

  /**
   * Input directory
   * @default './src'
   **/
  inputDir?: string;

  /**
   * Location of the node_modules directory.
   * @default './node_modules'
   */
  modulesDir?: string;

  /**
   * Name of the user service directory.
   * @default 'user'
   */
  userServiceDir?: string;

  /**
   * Set the defaults for the exported openAPI schema.
   * https://swagger.io/specification
   */
  openApiBaseSpec?: any;
}