UNPKG

@deepkit/framework

Version:

67 lines 3.26 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DebugConfigController = void 0; /*@ts-ignore*/ const { __ΩCommand } = require('@deepkit/app'); function __assignType(fn, args) { fn.__type = args; return fn; } /* * Deepkit Framework * Copyright (C) 2021 Deepkit UG, Marc J. Schmidt * * This program is free software: you can redistribute it and/or modify * it under the terms of the MIT License. * * You should have received a copy of the MIT License along with this program. */ const app_1 = require("@deepkit/app"); const debug_controller_js_1 = require("../debug/debug.controller.js"); const framework_debug_api_1 = require("@deepkit/framework-debug-api"); const type_1 = require("@deepkit/type"); const nice_table_1 = require("nice-table"); const util_1 = require("util"); /** * @description Prints the current configuration, they type and default value. */ let DebugConfigController = class DebugConfigController { constructor(debug) { this.debug = debug; } async execute() { const configs = this.debug.configuration(); console.log('Application config'); this.logConfigTable(configs.appConfig); console.log('Modules config'); this.logConfigTable(configs.modulesConfig); } logConfigTable(config) { console.log((0, nice_table_1.createTable)(config, type_1.ReflectionClass.from(framework_debug_api_1.ConfigOption).getPropertyNames(), { horizontalAlignment: 'middle', verticalAlignment: 'middle', columnSizing: 'stretch', maxWidth: process.stdout.columns, fullWidth: true, throwIfTooSmall: false, indexColumn: false, stringify: __assignType((value) => (0, util_1.inspect)(value, { colors: true }), ['value', '', 'P"2!"/"']) })); } }; exports.DebugConfigController = DebugConfigController; DebugConfigController.__type = [() => debug_controller_js_1.DebugController, 'debug', 'constructor', 'execute', () => framework_debug_api_1.ConfigOption, 'config', 'logConfigTable', () => __ΩCommand, 'DebugConfigController', 'Prints the current configuration, they type and default value.', 'PP7!2"<"0#P$`0$PP7%F2&"0\';5n(x"w)?*']; exports.DebugConfigController = DebugConfigController = __decorate([ app_1.cli.controller('debug:config'), __metadata("design:paramtypes", [debug_controller_js_1.DebugController]) ], DebugConfigController); //# sourceMappingURL=app-config.js.map