0.9.0 • Published 8 months ago

@eicrud/cli v0.9.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

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;
}
0.9.0

8 months ago

0.8.9

8 months ago

0.8.8

8 months ago

0.8.7

8 months ago

0.8.6

8 months ago

0.8.5

9 months ago

0.8.5-beta.0

9 months ago

0.8.4

9 months ago

0.8.4-beta.2

9 months ago

0.8.4-beta.1

9 months ago

0.8.4-beta.0

9 months ago

0.8.3

9 months ago

0.8.2

9 months ago

0.8.1

10 months ago

0.8.0

10 months ago

0.7.9

10 months ago

0.7.8

11 months ago

0.7.8-beta.0

11 months ago

0.7.7

11 months ago

0.7.7-beta.1

11 months ago

0.7.6

12 months ago

0.7.5

1 year ago

0.7.3

1 year ago

0.7.2

1 year ago

0.7.0

1 year ago