Skip to content

Instantly share code, notes, and snippets.

moshewe / nest-gen-app-swagger.ts
Last active April 24, 2023 10:52
This script generates the swagger spec for a given NestJS Module. It takes the app's path, version and module name as parameters, with optionals for
import * as fs from 'fs';
import { NestFactory } from '@nestjs/core';
import { DocumentBuilder, SwaggerDocument, SwaggerModule } from '@nestjs/swagger';
import * as commander from 'commander';
const program = new commander.Command();
.arguments('--app-path <app-path> --app-version <app-version>')
.requiredOption('-a, --app-path <path>', 'path to app\'s folder')