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.0.0 to 1.0.1

5

package.json
{
"name": "nestjs-gen",
"version": "1.0.0",
"version": "1.0.1",
"description": "NestJS model package generator",

@@ -8,2 +8,5 @@ "main": "index.js",

},
"bin": {
"ngen": "./index.js"
},
"keywords": [

@@ -10,0 +13,0 @@ "nestjs",

60

readme.md

@@ -0,33 +1,40 @@

## 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.
## Install:
npm install rw3iss/nestjs-gen
npm install nestjs-gen
#### Generate a module / package contents / whatever:
## How to Use:
#### Generate a Module / Controller / Service / Repository / Model (or all):
node ./node_modules/nestjs-gen/index.js gen <name> <options>
This will generate a folder <name> within a subdirectory according to options. See below for examples.
This will generate a folder \<name> within the current directory 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)
## Examples:
#### Generate Module with all Features (controller, service, repository, model):
#### Generate a Module with all features (module, controller, service, repository, and model):
node ./node_modules/nestjs-gen/index.js gen example --all --prefix "src"
node ./node_modules/nestjs-gen/index.js gen example --all
This will generate:
./modules/example/example.module.js
./modules/example/example.controller.js
./modules/example/example.service.js
./modules/example/example.repository.js
./modules/example/models/example.model.js
./modules/example/example.module.js (ExampleModule)
./modules/example/example.controller.js (ExampleController)
./modules/example/example.service.js (ExampleService)
./modules/example/example.repository.js (ExampleRepository)
./modules/example/models/example.model.js (ExampleModel)
(and corresponding CRUD interface within controller and service)
(Use --prefix to place files within the prefix directory, from the current folder)
#### Generate just a Controller, Repository, and Test model, not in a module
#### Generate just Controller, Repository, and Test model (no module)
node ./node_modules/nestjs-gen/index.js gen example --crud

@@ -37,13 +44,26 @@

./example/example.controller.js
./example/example.repository.js
./example/models/example.model.js
./example/example.controller.js (ExampleController)
./example/example.repository.js (ExampleRepository)
./example/models/example.model.js (ExampleModel)
(and corresponding CRUD interface within controller and service)
(Tip: If you want the files generated in their own module, just specify `--module`)
(If you want things in their own module, just specify `--module`)
#### Generate each specific thing you want
node ./node_modules/nestjs-gen/index.js gen example --module --controller --service --repository --model --crud --prefix "src"
## Options:
Or shorter:
node ./node_modules/nestjs-gen/index.js gen example --m --c --s --r --md --crud --prefix "src"
This will generate all the respective class files within "src/modules/example/".
## To Note:
* 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.
## All Options:
--p <prefix> Specify root/prefix dir to generate in optional

@@ -78,2 +98,4 @@ --prefix <prefix> Specify root/prefix dir to generate in optional

--no-model-dir Don't put models in "models" subdirectory 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.
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