UNPKG

@openapi-generator-plus/typescript-express-example-server-generator

Version:

An OpenAPI Generator Plus template for a TypeScript API server using Express to output example responses

46 lines (45 loc) 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.packageJson = packageJson; const template_utils_1 = require("@openapi-generator-plus/template-utils"); function packageJson(ctx) { /* `publishConfig` is appended after the closing `}` of `devDependencies`, * so it can't be on its own line — we precompute either the trailing block * or an empty string and interpolate that mid-line. */ const publishConfig = ctx.repository ? (0, template_utils_1.ts) `, "publishConfig": { "registry": "${ctx.repository}" }` : ''; return (0, template_utils_1.ts) ` { "name": "${ctx.name}", ${(0, template_utils_1.when)(ctx.private, '"private": true,')} "version": "${ctx.version}", "description": "API server for ${ctx.name}", "author": "@openapi-generator-plus/typescript-node-express-server-generator", "keywords": [ "express", "typescript", "swagger", "openapi", "${ctx.name}" ], "license": "UNLICENSED", "main": "./dist/index.js", "typings": "./dist/index.d.ts", "scripts": { "build": "tsc", "start": "node dist/index" }, "dependencies": { "express": "^4.18.2", "getopts": "^2.3.0" }, "devDependencies": { "@types/node": "^20.14.8", "@types/express": "^4.17.17", "typescript": "^5.9.2" }${publishConfig} } `; }