@nestjs-mod/common
Version:
A collection of utilities for unifying NestJS applications and modules
591 lines • 33.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.InfrastructureMarkdownReportGenerator = exports.InfrastructureMarkdownReportStorage = exports.InfrastructureMarkdownReportStorageService = exports.DynamicNestModuleMetadataMarkdownReportGenerator = exports.InfrastructureMarkdownReportGeneratorConfiguration = void 0;
const tslib_1 = require("tslib");
const common_1 = require("@nestjs/common");
const case_anything_1 = require("case-anything");
const fs_1 = require("fs");
const path_1 = require("path");
const decorators_1 = require("../../../config-model/decorators");
const constants_1 = require("../../../nest-module/constants");
const types_1 = require("../../../nest-module/types");
const utils_1 = require("../../../nest-module/utils");
const project_utils_module_1 = require("../../system/project-utils/project-utils.module");
const package_json_service_1 = require("../../system/project-utils/services/package-json.service");
const is_infrastructure_1 = require("../../../utils/is-infrastructure");
let InfrastructureMarkdownReportGeneratorConfiguration = class InfrastructureMarkdownReportGeneratorConfiguration {
};
exports.InfrastructureMarkdownReportGeneratorConfiguration = InfrastructureMarkdownReportGeneratorConfiguration;
tslib_1.__decorate([
(0, decorators_1.ConfigModelProperty)({
description: 'Name of the markdown-file in which to save the infrastructure report',
}),
tslib_1.__metadata("design:type", String)
], InfrastructureMarkdownReportGeneratorConfiguration.prototype, "markdownFile", void 0);
tslib_1.__decorate([
(0, decorators_1.ConfigModelProperty)({
description: 'Skip empty values of env and config models',
}),
tslib_1.__metadata("design:type", Boolean)
], InfrastructureMarkdownReportGeneratorConfiguration.prototype, "skipEmptySettings", void 0);
tslib_1.__decorate([
(0, decorators_1.ConfigModelProperty)({
description: 'Report generation style',
default: 'full',
}),
tslib_1.__metadata("design:type", String)
], InfrastructureMarkdownReportGeneratorConfiguration.prototype, "style", void 0);
exports.InfrastructureMarkdownReportGeneratorConfiguration = InfrastructureMarkdownReportGeneratorConfiguration = tslib_1.__decorate([
(0, decorators_1.ConfigModel)()
], InfrastructureMarkdownReportGeneratorConfiguration);
let DynamicNestModuleMetadataMarkdownReportGenerator = class DynamicNestModuleMetadataMarkdownReportGenerator {
constructor(infrastructureMarkdownReportGeneratorConfiguration) {
this.infrastructureMarkdownReportGeneratorConfiguration = infrastructureMarkdownReportGeneratorConfiguration;
}
getReport(dynamicNestModuleMetadata, options = {
nestModulesEnvironmentsDescription: constants_1.NEST_MODULES_ENVIRONMENTS_DESCRIPTION,
nestModulesStaticEnvironmentsDescription: constants_1.NEST_MODULES_STATIC_ENVIRONMENTS_DESCRIPTION,
nestModulesConfigurationDescription: constants_1.NEST_MODULES_CONFIGURATION_DESCRIPTION,
nestModulesStaticConfigurationDescription: constants_1.NEST_MODULES_STATIC_CONFIGURATION_DESCRIPTION,
nestModulesFeatureConfigurationDescription: constants_1.NEST_MODULES_FEATURE_CONFIGURATION_DESCRIPTION,
nestModulesFeatureEnvironmentsDescription: constants_1.NEST_MODULES_FEATURE_ENVIRONMENTS_DESCRIPTION,
}) {
let lines = [];
const moduleMetadata = dynamicNestModuleMetadata.getNestModuleMetadata?.();
if (moduleMetadata?.moduleCategory) {
lines.push(`### ${moduleMetadata.moduleName}`);
if (moduleMetadata.moduleDescription) {
lines.push(`${moduleMetadata.moduleDescription}`);
lines.push('');
}
if (options.nestJsUsage) {
lines.push(`#### Use in NestJS`);
lines.push(`${options.nestJsUsage}`);
lines.push('');
}
if (options.nestJsModUsage) {
lines.push(`#### Use in NestJS-mod`);
lines.push(`${options.nestJsModUsage}`);
lines.push('');
}
const sharedProvidersArr = !moduleMetadata.sharedProviders || Array.isArray(moduleMetadata.sharedProviders)
? moduleMetadata.sharedProviders
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
moduleMetadata.sharedProviders({
staticConfiguration: {},
staticEnvironments: {},
});
const sharedProviders = ((!moduleMetadata.sharedProviders ? [] : sharedProvidersArr) ?? []);
if (Array.isArray(sharedProviders) && sharedProviders?.length > 0) {
lines.push('#### Shared providers');
lines.push(sharedProviders
.map(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(s) => `\`${s.provide ? String(s.provide.name || s.provide) : s.name}\``)
.join(', '));
lines.push('');
}
const sharedImportsArr = !moduleMetadata.sharedImports || Array.isArray(moduleMetadata.sharedImports)
? moduleMetadata.sharedImports
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
moduleMetadata.sharedImports({
project: {},
settingsModule: {},
staticConfiguration: {},
staticEnvironments: {},
});
const sharedImports = (!moduleMetadata.sharedImports ? [] : sharedImportsArr) || [];
if (Array.isArray(sharedImports) && sharedImports?.length > 0) {
lines.push('#### Shared imports');
lines.push(sharedImports
.map(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(s) => `\`${s.getNestModuleMetadata?.().moduleName || s.name}\``)
.join(', '));
lines.push('');
}
const names = Object.keys(dynamicNestModuleMetadata.moduleSettings || { default: true });
for (const name of names) {
this.reportOfEnvModelInfo({
lines,
settingsModelInfo: dynamicNestModuleMetadata.moduleSettings?.[name].environments,
settingsModelInfoTitle: this.appendContextName('Environments', names.length > 1 ? name : undefined),
settingsModelInfoDescription: options.nestModulesEnvironmentsDescription,
});
this.reportOfConfigModelInfo({
lines,
settingsModelInfo: dynamicNestModuleMetadata.moduleSettings?.[name].configuration,
settingsModelInfoTitle: this.appendContextName('Configuration', names.length > 1 ? name : undefined),
settingsModelInfoDescription: options.nestModulesConfigurationDescription,
});
this.reportOfEnvModelInfo({
lines,
settingsModelInfo: dynamicNestModuleMetadata.moduleSettings?.[name].staticEnvironments,
settingsModelInfoTitle: this.appendContextName('Static environments', names.length > 1 ? name : undefined),
settingsModelInfoDescription: options.nestModulesStaticEnvironmentsDescription,
});
this.reportOfConfigModelInfo({
lines,
settingsModelInfo: dynamicNestModuleMetadata.moduleSettings?.[name].staticConfiguration,
settingsModelInfoTitle: this.appendContextName('Static configuration', names.length > 1 ? name : undefined),
settingsModelInfoDescription: options.nestModulesStaticConfigurationDescription,
});
this.reportOfConfigModelInfo({
lines,
settingsModelInfo: dynamicNestModuleMetadata.moduleSettings?.[name].featureConfiguration,
settingsModelInfoTitle: this.appendContextName('Feature configuration', names.length > 1 ? name : undefined),
settingsModelInfoDescription: options.nestModulesFeatureConfigurationDescription,
});
this.reportOfEnvModelInfo({
lines,
settingsModelInfo: dynamicNestModuleMetadata.moduleSettings?.[name].featureEnvironments,
settingsModelInfoTitle: this.appendContextName('Feature environments', names.length > 1 ? name : undefined),
settingsModelInfoDescription: options.nestModulesFeatureEnvironmentsDescription,
});
const featureModuleNames = Object.keys(dynamicNestModuleMetadata.moduleSettings?.[name].featureModuleConfigurations || {});
const featureEnvironmentsModuleNames = Object.keys(dynamicNestModuleMetadata.moduleSettings?.[name].featureModuleEnvironments || {});
if (featureModuleNames.length > 0) {
for (const featureModuleName of featureModuleNames) {
const featureConfigurations = dynamicNestModuleMetadata.moduleSettings?.[name]?.featureModuleConfigurations?.[featureModuleName] || [];
const newLines = [];
for (const featureConfiguration of featureConfigurations) {
this.reportOfConfigModelInfo({
titleSharps: '#####',
lines: newLines,
settingsModelInfo: featureConfiguration,
settingsModelInfoTitle: `Feature module name: ${featureModuleName}`,
});
}
if (newLines.length > 0) {
lines = [...lines, '#### Modules that use feature configuration', ...newLines];
}
}
}
if (featureEnvironmentsModuleNames.length > 0) {
for (const featureModuleName of featureEnvironmentsModuleNames) {
const featureEnvironments = dynamicNestModuleMetadata.moduleSettings?.[name]?.featureModuleEnvironments?.[featureModuleName] || [];
const newLines = [];
for (const featureEnvironment of featureEnvironments) {
this.reportOfEnvModelInfo({
titleSharps: '#####',
lines: newLines,
settingsModelInfo: featureEnvironment,
settingsModelInfoTitle: `Feature module name: ${featureModuleName}`,
});
}
if (newLines.length > 0) {
lines = [...lines, '#### Modules that use feature environments', ...newLines];
}
}
}
}
}
return lines.join('\n');
}
appendContextName(title, contextName) {
if (contextName) {
return `${title}(${contextName})`;
}
return title;
}
reportOfEnvModelInfo({ titleSharps, lines, settingsModelInfo, settingsModelInfoTitle, settingsModelInfoDescription, }) {
if (this.infrastructureMarkdownReportGeneratorConfiguration.skipEmptySettings &&
settingsModelInfo?.modelPropertyOptions.length === 0) {
return;
}
if (!titleSharps) {
titleSharps = '####';
}
if (settingsModelInfo !== undefined) {
lines.push(`${titleSharps} ${settingsModelInfo.modelOptions.name
? `${settingsModelInfoTitle}: ${settingsModelInfo.modelOptions.name}`
: settingsModelInfoTitle}`);
const description = settingsModelInfo.modelOptions.description || settingsModelInfoDescription || '';
if (description !== undefined && this.infrastructureMarkdownReportGeneratorConfiguration.style !== 'pretty') {
lines.push(`${description}`);
}
lines.push('');
if (this.infrastructureMarkdownReportGeneratorConfiguration.style !== 'pretty') {
lines.push([
'| Key | Description | Sources | Constraints | Default | Value |',
'| ------ | ----------- | ------- | ----------- | ------- | ----- |',
...(settingsModelInfo?.modelPropertyOptions.map((modelPropertyOption) => [
'',
// Key
`\`${String(modelPropertyOption.originalName)}${modelPropertyOption.name ? ` (${modelPropertyOption.name})` : ''}\``,
// Description
modelPropertyOption.description || '-',
// Sources
settingsModelInfo?.validations[modelPropertyOption.originalName].propertyValueExtractors
.map((propertyValueExtractor) => `\`${propertyValueExtractor.example.example}\``)
.join(', ') || '-',
// Constraints
Object.entries(settingsModelInfo?.validations[modelPropertyOption.originalName].constraints || {})
.map(([key, value]) => `**${key}** (${value})`)
.join(', ') || '**optional**',
// Default
this.safeValue(modelPropertyOption.default),
// Value
modelPropertyOption.hideValueFromOutputs
? '**hidden**'
: this.safeValue(settingsModelInfo?.validations[modelPropertyOption.originalName].value, modelPropertyOption.default),
'',
].join('|')) || []),
].join('\n'));
}
else {
lines.push([
'| Key | Sources | Constraints | Value |',
'| ------ | ------- | ----------- | ----- |',
...(settingsModelInfo?.modelPropertyOptions.map((modelPropertyOption) => [
'',
// Key
`\`${String(modelPropertyOption.originalName)}${modelPropertyOption.name ? ` (${modelPropertyOption.name})` : ''}\``,
// Sources
settingsModelInfo?.validations[modelPropertyOption.originalName].propertyValueExtractors
.map((propertyValueExtractor) => `\`${propertyValueExtractor.example.example}\``)
.join(', ') || '-',
// Constraints
Object.entries(settingsModelInfo?.validations[modelPropertyOption.originalName].constraints || {})
.map(([key, value]) => `**${key}** (${value})`)
.join(', ') || '**optional**',
// Value
modelPropertyOption.hideValueFromOutputs
? '**hidden**'
: this.safeValue(settingsModelInfo?.validations[modelPropertyOption.originalName].value, modelPropertyOption.default),
'',
].join('|')) || []),
].join('\n'));
}
lines.push('');
}
return lines;
}
reportOfConfigModelInfo({ titleSharps, lines, settingsModelInfo, settingsModelInfoTitle, settingsModelInfoDescription, }) {
if (this.infrastructureMarkdownReportGeneratorConfiguration.skipEmptySettings &&
!settingsModelInfo?.modelPropertyOptions.some((modelPropertyOption) => settingsModelInfo?.validations[modelPropertyOption.originalName].value !== undefined &&
settingsModelInfo?.validations[modelPropertyOption.originalName].value !== modelPropertyOption.default)) {
return;
}
if (!titleSharps) {
titleSharps = '####';
}
if (settingsModelInfo) {
lines.push(`${titleSharps} ${settingsModelInfo.modelOptions.name
? `${settingsModelInfoTitle}: ${settingsModelInfo.modelOptions.name}`
: settingsModelInfoTitle}`);
const description = settingsModelInfo.modelOptions.description || settingsModelInfoDescription || '';
if (description !== undefined && this.infrastructureMarkdownReportGeneratorConfiguration.style !== 'pretty') {
lines.push(`${description}`);
}
lines.push('');
if (this.infrastructureMarkdownReportGeneratorConfiguration.style !== 'pretty') {
lines.push([
'| Key | Description | Constraints | Default | Value |',
'| ------ | ----------- | ----------- | ------- | ----- |',
...(settingsModelInfo?.modelPropertyOptions
.filter((modelPropertyOption) => !this.infrastructureMarkdownReportGeneratorConfiguration.skipEmptySettings ||
(this.infrastructureMarkdownReportGeneratorConfiguration.skipEmptySettings &&
settingsModelInfo?.validations[modelPropertyOption.originalName].value !== undefined &&
settingsModelInfo?.validations[modelPropertyOption.originalName].value !==
modelPropertyOption.default))
.map((modelPropertyOption) => [
'',
// Key
`\`${String(modelPropertyOption.originalName)}\``,
// Description
modelPropertyOption.description || '-',
// Constraints
Object.entries(settingsModelInfo?.validations[modelPropertyOption.originalName].constraints || {})
.map(([key, value]) => `**${key}** (${value})`)
.join(', ') || '**optional**',
// Default
this.safeValue(modelPropertyOption.default),
// Value
modelPropertyOption.hideValueFromOutputs
? '**hidden**'
: this.safeValue(settingsModelInfo?.validations[modelPropertyOption.originalName].value, modelPropertyOption.default),
'',
].join('|')) || []),
].join('\n'));
}
else {
lines.push([
'| Key | Constraints | Value |',
'| ------ | ----------- | ----- |',
...(settingsModelInfo?.modelPropertyOptions
.filter((modelPropertyOption) => !this.infrastructureMarkdownReportGeneratorConfiguration.skipEmptySettings ||
(this.infrastructureMarkdownReportGeneratorConfiguration.skipEmptySettings &&
settingsModelInfo?.validations[modelPropertyOption.originalName].value !== undefined &&
settingsModelInfo?.validations[modelPropertyOption.originalName].value !==
modelPropertyOption.default))
.map((modelPropertyOption) => [
'',
// Key
`\`${String(modelPropertyOption.originalName)}\``,
// Constraints
Object.entries(settingsModelInfo?.validations[modelPropertyOption.originalName].constraints || {})
.map(([key, value]) => `**${key}** (${value})`)
.join(', ') || '**optional**',
// Value
this.safeValue(settingsModelInfo?.validations[modelPropertyOption.originalName].value, modelPropertyOption.default),
'',
].join('|')) || []),
].join('\n'));
}
lines.push('');
}
return lines;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
safeValue(value, defaultValue) {
try {
if (value === undefined || value === 'undefined') {
return '-';
}
if (Array.isArray(value)) {
if (value.filter((v) => Object.keys(v || {}).length > 0).length > 0) {
return `[ ${value.map((v) => this.safeValue(v)).join(', ')} ]`;
}
else {
return '-';
}
}
if (typeof value === 'function') {
if (!/^class\s/.test(Function.prototype.toString.call(value))) {
try {
return value.name ? '```' + value.name + '```' : 'Function';
}
catch (err) {
return 'Function';
}
}
else {
try {
const n = Function.prototype.toString.call(value).split('class')[1].split('{')[0].trim();
if (n !== 'Object') {
return n;
}
}
catch (err) {
// null
}
}
}
if (typeof value === 'object') {
try {
if (value.constructor.name) {
const n = value.constructor.name;
if (n !== 'Object') {
return n;
}
}
}
catch (error) {
//
}
if (defaultValue) {
const def = this.safeValue(defaultValue);
const val = JSON.stringify(value);
if (JSON.stringify(def) === val) {
return '```' + String(defaultValue) + '```';
}
}
return '```' + JSON.stringify(value) + '```';
}
try {
if (value.name) {
return value.name;
}
}
catch (err) {
// null
}
if (value === undefined || value === 'undefined') {
return '-';
}
return typeof value.split === 'function'
? '```' + value.split('\n').join('').split('`').join('\\`') + '```'
: '```' + value + '```';
}
catch (err) {
return '-';
}
}
};
exports.DynamicNestModuleMetadataMarkdownReportGenerator = DynamicNestModuleMetadataMarkdownReportGenerator;
exports.DynamicNestModuleMetadataMarkdownReportGenerator = DynamicNestModuleMetadataMarkdownReportGenerator = tslib_1.__decorate([
(0, common_1.Injectable)(),
tslib_1.__metadata("design:paramtypes", [InfrastructureMarkdownReportGeneratorConfiguration])
], DynamicNestModuleMetadataMarkdownReportGenerator);
let InfrastructureMarkdownReportStorageService = class InfrastructureMarkdownReportStorageService {
};
exports.InfrastructureMarkdownReportStorageService = InfrastructureMarkdownReportStorageService;
exports.InfrastructureMarkdownReportStorageService = InfrastructureMarkdownReportStorageService = tslib_1.__decorate([
(0, common_1.Injectable)()
], InfrastructureMarkdownReportStorageService);
exports.InfrastructureMarkdownReportStorage = (0, utils_1.createNestModule)({
moduleName: 'InfrastructureMarkdownReportStorage',
moduleDescription: 'Infrastructure markdown report storage',
moduleCategory: types_1.NestModuleCategory.infrastructure,
sharedProviders: [InfrastructureMarkdownReportStorageService],
}).InfrastructureMarkdownReportStorage;
function getInfrastructureMarkdownReportGeneratorBootstrap({ project, modules, }) {
let InfrastructureMarkdownReportGeneratorBootstrap = class InfrastructureMarkdownReportGeneratorBootstrap {
constructor(dynamicNestModuleMetadataMarkdownReportGenerator, infrastructureMarkdownReportStorage, infrastructureMarkdownReportGeneratorConfiguration, packageJsonService) {
this.dynamicNestModuleMetadataMarkdownReportGenerator = dynamicNestModuleMetadataMarkdownReportGenerator;
this.infrastructureMarkdownReportStorage = infrastructureMarkdownReportStorage;
this.infrastructureMarkdownReportGeneratorConfiguration = infrastructureMarkdownReportGeneratorConfiguration;
this.packageJsonService = packageJsonService;
}
onApplicationBootstrap() {
this.infrastructureMarkdownReportStorage.report = this.getReport();
if ((0, is_infrastructure_1.isInfrastructureMode)()) {
if (this.infrastructureMarkdownReportGeneratorConfiguration.markdownFile) {
const fileDir = (0, path_1.dirname)(this.infrastructureMarkdownReportGeneratorConfiguration.markdownFile);
if (!(0, fs_1.existsSync)(fileDir)) {
(0, fs_1.mkdirSync)(fileDir, { recursive: true });
}
(0, fs_1.writeFileSync)(this.infrastructureMarkdownReportGeneratorConfiguration.markdownFile, this.infrastructureMarkdownReportStorage.report);
}
}
}
getReport() {
const lines = [];
const packageJson = this.packageJsonService.read();
try {
if (project) {
lines.push(`# ${project.name}`);
if (project?.version) {
lines.push(`> Version: ${project.version}`);
}
lines.push('');
if (project.description) {
lines.push(`${project.description}`);
}
}
if (project?.repository) {
const rep = (typeof project.repository === 'string' ? project.repository : project.repository.url).replace('git+', '');
const projectName = (0, path_1.basename)(rep).replace('.git', '');
lines.push(`## Installation`);
lines.push(`\`\`\`bash\ngit clone ${rep}
cd ${projectName}
npm install
\`\`\``);
}
const projectScripts = (project ?? {});
for (const [category, scripts] of Object.entries(projectScripts)) {
if (constants_1.PROJECT_SCRIPTS_DESCRIPTIONS[category] && Array.isArray(scripts) && scripts.length > 0) {
lines.push(`## ${constants_1.PROJECT_SCRIPTS_DESCRIPTIONS[category]}`);
lines.push(`\`\`\`bash\n${scripts
.map((s) => [
packageJson?.scriptsComments?.[s]?.length
? `# ${(0, case_anything_1.lowerCase)(packageJson?.scriptsComments?.[s].join(' '))}`
: '',
`npm run ${s}`,
]
.filter(Boolean)
.join('\n'))
.join('\n\n')}\n\`\`\``);
}
}
}
catch (err) {
// todo: add checks
// skip all errors
}
const categories = Object.keys(packageJson?.scripts || {});
if (categories.length > 0 && this.infrastructureMarkdownReportGeneratorConfiguration.style !== 'pretty') {
lines.push('## All scripts');
lines.push(`|Script|Description|`);
lines.push(`|---|---|`);
for (const category of categories) {
lines.push(`|**${category}**|`);
const keys = Object.keys(packageJson?.scripts?.[category] || {});
for (const key of keys) {
lines.push(`|\`npm run ${key}\`|${packageJson?.scripts?.[category]?.[key].comments.join(' ') || ''}|`);
}
}
}
for (const category of types_1.NEST_MODULE_CATEGORY_LIST) {
const nestModules = (modules[category] || []).filter((m) => m.getNestModuleMetadata?.().moduleCategory);
if (nestModules.length > 0) {
lines.push(`## ${constants_1.NEST_MODULE_CATEGORY_TITLE[category]}`);
if (constants_1.NEST_MODULE_CATEGORY_DESCRIPTION[category] &&
this.infrastructureMarkdownReportGeneratorConfiguration.style !== 'pretty') {
lines.push(constants_1.NEST_MODULE_CATEGORY_DESCRIPTION[category]);
}
lines.push('');
}
for (const nestModule of nestModules) {
lines.push(this.dynamicNestModuleMetadataMarkdownReportGenerator.getReport(nestModule));
}
}
if (project?.maintainers && this.infrastructureMarkdownReportGeneratorConfiguration.style !== 'pretty') {
lines.push('');
lines.push('## Maintainers');
if (Array.isArray(project.maintainers)) {
for (const m of project.maintainers) {
if (typeof m === 'string') {
lines.push(`- ${m}`);
}
else {
lines.push(`- [${m.name}](${m.email})`);
}
}
}
}
if (project?.license && this.infrastructureMarkdownReportGeneratorConfiguration.style !== 'pretty') {
lines.push('');
lines.push('## License');
lines.push(`[${project?.license}](LICENSE)`);
}
//lines
return lines.join('\n');
}
};
InfrastructureMarkdownReportGeneratorBootstrap = tslib_1.__decorate([
(0, common_1.Injectable)(),
tslib_1.__metadata("design:paramtypes", [DynamicNestModuleMetadataMarkdownReportGenerator,
InfrastructureMarkdownReportStorageService,
InfrastructureMarkdownReportGeneratorConfiguration,
package_json_service_1.PackageJsonService])
], InfrastructureMarkdownReportGeneratorBootstrap);
return InfrastructureMarkdownReportGeneratorBootstrap;
}
exports.InfrastructureMarkdownReportGenerator = (0, utils_1.createNestModule)({
moduleName: 'InfrastructureMarkdownReportGenerator',
moduleDescription: 'Infrastructure markdown report generator.',
globalEnvironmentsOptions: { skipValidation: true },
globalConfigurationOptions: { skipValidation: true },
staticConfigurationModel: InfrastructureMarkdownReportGeneratorConfiguration,
sharedProviders: [DynamicNestModuleMetadataMarkdownReportGenerator],
// we want collect report about all modules
// for than we should place new report collector to end of infrastructure section
preWrapApplication: async ({ project, modules, current }) => {
if (!modules[types_1.NestModuleCategory.infrastructure]) {
modules[types_1.NestModuleCategory.infrastructure] = [];
}
modules[types_1.NestModuleCategory.infrastructure].push((0, utils_1.createNestModule)({
moduleName: 'InfrastructureMarkdownReportGenerator',
moduleDescription: 'Infrastructure markdown report generator.',
sharedProviders: [DynamicNestModuleMetadataMarkdownReportGenerator],
providers: [
getInfrastructureMarkdownReportGeneratorBootstrap({
modules,
project,
}),
],
imports: [
project_utils_module_1.ProjectUtils.forFeature({ featureModuleName: 'InfrastructureMarkdownReportGenerator' }),
exports.InfrastructureMarkdownReportStorage.forFeature({
featureModuleName: 'InfrastructureMarkdownReportGenerator',
contextName: current.asyncModuleOptions.contextName,
}),
],
staticConfigurationModel: InfrastructureMarkdownReportGeneratorConfiguration,
moduleCategory: types_1.NestModuleCategory.infrastructure,
}).InfrastructureMarkdownReportGenerator.forRootAsync(current.asyncModuleOptions));
},
}).InfrastructureMarkdownReportGenerator;
//# sourceMappingURL=infrastructure-markdown-report.js.map