Skip to content

Commit e2f756b

Browse files
style: run deno fmt
1 parent 142f72e commit e2f756b

File tree

2 files changed

+36
-33
lines changed

2 files changed

+36
-33
lines changed

src/docs/PlatformDocumentationGenerator.ts

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class PlatformDocumentationGenerator {
2626
private readonly kitDependencyAnalyzer: KitDependencyAnalyzer,
2727
private readonly controls: ComplianceControlRepository,
2828
private readonly terragrunt: TerragruntCliFacade,
29-
private readonly logger: Logger
29+
private readonly logger: Logger,
3030
) {}
3131

3232
async generate(docsRepo: DocumentationRepository) {
@@ -39,24 +39,24 @@ export class PlatformDocumentationGenerator {
3939
const dest = docsRepo.resolvePlatformsPath("README.md");
4040

4141
this.logger.verbose(
42-
(fmt) => `Copying ${fmt.kitPath(source)} to ${fmt.kitPath(dest)}`
42+
(fmt) => `Copying ${fmt.kitPath(source)} to ${fmt.kitPath(dest)}`,
4343
);
4444
await fs.ensureDir(path.dirname(dest));
4545
await fs.copy(source, dest, { overwrite: true });
4646
}
4747

4848
private async generatePlatformsDocumentation(
49-
docsRepo: DocumentationRepository
49+
docsRepo: DocumentationRepository,
5050
) {
5151
const foundationProgress = new ProgressReporter(
5252
"generate documentation",
5353
this.repo.relativePath(this.foundation.resolvePath()),
54-
this.logger
54+
this.logger,
5555
);
5656

57-
const foundationDependencies =
58-
await this.kitDependencyAnalyzer.findKitModuleDependencies(
59-
this.foundation
57+
const foundationDependencies = await this.kitDependencyAnalyzer
58+
.findKitModuleDependencies(
59+
this.foundation,
6060
);
6161

6262
for (const p of foundationDependencies.platforms) {
@@ -68,22 +68,22 @@ export class PlatformDocumentationGenerator {
6868

6969
private async generatePlatforDocumentation(
7070
dependencies: PlatformDependencies,
71-
docsRepo: DocumentationRepository
71+
docsRepo: DocumentationRepository,
7272
) {
7373
const platformPath = this.foundation.resolvePlatformPath(
74-
dependencies.platform
74+
dependencies.platform,
7575
);
7676
const platformProgress = new ProgressReporter(
7777
"generate documentation",
7878
this.repo.relativePath(platformPath),
79-
this.logger
79+
this.logger,
8080
);
8181

8282
const platformModuleDocumentation =
8383
new RunIndividualPlatformModuleOutputCollector(
8484
this.repo,
8585
this.terragrunt,
86-
this.logger
86+
this.logger,
8787
);
8888

8989
// as a fallback process modules serially, unfortunately this is the only "safe" way to collect output
@@ -95,7 +95,7 @@ export class PlatformDocumentationGenerator {
9595
dep,
9696
documentationMd,
9797
docsRepo,
98-
dependencies.platform
98+
dependencies.platform,
9999
);
100100
}
101101

@@ -106,11 +106,11 @@ export class PlatformDocumentationGenerator {
106106
dep: KitModuleDependency,
107107
documentationMd: string,
108108
docsRepo: DocumentationRepository,
109-
platform: PlatformConfig
109+
platform: PlatformConfig,
110110
) {
111111
const destPath = docsRepo.resolvePlatformModulePath(
112112
platform.id,
113-
dep.kitModuleId
113+
dep.kitModuleId,
114114
);
115115

116116
await fs.ensureDir(path.dirname(destPath)); // todo: should we do nesting in the docs output or "flatten" module prefixes?
@@ -120,43 +120,45 @@ export class PlatformDocumentationGenerator {
120120
const complianceStatementsBlock = this.generateComplianceStatementSection(
121121
dep,
122122
docsRepo,
123-
destPath
123+
destPath,
124124
);
125125
mdSections.push(complianceStatementsBlock);
126126

127127
const kitModuleSection = this.generateKitModuleSection(
128128
dep,
129129
docsRepo,
130-
destPath
130+
destPath,
131131
);
132132
mdSections.push(kitModuleSection);
133133

134134
await Deno.writeTextFile(destPath, mdSections.join("\n\n"));
135135

136136
this.logger.verbose(
137137
(fmt) =>
138-
`Wrote output "documentation_md" from platform module ${fmt.kitPath(
139-
dep.sourcePath
140-
)} to ${fmt.kitPath(destPath)}`
138+
`Wrote output "documentation_md" from platform module ${
139+
fmt.kitPath(
140+
dep.sourcePath,
141+
)
142+
} to ${fmt.kitPath(destPath)}`,
141143
);
142144
}
143145

144146
private generateKitModuleSection(
145147
dep: KitModuleDependency,
146148
docsRepo: DocumentationRepository,
147-
destPath: string
149+
destPath: string,
148150
) {
149151
if (!dep.kitModule) {
150152
return MarkdownUtils.container(
151153
"warning",
152154
"Invalid Kit Module Dependency",
153-
"Could not find kit module at " + MarkdownUtils.code(dep.kitModulePath)
155+
"Could not find kit module at " + MarkdownUtils.code(dep.kitModulePath),
154156
);
155157
}
156158

157159
const kitModuleLink = MarkdownUtils.link(
158160
dep.kitModule.name + " kit module",
159-
docsRepo.kitModuleLink(destPath, dep.kitModuleId)
161+
docsRepo.kitModuleLink(destPath, dep.kitModuleId),
160162
);
161163

162164
const kitModuleSection = `::: tip Kit module
@@ -168,23 +170,25 @@ This platform module is a deployment of kit module ${kitModuleLink}.
168170
private generateComplianceStatementSection(
169171
dep: KitModuleDependency,
170172
docsRepo: DocumentationRepository,
171-
destPath: string
173+
destPath: string,
172174
) {
173175
const complianceStatements = dep?.kitModule?.compliance
174176
?.map((x) => {
175177
const control = this.controls.tryFindById(x.control);
176178
if (!control) {
177179
this.logger.warn(
178-
`could not find compliance control ${x.control} referenced in a compliance statement in ${dep.kitModulePath}`
180+
`could not find compliance control ${x.control} referenced in a compliance statement in ${dep.kitModulePath}`,
179181
);
180182

181183
return;
182184
}
183185

184-
return `- [${control.name}](${docsRepo.controlLink(
185-
destPath,
186-
x.control
187-
)}): ${x.statement}`;
186+
return `- [${control.name}](${
187+
docsRepo.controlLink(
188+
destPath,
189+
x.control,
190+
)
191+
}): ${x.statement}`;
188192
})
189193
.filter((x): x is string => !!x);
190194

src/docs/PlatformModuleOutputCollector.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ import { CollieRepository } from "../model/CollieRepository.ts";
55
import { Logger } from "../cli/Logger.ts";
66
import { MeshError } from "../errors.ts";
77

8-
98
/**
10-
* Note:
9+
* Note:
1110
* For a great UX/DX it's important that running "collie foundation docs" is fast.
12-
*
11+
*
1312
* We have therefore tried speeding it up by collecting output from platform modules in parallel.
1413
* Unfortunately, it appears that terragrunt does not offer us a good way to reliably get all the outputs from all
1514
* platform modules, see https://github.com/meshcloud/collie-cli/issues/267
16-
*
15+
*
1716
* This "fast mode" detection also caused other bugs like https://github.com/meshcloud/collie-cli/issues/269
18-
*
17+
*
1918
* In the future, we should maybe investigate cachingas an alternative to parallelization, because usually an engineer
2019
* would re-run "collie foundation docs" only after changing a specific platform module
2120
*/

0 commit comments

Comments
 (0)