1.0.3 • Published 5 months ago

nest-sdk v1.0.3

Weekly downloads
-
License
-
Repository
-
Last release
5 months ago

Nest SDK

A Nest CLI Plugin to Generate SDK's

Install Dependency

  npm i nest-sdk

Getting Started

Add plugin to plugins option in the Nest CLI Config

  {
    "$schema": "https://json.schemastore.org/nest-cli",
    "collection": "@nestjs/schematics",
    "sourceRoot": "src",
    "compilerOptions": {
      "plugins": [ "nest-sdk" ]
    }
  }

Custom Options

OptionTypeDefaultDescription
appModulePathstring./src/app.module.jsRelative path to the compiled app module, i.e. - the module passed to NestFactory.create
appModuleClassNamestringAppModuleName of the class exported from app module being used by NestFactory.create
generatorstringtypescriptName of the generator to use. Possible options can be found here
openApiGeneratorBinPathstringnode_modules/.bin/openapi-generator-cliPath to the openapi-generator-cli binary
outputPathstring./sdkPath to generate the SDK
portnumber9525Very unlikely this needs to change, it is used in the background for generation, but nonetheless it is configurable in case of another process living on the port
silentbooleanfalseIf enabled the plugin will not log when the SDK is being generated in start/watch mode
generationDebounceTicksnumber500Measured in ticks, this is the minimum required time to pass between SDK generations

An example with modifying the options

  {
    "$schema": "https://json.schemastore.org/nest-cli",
    "collection": "@nestjs/schematics",
    "sourceRoot": "src",
    "compilerOptions": {
      "plugins": [
        {
          "name": "nest-sdk",
          "options": {
            "appModulePath": "./dist/server.module.js",
            "appModuleClassName": "ServerModule",
            "generator": "typescript-axios",
            "openApiGeneratorBinPath": "/usr/local/bin/openapi-generator-cli",
            "outputPath": "dist/sdk",
            "port": 8082,
            "silent": true,
            "generationDebounceTicks": 1000
          }
        }
      ]
    }
  }

Minimum Required Version

NodeJS >=20

NodeJS ES feature support docs: https://node.green/

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago