Skip to content

Instantly share code, notes, and snippets.

@moshewe
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();
program
.name('single-app-swagger-json-generator')
.arguments('--app-path <app-path> --app-version <app-version>')
.requiredOption('-a, --app-path <path>', 'path to app\'s folder')