New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nestjs-gen

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestjs-gen - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

4

index.js

@@ -33,2 +33,3 @@ #!/usr/bin/env node

.option('--model-name', 'Specify the exact name for the model class')
.option('--no-model-dir', 'Don\'t put models in default "models" subdirectory')

@@ -49,5 +50,2 @@ .option('--c', 'Generate a controller for the model')

// extended options
.option('--no-model-dir', 'Don\'t put models in default "models" subdirectory')
.action((args, o, logger) => {

@@ -54,0 +52,0 @@

{
"name": "nestjs-gen",
"version": "1.1.1",
"version": "1.1.2",
"description": "NestJS model package generator",

@@ -5,0 +5,0 @@ "main": "index.js",

## What This Is:
This is a package to generate automatic files for NestJS, namely a combination of a module, controller, service, repository, and model files, for any particular model, feature set, etc.
A command line tool to automatically generate some or all feature set files for NestJS:
-module
-controller
-service
-repository
-model
The generated class files will automatically reference each other through imports and injections.
## Install:
// Globally:
npm install nestjs-gen -g
// Local project only:
npm install nestjs-gen
## How to Use:
## Usage:
(If using with local project only, replace `ngen` below with: `./node_modules/.bin/ngen`)
#### Generate a Module / Controller / Service / Repository / Model (or all):
node ./node_modules/nestjs-gen/index.js gen <name> <options>
ngen <name> <options>
This will generate a folder \<name> within the current directory according to the options. See below for examples.
This will generate a folder \<name> within the current directory, and then all specified classes according to the options. See below for examples.
(Tip: Use --prefix to place files within a prefix directory, from the current folder)
(Tip: Use --crud to automatically generate CRUD interfaces within the Controller and Service classes)

@@ -27,3 +41,3 @@

node ./node_modules/nestjs-gen/index.js gen example --all
ngen example --all

@@ -39,5 +53,5 @@ This will generate:

#### Generate just a Controller, Repository, and Test model, not in a module
#### Generate just a Controller, Repository, and Test model (not in a module)
node ./node_modules/nestjs-gen/index.js gen example --crud
ngen example --crud

@@ -55,7 +69,7 @@ This will generate:

node ./node_modules/nestjs-gen/index.js gen example --module --controller --service --repository --model --crud --prefix "src"
ngen example --module --controller --service --repository --model --crud --prefix "src"
Or shorter:
node ./node_modules/nestjs-gen/index.js gen example --m --c --s --r --md --crud --prefix "src"
ngen example --m --c --s --r --md --crud --prefix src

@@ -66,3 +80,4 @@ This will generate all the respective class files within "src/modules/example/".

* If you specify --repository or --crud, a model will automatically be generated.
* If you specify --auth, `@Guard(<auth-guard-class>)` decorators will be added to the crud interfaces. Your custom auth guard class name and location can be defined with --auth-guard-class and --auth-guard-location.
* If you specify --auth, `@Guard(<auth-guard-class>)` decorators will be added to the CRUD interfaces.
Your custom auth guard class name and location can be defined with --auth-guard-class and --auth-guard-location.

@@ -72,33 +87,34 @@

--p <prefix> Specify root/prefix dir to generate in optional
--prefix <prefix> Specify root/prefix dir to generate in optional
--p <prefix> Specify root/prefix dir to generate in optional
--prefix <prefix> Specify root/prefix dir to generate in optional
--a Generate all (module + controller + service + repository + model optional default: false
--all Generate all (module + controller + service + repository + model optional default: false
--a Generate all (module + controller + service + repository + model optional default: false
--all Generate all (module + controller + service + repository + model optional default: false
--m Generate a module optional default: false
--module Generate a module optional default: false
--m Generate a module optional default: false
--module Generate a module optional default: false
--r Generate a repository for the model optional default: false
--repo Generate a repository for the model optional default: false
--repository Generate a repository for the model optional default: false
-r Generate a repository for the model optional default: false
--repo Generate a repository for the model optional default: false
--repository Generate a repository for the model optional default: false
--md Generate the model files optional default: false
--model Generate the model files optional default: false
--model-name Specify the exact name for the model class optional default: false
--md Generate the model files optional default: false
--model Generate the model files optional default: false
--model-name Specify the exact name for the model class optional default: false
--no-model-dir Don't put models in default "models" subdirectory optional default: false
--c Generate a controller for the model optional default: false
--controller Generate a controller for the model optional default: false
--c Generate a controller for the model optional default: false
--controller Generate a controller for the model optional default: false
--s Generate a service for the model optional default: false
--service Generate a service for the model optional default: false
--s Generate a service for the model optional default: false
--service Generate a service for the model optional default: false
--crud Generates CRUD actions within the controller and service optional default: false
--crud Generates CRUD actions within the controller and service optional default: false
--auth CRUD actions will add authentication guards, requiring a logged in user optional default: false
--auth-guard-class The name of the Guard class optional default: false
--auth-guard-location The location of the Guard class optional default: false
--auth CRUD actions will require a logged in user optional default: false
--auth-guard-class The name of the Guard class optional default: false
--auth-guard-location The location of the Guard class optional default: false
## Other Things to Note / Todo:
The generated files will all reference eachother correctly, but you will still need to add these references to your main AppModule, or wherever you need to use them. In other words: this package doesn't "edit" existing files.
The generated files will all reference eachother correctly, but you will still need to add these references to your main AppModule, or wherever you need to use them. In other words: this package doesn't edit existing files.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc