Skip to content

Commit

Permalink
feature: add tenant modules to docs wip
Browse files Browse the repository at this point in the history
  • Loading branch information
florianow committed Jan 11, 2024
1 parent 7ab44ae commit fcb2881
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
8 changes: 6 additions & 2 deletions src/docs/PlatformDocumentationGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
PlatformDependencies,
} from "../kit/KitDependencyAnalyzer.ts";
import { CollieRepository } from "../model/CollieRepository.ts";

import { FoundationRepository } from "../model/FoundationRepository.ts";
import { PlatformConfig } from "../model/PlatformConfig.ts";
import { DocumentationRepository } from "./DocumentationRepository.ts";
Expand Down Expand Up @@ -197,7 +196,12 @@ export class PlatformDocumentationGenerator {
docsRepo: DocumentationRepository,
destPath: string,
) {
if (!dep.kitModule) {
if (dep.kitModuleId == "tenant") {
const kitModuleSection = `::: tip Tenant module
This is a tenant module.
:::`;
return kitModuleSection;
} else if (!dep.kitModule) {
return MarkdownUtils.container(
"warning",
"Invalid Kit Module Dependency",
Expand Down
22 changes: 15 additions & 7 deletions src/kit/KitDependencyAnalyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,25 @@ export class KitDependencyAnalyzer {
);
const kitModule = this.kitModules.tryFindById(kitModuleId);

if (!kitModule) {
if (kitModuleId.includes("/tenants/")) {
return {
sourcePath,
kitModuleId: "tenant",
kitModulePath: sourcePath.replace("/terragrunt.hcl", ""),
kitModule,
};
} else if (!kitModule) {
const msg =
`Could not find kit module with id ${kitModuleId} included from ${sourcePath}`;
this.logger.warn(msg);
} else {
return {
sourcePath,
kitModuleId,
kitModulePath,
kitModule,
};
}
return {
sourcePath,
kitModuleId,
kitModulePath,
kitModule,
};
}

static parseTerraformSource(hcl: string): string | undefined {
Expand Down

0 comments on commit fcb2881

Please sign in to comment.